Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Nexted function context
@ 2007-01-30  8:51 Vincent De Groote
  2007-01-30 12:13 ` Daniel Jacobowitz
  0 siblings, 1 reply; 9+ messages in thread
From: Vincent De Groote @ 2007-01-30  8:51 UTC (permalink / raw)
  To: gdb

Hello,

I'm using gdb on c files compiled with gcc.  I use a lot of nested function 
calls.
When the program makes a core dump in a nested function, I can't see the 
local variables (No symbol in local context).

I have the same problem if I single step within a running program.

Are some options missing on compiler command line ?  (at this time, the 
only debugging flag is -g)

Thanks for your replies

Vincent De Groote


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Nexted function context
  2007-01-30  8:51 Nexted function context Vincent De Groote
@ 2007-01-30 12:13 ` Daniel Jacobowitz
  2007-01-30 12:28   ` Mark Kettenis
  2007-01-30 12:48   ` Vincent De Groote
  0 siblings, 2 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2007-01-30 12:13 UTC (permalink / raw)
  To: Vincent De Groote; +Cc: gdb

On Tue, Jan 30, 2007 at 08:53:13AM +0000, Vincent De Groote wrote:
> Hello,
> 
> I'm using gdb on c files compiled with gcc.  I use a lot of nested function 
> calls.
> When the program makes a core dump in a nested function, I can't see the 
> local variables (No symbol in local context).
> 
> I have the same problem if I single step within a running program.

Can you provide a small test case for this problem?

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Nexted function context
  2007-01-30 12:13 ` Daniel Jacobowitz
@ 2007-01-30 12:28   ` Mark Kettenis
  2007-01-30 12:48   ` Vincent De Groote
  1 sibling, 0 replies; 9+ messages in thread
From: Mark Kettenis @ 2007-01-30 12:28 UTC (permalink / raw)
  To: drow; +Cc: vincent.degroote, gdb

> Date: Tue, 30 Jan 2007 07:13:01 -0500
> From: Daniel Jacobowitz <drow@false.org>
> 
> On Tue, Jan 30, 2007 at 08:53:13AM +0000, Vincent De Groote wrote:
> > Hello,
> > 
> > I'm using gdb on c files compiled with gcc.  I use a lot of nested function 
> > calls.
> > When the program makes a core dump in a nested function, I can't see the 
> > local variables (No symbol in local context).
> > 
> > I have the same problem if I single step within a running program.
> 
> Can you provide a small test case for this problem?

I vaguely remember that GCC emitted incorrect debug information for
nested function calls, and that it would be hard to fix.

Mark


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Nexted function context
  2007-01-30 12:13 ` Daniel Jacobowitz
  2007-01-30 12:28   ` Mark Kettenis
@ 2007-01-30 12:48   ` Vincent De Groote
  2007-01-30 13:11     ` Daniel Jacobowitz
  1 sibling, 1 reply; 9+ messages in thread
From: Vincent De Groote @ 2007-01-30 12:48 UTC (permalink / raw)
  To: Daniel Jacobowitz, gdb

I just made a simple example:


#include <stdio.h>

int main ( int argc, char ** argv ) {

  int add_something ( int value ) {

    int result;

    if ( value < 10 )
      result = value + 10;
    else
      result = value - 10;

    return ( result );
  }

  int i;

  for ( i = 0; i < 100; i++ )
    printf ("%d\n", add_something ( i ));

  return (0);
}


when single stepping into add_something function,
doing "p value" or "p result" reports the same message "No symbol "xxxxx" 
in current context".

I also looked for a way of setting a breakpoint into a nested function, but 
never succeeds.

Thanks

Vincent De Groote



--On 30 January 2007 07:13 -0500 Daniel Jacobowitz <drow@false.org> wrote:

> On Tue, Jan 30, 2007 at 08:53:13AM +0000, Vincent De Groote wrote:
>> Hello,
>>
>> I'm using gdb on c files compiled with gcc.  I use a lot of nested
>> function  calls.
>> When the program makes a core dump in a nested function, I can't see the
>> local variables (No symbol in local context).
>>
>> I have the same problem if I single step within a running program.
>
> Can you provide a small test case for this problem?
>
> --
> Daniel Jacobowitz
> CodeSourcery





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Nexted function context
  2007-01-30 12:48   ` Vincent De Groote
@ 2007-01-30 13:11     ` Daniel Jacobowitz
  2007-01-30 13:39       ` Vincent De Groote
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2007-01-30 13:11 UTC (permalink / raw)
  To: Vincent De Groote; +Cc: gdb

On Tue, Jan 30, 2007 at 12:49:54PM +0000, Vincent De Groote wrote:
> when single stepping into add_something function,
> doing "p value" or "p result" reports the same message "No symbol "xxxxx" 
> in current context".

