Questions tagged [dladdr]
15 questions
7
votes
3 answers
Get List of all native classes
I want to get all the native classes (NSString, NSNumber, int, float, NSSet, NSDictionary) that I have loaded into my iOS Project..
i.e., if I have created a custom class named "TestClass" I don't want it listed...
I have already got a code but it…

Raon
- 1,266
- 3
- 12
- 25
6
votes
4 answers
variable name, function arguments at run time in C
Is it possible to know a function arguments and variables' name types at runtime in C program ? For example, if I have a function:
int abc(int x, float y , somestruct z ){
char a;
int b ;
}
Can I know inside this function abc(), what are…

app
- 421
- 1
- 4
- 7
5
votes
1 answer
Memory semantics of dladdr() out parameter
What are the memory semantics of dladdr()?
#define _GNU_SOURCE
#include
int dladdr(void *addr, Dl_info *info);
typedef struct {
const char *dli_fname; /* Pathname of shared object that contains address */
void *dli_fbase; …

IanPudney
- 5,941
- 1
- 24
- 39
3
votes
0 answers
Is it possible to define a symbol dynamically such that it will be found by dlsym?
I want to simulate loading symbols from a shared library for testing purposes.
Is there a way to define a symbol at runtime programmatically such that dlsym will find it?
For example:
dl_define_symbol("foobar")
....
void* f =…

Bruce Adams
- 4,953
- 4
- 48
- 111
3
votes
1 answer
On Linux, in a C++ program, how do I find the path to the shared library that was loaded?
I need to load functions from a custom library on an embedded platform that does not have a lot of the usual tools (e.g. no ldd, no gdb, etc). I'm cross compiling to that platform.
Suppose I want to use the function foo from libx.so. Now the…

user1462309
- 480
- 2
- 10
3
votes
0 answers
Why does dladdr return a path to the executable on position independent code on arm-linux?
I've been running into a problem with dladdr in some of my code that I've cross-compiled for arm-linux using Emdebian's g++-4.7 cross compiler for armhf. The problem seems to be that if the function pointer you pass to dladdr is a function that is…

along18
- 31
- 2
2
votes
1 answer
glibc - get handle to shared library having symbol containing specified address
Something like dladdr that gives me a dynamic library handle to the shared object or a way to get the handle from the shared object's base address. The file containing the shared object may have been moved or deleted so no, I can't dlopen() the…

Hristo Venev
- 972
- 5
- 17
2
votes
2 answers
How can I get more information about symbol by it's address in memory
I'm trying to get the symbol name by its address in memory. I use int dladdr(void *addr, Dl_info *info) function from dlfcn.h to get the information:
typedef struct {
const char *dli_fname; /* Pathname of shared object that
…

linuxbuild
- 15,843
- 6
- 60
- 87
1
vote
0 answers
C How to make static function to be contained in .dynsym?
Background
I'm using -finstrument-functions to trace function call in a c project.
I convert function address to function name by using dladdr. It successfully prase some address to function name, but some of them still cannot be parsed.
I've…

Rhino hu
- 13
- 3
1
vote
0 answers
C++ function address -- using dladdr and backtrace()
I want to use backtrace() and get function address for tracing purpose. I want to store function address from backtrace() during run time, and use it for analysis later on (e.g. load back function name, look at call stats etc using dladdr()). While…

surfcode
- 445
- 1
- 5
- 20
0
votes
1 answer
Is there an equivalent of GetModuleFileName() for Linux and how would I use it?
I have a function on Windows to get the address of the module in buf:
GetModuleFileName(0, buf, buf_size);
I want to do the same on Linux (which I do not know much about). I found the function dladdr(X, &dlInfo) which seems to do the right thing.…

user3443063
- 1,455
- 4
- 23
- 37
0
votes
1 answer
How to print source file name with dladdr() function?
I was trying to print a backtrace using dladdr(). info.dli_fname in the following code snippet is displaying the file name of an ELF file. Could you please tell me if it is possible to resolve and print the name of the source file and line number…

Kirubakaran
- 378
- 4
- 20
0
votes
1 answer
Name of a function defined in executable (using dladdr)
I have a program (an application, not a shared library):
void func() {
int RESULT = UNW_ESUCCESS;
unw_context_t context;
unw_getcontext(&context);
unw_cursor_t cursor;
RESULT = unw_init_local(&cursor, &context);
…

embedc
- 1,485
- 1
- 6
- 20
0
votes
1 answer
dose dladdr able to get the info from static member?
during reserch of some library I found this kind of code
Dl_info info = {
NULL,
NULL,
NULL,
NULL
};
if (!dladdr((void*) dirSep, &info)) {
return libPath.c_str();
}
where dirSep is static const char* member in class where this code…

zapredelom
- 1,009
- 1
- 11
- 28
0
votes
1 answer
dladdr does not return full path in dli_fname
I use dladdr to get full path to the library:
Dl_info dl_info;
int ret = dladdr((void*)&func, &dl_info);
if (ret)
// use dl_info.dli_fname;
It works fine. However, if I rename the folder with the build (and then run again), dli_fname…

queen3
- 15,333
- 8
- 64
- 119