Gdb

Hi,
I have a network component (Actually a filter) which is crashing in
the Initialization routine.Because of this i am not able to step through the
initilization routine in GDB.Is there a way i can put the breakpoint before
a module gets loaded ? I tried using sym “myfile.so” and added break point
but since the module is not loaded it gives out warnigs as following
warning:Cannot insert breakpoint 1:
warning: Temporarily disabling shared library_breakpoints:
warning:breakpoint #1
And The breakpoint not hit when the module is loaded.Any help is
appreciated.

Thanks in advance.

Sreekanth

Here’s what I would do:

Load io-net in gdb
specify the solib-search-path to point to the dir where your dll symbols
are, eg

(gdb) set solib-search-path /home/cburgess/src/module:/x86/lib

Then set a break on main, then issue a shared lib command, which will load
the symbols for libc.

Next, set a breakpoint on dlopen(), then continue

When you hit dlopen, issue a finish, then check to see if your shared
lib has been loaded. ISsue a sharedlibrary command and your symbols will be
loaded. Then you can set the breakpoint on your routine.

Sreekanth <sreekanth@cambira.com> wrote:

Hi,
I have a network component (Actually a filter) which is crashing in
the Initialization routine.Because of this i am not able to step through the
initilization routine in GDB.Is there a way i can put the breakpoint before
a module gets loaded ? I tried using sym “myfile.so” and added break point
but since the module is not loaded it gives out warnigs as following
warning:Cannot insert breakpoint 1:
warning: Temporarily disabling shared library_breakpoints:
warning:breakpoint #1
And The breakpoint not hit when the module is loaded.Any help is
appreciated.

Thanks in advance.

Sreekanth


cburgess@qnx.com

Colin,
Thanks for the answer but my problem is that i am not the one who is
doing dlopen and dlsym.It is the io-net module which is doing it and i don’t
have the sources for io-net and thus cannot put a break point on dlopen.

Sreekanth

“Colin Burgess” <cburgess@qnx.com> wrote in message
news:ajgvha$6c$1@nntp.qnx.com

Here’s what I would do:

Load io-net in gdb
specify the solib-search-path to point to the dir where your dll symbols
are, eg

(gdb) set solib-search-path /home/cburgess/src/module:/x86/lib

Then set a break on main, then issue a shared lib command, which will load
the symbols for libc.

Next, set a breakpoint on dlopen(), then continue

When you hit dlopen, issue a finish, then check to see if your shared
lib has been loaded. ISsue a sharedlibrary command and your symbols will
be
loaded. Then you can set the breakpoint on your routine.

Sreekanth <> sreekanth@cambira.com> > wrote:
Hi,
I have a network component (Actually a filter) which is crashing
in
the Initialization routine.Because of this i am not able to step through
the
initilization routine in GDB.Is there a way i can put the breakpoint
before
a module gets loaded ? I tried using sym “myfile.so” and added break
point
but since the module is not loaded it gives out warnigs as following
warning:Cannot insert breakpoint 1:
warning: Temporarily disabling shared library_breakpoints:
warning:breakpoint #1
And The breakpoint not hit when the module is loaded.Any help is
appreciated.

Thanks in advance.

Sreekanth



\

cburgess@qnx.com

Sreekanth <sreekanth@cambira.com> wrote:

Colin,
Thanks for the answer but my problem is that i am not the one who is
doing dlopen and dlsym.It is the io-net module which is doing it and i don’t
have the sources for io-net and thus cannot put a break point on dlopen.

You don’t have to have the sources. Gdb will still find the address of the
function as long as you have the binary loaded.

Sreekanth

“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:ajgvha$6c$> 1@nntp.qnx.com> …
Here’s what I would do:

Load io-net in gdb
specify the solib-search-path to point to the dir where your dll symbols
are, eg

(gdb) set solib-search-path /home/cburgess/src/module:/x86/lib

Then set a break on main, then issue a shared lib command, which will load
the symbols for libc.

Next, set a breakpoint on dlopen(), then continue

When you hit dlopen, issue a finish, then check to see if your shared
lib has been loaded. ISsue a sharedlibrary command and your symbols will
be
loaded. Then you can set the breakpoint on your routine.