What GCC version and platform are you using?  On x86_64-linux using GCC
4.1.2, I can print them both just fine.  Probably older versions had bad
debug info, as Mark suggests.

> I also looked for a way of setting a breakpoint into a nested function, but 
> never succeeds.

Yes, I don't see any way to do this :-(

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Nexted function context
  2007-01-30 13:11     ` Daniel Jacobowitz
@ 2007-01-30 13:39       ` Vincent De Groote
  2007-01-30 13:42         ` Daniel Jacobowitz
  0 siblings, 1 reply; 9+ messages in thread
From: Vincent De Groote @ 2007-01-30 13:39 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

I'm using version 4.1.1 on linux (gentoo)

Vincent De Groote

--On 30 January 2007 08:10 -0500 Daniel Jacobowitz <drow@false.org> wrote:

> On Tue, Jan 30, 2007 at 12:49:54PM +0000, Vincent De Groote wrote:
>> when single stepping into add_something function,
>> doing "p value" or "p result" reports the same message "No symbol
>> "xxxxx"  in current context".
>
> What GCC version and platform are you using?  On x86_64-linux using GCC
> 4.1.2, I can print them both just fine.  Probably older versions had bad
> debug info, as Mark suggests.
>
>> I also looked for a way of setting a breakpoint into a nested function,
>> but  never succeeds.
>
> Yes, I don't see any way to do this :-(
>
> --
> Daniel Jacobowitz
> CodeSourcery





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Nexted function context
  2007-01-30 13:39       ` Vincent De Groote
@ 2007-01-30 13:42         ` Daniel Jacobowitz
  2007-01-30 15:45           ` Vincent De Groote
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2007-01-30 13:42 UTC (permalink / raw)
  To: Vincent De Groote; +Cc: gdb

On Tue, Jan 30, 2007 at 01:40:53PM +0000, Vincent De Groote wrote:
> I'm using version 4.1.1 on linux (gentoo)

What architecture?  And, could you send me a compiled binary?

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Nexted function context
  2007-01-30 13:42         ` Daniel Jacobowitz
@ 2007-01-30 15:45           ` Vincent De Groote
  2007-01-30 16:17             ` Daniel Jacobowitz
  0 siblings, 1 reply; 9+ messages in thread
From: Vincent De Groote @ 2007-01-30 15:45 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

[-- Attachment #1: Type: text/plain, Size: 1327 bytes --]

this the result of gcc -V command:


 # gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /var/tmp/portage/gcc-4.1.1/work/gcc-4.1.1/configure
--prefix=/usr
--bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.1.1
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4
--host=i686-pc-linux-gnu
--build=i686-pc-linux-gnu
--disable-altivec
--enable-nls
--without-included-gettext
--with-system-zlib
--disable-checking
--disable-werror
--disable-libunwind-exceptions
--disable-multilib
--disable-libmudflap
--disable-libssp
--disable-libgcj
--enable-languages=c,c++,fortran
--enable-shared
--enable-threads=posix
--enable-__cxa_atexit
--enable-clocale=gnu
Thread model: posix
gcc version 4.1.1 (Gentoo 4.1.1)


I'm attaching the program to this reply

Vincent De Groote

--On 30 January 2007 08:42 -0500 Daniel Jacobowitz <drow@false.org> wrote:

> On Tue, Jan 30, 2007 at 01:40:53PM +0000, Vincent De Groote wrote:
>> I'm using version 4.1.1 on linux (gentoo)
>
> What architecture?  And, could you send me a compiled binary?
>
> --
> Daniel Jacobowitz
> CodeSourcery




[-- Attachment #2: test --]
[-- Type: application/octet-stream, Size: 7283 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Nexted function context
  2007-01-30 15:45           ` Vincent De Groote
@ 2007-01-30 16:17             ` Daniel Jacobowitz
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2007-01-30 16:17 UTC (permalink / raw)
  To: Vincent De Groote; +Cc: gdb

On Tue, Jan 30, 2007 at 03:47:23PM +0000, Vincent De Groote wrote:
> I'm attaching the program to this reply

I recomment you upgrade GDB.  Using GDB 6.6, I can print values fine in
this example.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-01-30 16:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-30  8:51 Nexted function context Vincent De Groote
2007-01-30 12:13 ` Daniel Jacobowitz
2007-01-30 12:28   ` Mark Kettenis
2007-01-30 12:48   ` Vincent De Groote
2007-01-30 13:11     ` Daniel Jacobowitz
2007-01-30 13:39       ` Vincent De Groote
2007-01-30 13:42         ` Daniel Jacobowitz
2007-01-30 15:45           ` Vincent De Groote
2007-01-30 16:17             ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox