xtang-
I assume you meant do those sets in the shell and then run gdb, correct?
Thanks, but it didn’t give me the symbols for the libs … any other
ideas?
“Xiaodan Tang” <> xtang@qnx.com> > wrote in message
news:afie8d$33c$> 2@nntp.qnx.com> …
Kevin Caporaso <> kcaporaso@pillardata.com> > wrote:
When I type shared, I get just the (gdb) prompt back, I definitely do
not
get the “Reading symbols…” line back like you do.
I have the same gdb version as you.
I am running 6.2 NC.
I also don’t get the “in ?? from libraryFoo” like you do, mine
doesn’t
say
“libraryFoo”
set solib-search-path /usr/lib
set auto-solib-add 1
-xtang
did you compile with just -g ?
“Kris Warkentin” <> kewarken@qnx.com> > wrote in message
news:afi5nm$q5k$> 1@nntp.qnx.com> …
Well, I just did a test program like so:
#include <stdio.h
int main(int argc, char **argv)
{
char *foo = 0;
sprintf(foo, “Blargh”);
return 0;
}
ren:/export/home/kewarken/test >gdb poo
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) r
Starting program: /export/home/kewarken/test/poo
(gdb) c
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0xb033b1f1 in ?? () from /x86/lib/libc.so.2
(gdb) bt
#0 0xb033b1f1 in ?? () from /x86/lib/libc.so.2
#1 0xb03380fa in ?? () from /x86/lib/libc.so.2
#2 0xb03371f9 in ?? () from /x86/lib/libc.so.2
#3 0xb03347f2 in ?? () from /x86/lib/libc.so.2
#4 0x08048402 in main (argc=1, argv=0x80478f0) at poo.c:9
(gdb) shared
Reading symbols from /x86/lib/libc.so.2…done.
(gdb) bt
#0 0xb033b1f1 in memcpy () from /x86/lib/libc.so.2
#1 0xb03380fa in _Sprout () from /x86/lib/libc.so.2
#2 0xb03371f9 in _Printf () from /x86/lib/libc.so.2
#3 0xb03347f2 in sprintf () from /x86/lib/libc.so.2
#4 0x08048402 in main (argc=1, argv=0x80478f0) at poo.c:9
(gdb) The program is running. Exit anyway? (y or n) y
What do you see when you type ‘shared’?
Kris
“Kevin Caporaso” <> kcaporaso@pillardata.com> > wrote in message
news:afhvv8$lil$> 1@nntp.qnx.com> …
if you mean (gdb) shared
then that doesn’t change anything for me, I still get … in ?? ()
for
the
SEGV.
Perhaps I’m missing something else in order to take advantage of
the
‘shared’
feature?
TIA,
$Kevin
“Kris Warkentin” <> kewarken@qnx.com> > wrote in message
news:afhufk$km4$> 1@nntp.qnx.com> …
I like ddd. Also, it was just pointed out to me that if, when
debugging,
you type ‘shared’ (to get gdb to load shared library symbols),
you
get
the
names of the functions called. That’s awfully helpful and makes
me
feel
awfully silly for doing it the hard way. >
cheers,
Kris
“Kevin Caporaso” <> kcaporaso@pillardata.com> > wrote in message
news:afhua5$k9l$> 1@nntp.qnx.com> …
Thanks Kris,
How do you feel about ddd ? I just installed it and was about
to
try
it.
TIA
$Kevin
“Kris Warkentin” <> kewarken@qnx.com> > wrote in message
news:afhu63$k89$> 1@nntp.qnx.com> …
Unfortunately, we compile our libc with -fomit-frame-pointer
which
causes
the frame pointer to be omitted (obviously > > . There are
some
speed
and
size benefits to this but the consequence for the developer
is
that
gdb
can’t back-trace out of libc. So, you have several options.
One
is
that
you can roll your own libc from our public cvs. The other
(which
I
usually
do) is to step into your program. Go, “next, next, next”
through
main
until
it dumps core. Then next time, step into the function that
crashed
and
go
‘next, next, next’ through it until you crash again. This
will
very
quickly
drill you down to the exact line of your program that’s
SEGVing.
It’s
not
the prettiest and it makes debugging core-files a nuisance
but
it
works.
cheers,
Kris
“Kevin Caporaso” <> kcaporaso@pillardata.com> > wrote in message
news:afhtkr$j9q$> 1@nntp.qnx.com> …
Greetings,
I’m trying to debug a seg fault. but can’t even determine
where
I
am
in
the
binary.
I have -g flags turned on for every library I build and for
the
executable.
but I continue to see ?? for some memory locations in gdb.
Here
is
a
paste
of my most recent session. I am trying to figure out how
to
interpret
those
‘??’.
TIA,
$Kevin
============= GDB Session ==================
(gdb) run
Starting program: /opt/xe/src/testme
(gdb) break main
Breakpoint 1 at 0x804865e: file testme.cpp, line 11.
(gdb) continue
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0xb032bd7b in ?? ()
(gdb) bt
#0 0xb032bd7b in ?? ()
#1 0xb032becb in ?? ()
#2 0xb032ad2a in ?? ()
(gdb)
\