Sreekanth <> sreekanth@cambira.com> > wrote:
Hi,
I have a network component (Actually a filter) which is crashing
in
the Initialization routine.Because of this i am not able to step through
the
initilization routine in GDB.Is there a way i can put the breakpoint
before
a module gets loaded ? I tried using sym “myfile.so” and added break
point
but since the module is not loaded it gives out warnigs as following
warning:Cannot insert breakpoint 1:
warning: Temporarily disabling shared library_breakpoints:
warning:breakpoint #1
And The breakpoint not hit when the module is loaded.Any help is
appreciated.

Thanks in advance.

Sreekanth



\

cburgess@qnx.com


cburgess@qnx.com

Probably i didn’t write it clearly.I would assume i need to have the symbols
for io-net in order to be able to put a break point in the point where it
does dlopen of my module.How can i do that without even knowing the function
which is calling the dlsym? I hope it is clear now…

thanks
Sreekanth

“Colin Burgess” <cburgess@qnx.com> wrote in message
news:ajh1al$336$1@nntp.qnx.com

Sreekanth <> sreekanth@cambira.com> > wrote:
Colin,
Thanks for the answer but my problem is that i am not the one
who is
doing dlopen and dlsym.It is the io-net module which is doing it and i
don’t
have the sources for io-net and thus cannot put a break point on dlopen.

You don’t have to have the sources. Gdb will still find the address of
the
function as long as you have the binary loaded.

Sreekanth

“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:ajgvha$6c$> 1@nntp.qnx.com> …
Here’s what I would do:

Load io-net in gdb
specify the solib-search-path to point to the dir where your dll
symbols
are, eg

(gdb) set solib-search-path /home/cburgess/src/module:/x86/lib

Then set a break on main, then issue a shared lib command, which will
load
the symbols for libc.

Next, set a breakpoint on dlopen(), then continue

When you hit dlopen, issue a finish, then check to see if your shared
lib has been loaded. ISsue a sharedlibrary command and your symbols
will
be
loaded. Then you can set the breakpoint on your routine.

Sreekanth <> sreekanth@cambira.com> > wrote:
Hi,
I have a network component (Actually a filter) which is
crashing
in
the Initialization routine.Because of this i am not able to step
through
the
initilization routine in GDB.Is there a way i can put the breakpoint
before
a module gets loaded ? I tried using sym “myfile.so” and added break
point
but since the module is not loaded it gives out warnigs as following
warning:Cannot insert breakpoint 1:
warning: Temporarily disabling shared library_breakpoints:
warning:breakpoint #1
And The breakpoint not hit when the module is loaded.Any help is
appreciated.

Thanks in advance.

Sreekanth



\

cburgess@qnx.com



\

cburgess@qnx.com

But you have the symbols - just no debug information. The symbols for libc
are there - they are needed for dynamic linking. So gdb can read them and
know the address of dlopen/dlsym to put a breakpoint on (once the symbols for
libc have been loaded).

Sreekanth <sreekanth@cambira.com> wrote:

Probably i didn’t write it clearly.I would assume i need to have the symbols
for io-net in order to be able to put a break point in the point where it
does dlopen of my module.How can i do that without even knowing the function
which is calling the dlsym? I hope it is clear now…

thanks
Sreekanth

“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:ajh1al$336$> 1@nntp.qnx.com> …
Sreekanth <> sreekanth@cambira.com> > wrote:
Colin,
Thanks for the answer but my problem is that i am not the one
who is
doing dlopen and dlsym.It is the io-net module which is doing it and i
don’t
have the sources for io-net and thus cannot put a break point on dlopen.

You don’t have to have the sources. Gdb will still find the address of
the
function as long as you have the binary loaded.

Sreekanth

“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:ajgvha$6c$> 1@nntp.qnx.com> …
Here’s what I would do:

Load io-net in gdb
specify the solib-search-path to point to the dir where your dll
symbols
are, eg

(gdb) set solib-search-path /home/cburgess/src/module:/x86/lib

Then set a break on main, then issue a shared lib command, which will
load
the symbols for libc.

Next, set a breakpoint on dlopen(), then continue

When you hit dlopen, issue a finish, then check to see if your shared
lib has been loaded. ISsue a sharedlibrary command and your symbols
will
be
loaded. Then you can set the breakpoint on your routine.

