Article View: gnu.gcc.bug
Article #6336add-sym: how to get address for it
From: Linh Phan
Date: Thu, 21 Dec 1995 00:00
Date: Thu, 21 Dec 1995 00:00
42 lines
1824 bytes
1824 bytes
Hi,
I was wondering how I can use add-sym to debug in side share objects?
Below I tried to use dlsym to obtain the address to use with add-sym, but I
could not get it to stop in the function that I wanted to debug.
/***********************************************************************
dynamic_load.c:
************************************************************************/
#include <dlfcn.h>
main () {
char buf[80];
void (*objfunc)();
int dlderr;
void *xlib;
xlib=dlopen("/home/phan/debug_func.so", 1);
objfunc = (void (*)()) dlsym(xlib, "debug_func");
printf("IS OBJFUNC: %d THE ADDRESS TO USE WITH ADD-SYM???", objfunc);
/* The above prints out that objfunc = 0xef76b030
I add a BREAK POINT HERE and use:
(gdb) add-sym /home/phan/debug_func.so 0xef76b030
(gdb) break debug_func
(gdb) continue
*/
objfunc(); /* But here it just call "debug_func" without ever stopping
in "debug_func" */
}
/***********************************************************************
debug_func.c:
IS THIS THE WAY TO GENERATE A SHARED OBJECT FOR USE WITH ADD-SYM
gcc -shared -c -g debug_func.c
ld -o debug_func.so debug_func.o
************************************************************************/
debug_func () {
printf("PLEASE HELP\n");
}
Thank you very much for your help,
Linh Phan
Technical Details
Message-ID:
<199512210512.VAA24033@telerobotics.jpl.nasa.gov>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,ae8a4bf928679d3,start X-Google-Attributes: gid113d02,public From: phan@telerobotics.jpl.nasa.gov (Linh Phan) Subject: add-sym: how to get address for it Date: 1995/12/21 Message-ID: <199512210512.VAA24033@telerobotics.jpl.nasa.gov> X-Deja-AN: 122498324 distribution: gnu sender: daemon@cis.ohio-state.edu organization: GNUs Not Usenet newsgroups: gnu.gcc.bug