Bluehost.com Web Hosting $6.95

Stepping into my compiled libnetsnmpagent.so.5 with gdb when there is a

This is a discussion on Stepping into my compiled libnetsnmpagent.so.5 with gdb when there is a within the SNMP Coders forums, part of the Networking and Network Related category; <html><body> <p>Hi,<br> I am very new to net-snmp ...


Go Back   Usenet Forums > Networking and Network Related > SNMP Coders

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-18-2005
Alan.Anderson@radisys.com
 
Posts: n/a
Default Stepping into my compiled libnetsnmpagent.so.5 with gdb when there is a

<html><body>
<p>Hi,<br>
I am very new to net-snmp and to linux...just what you guys wanted to h=
ear, right? Anyway, I am sure there is a simple answer for this but I h=
ave been beating my head against the wall the past few days so if some =
one could take time to explain how to step into a shared library with g=
db, I would very much appreciate it. There is a short version of the qu=
estion, and a long version below. <br>
<br>
My short question is: <br>
How do I set up the environment to allow me to step into my compiled ve=
rsion libnetsnmpagent.so.5 with gdb when there is a system shared libra=
ry of the same name in the system path? Is there an environment variabl=
e in gdb I need to set to have it pick up the right shared module? I t=
ried static linking but I got lost in a maze of link order problems. I =
would rather get the dynamic debugging going but I am open to static li=
nking if some one could help with the link order. That is a whole other=
post though....thanks for the help.<br>
<br>
Thanks for the help,<br>
<br>
Alan L. Anderson<br>
RadiSys<br>
alan.anderson@radisys.com<br>
<br>
************** The same question in long format with research *********=
**************<br>
It seems that when I set the dynamic linker environment variables to ve=
rbose:<br>
setenv LD_VERBOSE t<br>
setenv LD_TRACE_LOADED_OBJECTS t<br>
setenv LD_WARN t<br>
<br>
I get what I expect. Before the LD_LIBRARY_PATH is set, I get this.
<ul>bld1-dsm&gt; pwd<br>
/vobs/vob3/net-snmp/doc/tutorial<br>
bld1-dsm&gt; ./example-demon<br>
libnetsnmpagent.so.5 =3D&gt; /usr/lib/libnetsnmpagent.so.5 (0x4=
0023000)<br>
libnetsnmpmibs.so.5 =3D&gt; /usr/lib/libnetsnmpmibs.so.5 (0x400=
3a000)<br>
libnetsnmphelpers.so.5 =3D&gt; /usr/lib/libnetsnmphelpers.so.5 =
(0x400d5000)<br>
libnetsnmp.so.5 =3D&gt; /usr/lib/libnetsnmp.so.5 (0x400e6000)<b=
r>
libdl.so.2 =3D&gt; /lib/libdl.so.2 (0x40167000)<br>
libcrypto.so.4 =3D&gt; /lib/libcrypto.so.4 (0x4016b000)<br>
libm.so.6 =3D&gt; /lib/tls/libm.so.6 (0x4025d000)<br>
libc.so.6 =3D&gt; /lib/tls/libc.so.6 (0x42000000)<br>
/lib/ld-linux.so.2 =3D&gt; /lib/ld-linux.so.2 (0x40000000)<br>
libgssapi_krb5.so.2 =3D&gt; /usr/kerberos/lib/libgssapi_krb5.so=
..2 (0x4027f000<br>
)<br>
libkrb5.so.3 =3D&gt; /usr/kerberos/lib/libkrb5.so.3 (0x40292000=
)<br>
libcom_err.so.3 =3D&gt; /usr/kerberos/lib/libcom_err.so.3 (0x40=
2f0000)<br>
libk5crypto.so.3 =3D&gt; /usr/kerberos/lib/libk5crypto.so.3 (0x=
402f2000)<br>
libresolv.so.2 =3D&gt; /lib/libresolv.so.2 (0x40303000)<br>
libz.so.1 =3D&gt; /usr/lib/libz.so.1 (0x40315000)<br>
</ul>
After the LD_LIBRARY_PATH is set, I get this:
<ul>bld1-dsm&gt; printenv LD_LIBRARY_PATH /vobs/vob3/net-snmp/tfs/x86/a=
gent/.libs:/vobs/vob3/net-snmp/tfs/x86/snmplib/.libs:/vobs/vob3/net-snm=
p/tfs/x86/agent/helpers/.libs:/usr/X11R5/lib:/usr/MOTIF/lib<br>
bld1-dsm&gt;<br>
<br>
/vobs/vob3/net-snmp/doc/tutorial<br>
bld1-dsm&gt; ./example-demon<br>
libnetsnmpagent.so.5 =3D&gt; /vobs/vob3/net-snmp/tfs/x86/agent/=
..libs/libnetsnmpagent.so.5 (0x40017000)<br>
libnetsnmpmibs.so.5 =3D&gt; /vobs/vob3/net-snmp/tfs/x86/agent/.=
libs/libnetsnmpmibs.so.5 (0x40048000)<br>
libnetsnmphelpers.so.5 =3D&gt; /vobs/vob3/net-snmp/tfs/x86/agen=
t/helpers/.libs/libnetsnmphelpers.so.5 (0x400d4000)<br>
libnetsnmp.so.5 =3D&gt; /vobs/vob3/net-snmp/tfs/x86/snmplib/.li=
bs/libnetsnmp.so.5 (0x400ec000)<br>
libdl.so.2 =3D&gt; /lib/libdl.so.2 (0x40189000)<br>
libcrypto.so.4 =3D&gt; /lib/libcrypto.so.4 (0x4018d000)<br>
libm.so.6 =3D&gt; /lib/tls/libm.so.6 (0x4027f000)<br>
libc.so.6 =3D&gt; /lib/tls/libc.so.6 (0x42000000)<br>
/lib/ld-linux.so.2 =3D&gt; /lib/ld-linux.so.2 (0x40000000)<br>
libgssapi_krb5.so.2 =3D&gt; /usr/kerberos/lib/libgssapi_krb5.so=
..2 (0x402a1000<br>
)<br>
libkrb5.so.3 =3D&gt; /usr/kerberos/lib/libkrb5.so.3 (0x402b4000=
)<br>
libcom_err.so.3 =3D&gt; /usr/kerberos/lib/libcom_err.so.3 (0x40=
312000)<br>
libk5crypto.so.3 =3D&gt; /usr/kerberos/lib/libk5crypto.so.3 (0x=
40314000)<br>
libresolv.so.2 =3D&gt; /lib/libresolv.so.2 (0x40325000)<br>
libz.so.1 =3D&gt; /usr/lib/libz.so.1 (0x40337000)<br>
</ul>
All seems to be cool. But when I try to set a break point in init_agent=
(resolved in file
<ul>bld1-dsm&gt; gdb example-demon<br>
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)<br>
Copyright 2003 Free Software Foundation, Inc.<br>
GDB is free software, covered by the GNU General Public License, and yo=
u are<br>
welcome to change it and/or distribute copies of it under certain condi=
tions.<br>
Type &quot;show copying&quot; to see the conditions.<br>
There is absolutely no warranty for GDB. Type &quot;show warranty&quot=
; for details.<br>
This GDB was configured as &quot;i386-redhat-linux-gnu&quot;...<br>
(gdb) dir /vobs/vob3/net-snmp/src/agent/:/vobs/vob3/net-snmp/src/agent/=
helpers:/vobs/vob3/net-snmp/src/snmplib:/vobs/vob3/net-snmp/doc/tutoria=
l<br>
Source directories searched: /vobs/vob3/net-snmp/src/agent:/vobs/vob3/n=
et-snmp/src/agent/helpers:/vobs/vob3/net-snmp/src/snmplib:/vobs/vob3/ne=
t-snmp/doc/tutorial:$cdir:$cwd<br>
(gdb)<br>
(gdb) b main<br>
Breakpoint 1 at 0x8048860: file example-demon.c, line 25.<br>
(gdb) b init_agent<br>
Breakpoint 2 at 0x80486c8<br>
(gdb) run<br>
Starting program: /vobs/vob3/net-snmp/doc/tutorial/example-demon<br>
..cshrc<br>
Terminal type? [xterm]<br>
Erase is control-H (^H).<br>
Kill is control-X (^X).<br>
Breakpoint 2 at 0x4002d714<br>
<br>
Breakpoint 1, main (argc=3D1, argv=3D0xbffff064) at example-demon.c:25<=
br>
25 snmp_enable_stderrlog();<br>
(gdb) next<br>
30 netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_D=
S_AGENT_ROLE, 1);<br>
(gdb)<br>
17 int agentx_subagent=3D1; /* change this if you want to be a S=
NMP master agent */<br>
(gdb)<br>
30 netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_D=
S_AGENT_ROLE, 1);<br>
(gdb)<br>
38 init_agent(&quot;example-demon&quot;);<br>
(gdb)<br>
<br>
Breakpoint 2, 0x4002d714 in init_agent () from /usr/lib/libnetsnmpagent=
..so.5<br>
(gdb)</ul>
<br>
Now, for those of you still following this, 'init_agent' is resolved in=
libnetsnmpagent.so.
<ul>bld1-dsm&gt; nm -l /vobs/vob3/net-snmp/tfs/x86/agent/.libs/libnetsn=
mpagent.so | grep init_agent<br>
0000db58 T init_agent /vobs/vob3/net-snmp/src/agent/snmp_vars.c:270<b=
r>
</ul>
What am I missing? Is there an environment variable in gdb I need to se=
t to have it pick up the right shared module? I tried static linking bu=
t I got lost in a maze of link order problems. I would rather get the d=
ynamic debugging going but I am open to static linking if some one coul=
d help with the link order. That is a whole other post though....thanks=
for the help.<br>
<br>
Thanks,<br>
<br>
Alan L. Anderson<br>
RadiSys</body></html>=




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:55 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0