Sreekanth <> sreekanth@cambira.com> > wrote:
Hi,
I have a network component (Actually a filter) which is
crashing
in
the Initialization routine.Because of this i am not able to step
through
the
initilization routine in GDB.Is there a way i can put the breakpoint
before
a module gets loaded ? I tried using sym “myfile.so” and added break
point
but since the module is not loaded it gives out warnigs as following
warning:Cannot insert breakpoint 1:
warning: Temporarily disabling shared library_breakpoints:
warning:breakpoint #1
And The breakpoint not hit when the module is loaded.Any help is
appreciated.

Thanks in advance.

Sreekanth



\

cburgess@qnx.com



\

cburgess@qnx.com


cburgess@qnx.com

No…I don’t have symbols.When i attach the io-net i can’t see any symbols
associated with the io-net process.Perhaps you could explain how to put the
breakpoint step by step in case there is a misunderstanding of
communication.

Sreekanth

“Colin Burgess” <cburgess@qnx.com> wrote in message
news:ajiukh$cc7$3@nntp.qnx.com

But you have the symbols - just no debug information. The symbols for
libc
are there - they are needed for dynamic linking. So gdb can read them and
know the address of dlopen/dlsym to put a breakpoint on (once the symbols
for
libc have been loaded).

Sreekanth <> sreekanth@cambira.com> > wrote:
Probably i didn’t write it clearly.I would assume i need to have the
symbols
for io-net in order to be able to put a break point in the point where
it
does dlopen of my module.How can i do that without even knowing the
function
which is calling the dlsym? I hope it is clear now…

thanks
Sreekanth

“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:ajh1al$336$> 1@nntp.qnx.com> …
Sreekanth <> sreekanth@cambira.com> > wrote:
Colin,
Thanks for the answer but my problem is that i am not the one
who is
doing dlopen and dlsym.It is the io-net module which is doing it and
i
don’t
have the sources for io-net and thus cannot put a break point on
dlopen.

You don’t have to have the sources. Gdb will still find the address of
the
function as long as you have the binary loaded.

Sreekanth

“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:ajgvha$6c$> 1@nntp.qnx.com> …
Here’s what I would do:

Load io-net in gdb
specify the solib-search-path to point to the dir where your dll
symbols
are, eg

(gdb) set solib-search-path /home/cburgess/src/module:/x86/lib

Then set a break on main, then issue a shared lib command, which
will
load
the symbols for libc.

Next, set a breakpoint on dlopen(), then continue

When you hit dlopen, issue a finish, then check to see if your
shared
lib has been loaded. ISsue a sharedlibrary command and your symbols
will
be
loaded. Then you can set the breakpoint on your routine.

Sreekanth <> sreekanth@cambira.com> > wrote:
Hi,
I have a network component (Actually a filter) which is
crashing
in
the Initialization routine.Because of this i am not able to step
through
the
initilization routine in GDB.Is there a way i can put the
breakpoint
before
a module gets loaded ? I tried using sym “myfile.so” and added
break
point
but since the module is not loaded it gives out warnigs as
following
warning:Cannot insert breakpoint 1:
warning: Temporarily disabling shared library_breakpoints:
warning:breakpoint #1
And The breakpoint not hit when the module is loaded.Any help is
appreciated.

Thanks in advance.

Sreekanth



\

cburgess@qnx.com



\

cburgess@qnx.com



\

cburgess@qnx.com

Sure - here’s a log of a session. As you can see, I can set a breakpoint
on epic_init

Script started on Mon Aug 19 10:45:49 2002

gdb

GNU gdb 5.0 (UI_OUT)
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type “show copying” to see the conditions.
There is absolutely no warranty for GDB. Type “show warranty” for details.
This GDB was configured as “–host=x86-pc-nto-qnx --target=ntox86”.
(gdb) file /sbin/io-net
Reading symbols from /sbin/io-net…(no debugging symbols found)…done.
(gdb) set solib-search-path /x86/lib:/x86/lib/dll
(gdb) run -depic
Starting program: /sbin/io-net -depic
(gdb) break main
Breakpoint 1 at 0x8050264
(gdb) c
Continuing.

Breakpoint 1, 0x08050264 in main ()
(gdb) shared
Reading symbols from /x86/lib/libc.so.2…(no debugging symbols found)…done.
(gdb) break dlsym
Breakpoint 2 at 0xb032ba65
(gdb) c
Continuing.

