[Q] Using gdb in QNX 6.2

Can someone help me figure out how to use gdb under QNX 6.2? I seem to
be leaving out a step or two(?) Given a short program such as:

/* file: foo.c /
int main( int argc, char
argv[] )
{
int i;
for( i = 0; i < 100; ++i )
printf( “i = %d\n”, i );

return 0;
}

I compile with:

make foo CFLAGS=-g

and then run gdb. I keep getting the message ‘Cannot find bounds of
current function’ (full session output appended below).

I’m used to using gcc/gdb on IRIX and Linux, so I just did what was
sorta natural to me. Do I need to do something different for QNX?

TIA,

Dave


zaphod# gdb foo
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) b main
Breakpoint 1 at 0x80483ea: file foo.c, line 4.
(gdb) run
Starting program: /root/projects/foo
(gdb) n
Cannot find bounds of current function
(gdb)

David Wolfe <da5id@luvspamwolfe.name> wrote:

Can someone help me figure out how to use gdb under QNX 6.2? I seem to
be leaving out a step or two(?) Given a short program such as:

/* file: foo.c /
int main( int argc, char
argv[] )
{
int i;
for( i = 0; i < 100; ++i )
printf( “i = %d\n”, i );

return 0;
}

I compile with:

make foo CFLAGS=-g

cc -o foo -g -O0 foo.c

or

make foo CFLAGS=-g LDFLAGS=-g

-xtang


and then run gdb. I keep getting the message ‘Cannot find bounds of
current function’ (full session output appended below).

I’m used to using gcc/gdb on IRIX and Linux, so I just did what was
sorta natural to me. Do I need to do something different for QNX?

TIA,

Dave



zaphod# gdb foo
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) b main
Breakpoint 1 at 0x80483ea: file foo.c, line 4.
(gdb) run
Starting program: /root/projects/foo
(gdb) n
Cannot find bounds of current function
(gdb)

The big difference in QNX is that when you issue a ‘run’ the program
is launched, but it doesn’t continue. So it is at the very beginning
of the dynamic linker.

Issue a continue and your program will come to life.

David Wolfe <da5id@luvspamwolfe.name> wrote:

Can someone help me figure out how to use gdb under QNX 6.2? I seem to
be leaving out a step or two(?) Given a short program such as:

/* file: foo.c /
int main( int argc, char
argv[] )
{
int i;
for( i = 0; i < 100; ++i )
printf( “i = %d\n”, i );

return 0;
}

I compile with:

make foo CFLAGS=-g

and then run gdb. I keep getting the message ‘Cannot find bounds of
current function’ (full session output appended below).

I’m used to using gcc/gdb on IRIX and Linux, so I just did what was
sorta natural to me. Do I need to do something different for QNX?

TIA,

Dave



zaphod# gdb foo
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) b main
Breakpoint 1 at 0x80483ea: file foo.c, line 4.
(gdb) run
Starting program: /root/projects/foo
(gdb) n
Cannot find bounds of current function
(gdb)







cburgess@qnx.com

I compile with:

make foo CFLAGS=-g

and then run gdb. I keep getting the message ‘Cannot find bounds of
current function’ …

The big difference in QNX is that when you issue a ‘run’ the program
is launched, but it doesn’t continue. So it is at the very beginning
of the dynamic linker.

Issue a continue and your program will come to life.

Worked like a charm! Issuing a ‘continue’ at the very beginning is easy
enough. And I suppose it will come in handy for debugging problems
with shared libs, static constructors and such.

Thanks!

  • Dave