- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- dladdr returning _DYNAMIC as function name!
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2010 02:10 AM - last edited on тАО10-08-2012 09:22 PM by Maiko-I
тАО01-04-2010 02:10 AM - last edited on тАО10-08-2012 09:22 PM by Maiko-I
Hello :)
I have been using dladdr() for converting code address into symbolic address. I get function name to the corresponding address.
I have a caller function call.c in which I have defined some functions like
" Iwillallocate() "
which call malloc() etc.
Now i creased an external.so which has a function
void call()
which calls malloc too.
Now when i link this .so with the exe file for call.c ,the dladdr function successfully returns me the fucntion names of the functions in call.c but it returns _DYNAMIC for the fucntion in external.so and does not return the function name call().
when I use nm command n search the symbol table I get:
4: 60000000c0a1b790 : call() + 0x190 (./external.so)
5: 0000000004000bc0 : _Z13Iwillallocatev() + 0x20 (./test)
6: 0000000004000b10 : main() + 0x60 (./test)
7: 60000000c004ddb0 : main_opd_entry() + 0x50 (/usr/lib/hpux32/dld.so)
Ass you can see it gives 60000000c0a1b790 address for call() in external.so 0000000004000bc0 address for Iwillallocate() in ./test (which is my exe file i created)
The address for call() is too high in value.. and hence we get _DYNAMIC as a result when i pass this address in dladdr() and not call() :(.
Now 2 questions:
Q1) Is there any other fucntion other than dladdr which would serve my purpose?
Q2)Are there any switches to be used while making .so or .o or the exe file test which need to be used so that this _DYNAMIC error does not come and I get the correct function names present in external.so .
Thank you experts very much in advance.
Regards
P.S. This thread has been moved from HP-UX > General to HP-UX > Languages and Scripting - HP Forums Moderator
Solved! Go to Solution.
- Tags:
- dladdr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2010 02:23 AM
тАО01-04-2010 02:23 AM
Re: dladdr returning _DYNAMIC as function name!
5: 0000000004000bc0 : _Z13Iwillallocatev() + 0x20 (./test)
6: 0000000004000b10 : main() + 0x60 (./test)
7: 60000000c004ddb0 : main_opd_entry() + 0x50 (/usr/lib/hpux32/dld.so)
Is the result of PSTACK not NM sorry :D:D!
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2010 10:49 AM
тАО01-04-2010 10:49 AM
SolutionIn general this won't work. It doesn't handle hidden nor static functions. And for PA, it doesn't handle stubs.
>Q1) Is there any other function other than dladdr which would serve my purpose?
Try looking at the Unwind lib: unwind(5)
>Q2) Are there any switches to be used while making .so or .o or the exe file ...
By default they should be there unless you use tricky compiler/linker options or the function is static.
>Is the result of PSTACK not NM
U_STACK_TRACE(3) should also work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2010 12:23 AM
тАО01-05-2010 12:23 AM
Re: dladdr returning _DYNAMIC as function name!
Thanks Dennis :)
That helped a lot :)
I managed to find one more function which works similar to dladdr()
uwx_get_sym_info()
This gave me the desired result.
Regards :)