Breakpoint 2, 0xb032ba65 in dlsym () from /x86/lib/libc.so.2
(gdb) shared
Symbols already loaded for /x86/lib/libc.so.2
Reading symbols from /x86/lib/dll/devn-epic.so…
(no debugging symbols found)…done.
(gdb) break epic_init
Breakpoint 3 at 0xb8202c19
(gdb) c
Continuing.

Breakpoint 3, 0xb8202c19 in epic_init () from /x86/lib/dll/devn-epic.so
(gdb) c
Continuing.

Program received signal SIGINT, Interrupt.
0xb0328ddd in TimerTimeout_r () from /x86/lib/libc.so.2
(gdb) info shared
From To Syms Read Shared Object Library
0xb0300000 0xb034e8fc Yes /x86/lib/libc.so.2
0xb8200000 0xb820c4d8 Yes /x86/lib/dll/devn-epic.so
(gdb) info thread
4 process 3280929 0xb0327805 in MsgReceive () from /x86/lib/libc.so.2
3 process 3280929 0xb0327805 in MsgReceive () from /x86/lib/libc.so.2
2 process 3280929 0xb0327805 in MsgReceive () from /x86/lib/libc.so.2

  • 1 process 3280929 0xb0328ddd in TimerTimeout_r () from /x86/lib/libc.so.2
    (gdb) quit
    The program is running. Exit anyway? (y or n) y
    Script done on Mon Aug 19 10:46:37 2002

Sreekanth <sreekanth@cambira.com> wrote:

No…I don’t have symbols.When i attach the io-net i can’t see any symbols
associated with the io-net process.Perhaps you could explain how to put the
breakpoint step by step in case there is a misunderstanding of
communication.

Sreekanth

“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:ajiukh$cc7$> 3@nntp.qnx.com> …
But you have the symbols - just no debug information. The symbols for
libc
are there - they are needed for dynamic linking. So gdb can read them and
know the address of dlopen/dlsym to put a breakpoint on (once the symbols
for
libc have been loaded).

Sreekanth <> sreekanth@cambira.com> > wrote:
Probably i didn’t write it clearly.I would assume i need to have the
symbols
for io-net in order to be able to put a break point in the point where
it
does dlopen of my module.How can i do that without even knowing the
function
which is calling the dlsym? I hope it is clear now…

thanks
Sreekanth

“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:ajh1al$336$> 1@nntp.qnx.com> …
Sreekanth <> sreekanth@cambira.com> > wrote:
Colin,
Thanks for the answer but my problem is that i am not the one
who is
doing dlopen and dlsym.It is the io-net module which is doing it and
i
don’t
have the sources for io-net and thus cannot put a break point on
dlopen.

You don’t have to have the sources. Gdb will still find the address of
the
function as long as you have the binary loaded.

Sreekanth

“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:ajgvha$6c$> 1@nntp.qnx.com> …
Here’s what I would do:

Load io-net in gdb
specify the solib-search-path to point to the dir where your dll
symbols
are, eg

(gdb) set solib-search-path /home/cburgess/src/module:/x86/lib

Then set a break on main, then issue a shared lib command, which
will
load
the symbols for libc.

Next, set a breakpoint on dlopen(), then continue

When you hit dlopen, issue a finish, then check to see if your
shared
lib has been loaded. ISsue a sharedlibrary command and your symbols
will
be
loaded. Then you can set the breakpoint on your routine.

Sreekanth <> sreekanth@cambira.com> > wrote:
Hi,
I have a network component (Actually a filter) which is
crashing
in
the Initialization routine.Because of this i am not able to step
through
the
initilization routine in GDB.Is there a way i can put the
breakpoint
before
a module gets loaded ? I tried using sym “myfile.so” and added
break
point
but since the module is not loaded it gives out warnigs as
following
warning:Cannot insert breakpoint 1:
warning: Temporarily disabling shared library_breakpoints:
warning:breakpoint #1
And The breakpoint not hit when the module is loaded.Any help is
appreciated.

Thanks in advance.

Sreekanth



\

cburgess@qnx.com



\

cburgess@qnx.com



\

cburgess@qnx.com


cburgess@qnx.com