Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Does GDB 6.7.1 for PowerPC require the framepointer register for  backtracing?
@ 2008-02-11 11:03 Stefan Bylund
  2008-02-11 13:08 ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Bylund @ 2008-02-11 11:03 UTC (permalink / raw)
  To: gdb

Hi,

We recently upgraded from GDB 6.3 to GDB 6.7.1 and noticed that for 
PowerPC we can longer get a backtrace in certain cases. The problem is 
that when we initially attach to an existing process on a remote target, 
only the PC and SP registers are available. This worked fine with GDB 
6.3 when doing a backtrace. However, GDB 6.7.1 fails when doing a 
backtrace in this case, and it seems that it tries to use the 
framepointer register (R31) for doing the backtrace and since this 
register is not available (i.e. it has value 0 in GDB's perspective), 
the backtrace fails.

Does GDB 6.7.1 requires the framepoint register (R31) for doing a backtrace?

I have also noticed that if I don't install the dwarf2_frame_sniffer() 
and rs6000_adjust_frame_regnum() functions in rs6000_gdbarch_init() in 
rs6000-tdep.c, the backtrace works again even if the framepointer 
register is not available. However, I'm not sure exactly why... Is it 
safe to omit these two functions?

Regards,
Stefan


-- 
---------------------------------
Stefan Bylund
Senior Software Engineer
Enea
Skalholtsgatan 9,
Box 1033, SE-164 21 Kista, Sweden
Direct: +46 8 50 71 43 25
Mobile: +46 709 71 43 25
stefan.bylund@enea.com
www.enea.com
---------------------------------
Enea - Embedded for Leaders
---------------------------------


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

* Re: Does GDB 6.7.1 for PowerPC require the framepointer register  for  backtracing?
  2008-02-11 11:03 Does GDB 6.7.1 for PowerPC require the framepointer register for backtracing? Stefan Bylund
@ 2008-02-11 13:08 ` Daniel Jacobowitz
  2008-02-11 17:29   ` Stefan Bylund
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2008-02-11 13:08 UTC (permalink / raw)
  To: Stefan Bylund; +Cc: gdb

On Mon, Feb 11, 2008 at 12:03:25PM +0100, Stefan Bylund wrote:
> Hi,
>
> We recently upgraded from GDB 6.3 to GDB 6.7.1 and noticed that for  
> PowerPC we can longer get a backtrace in certain cases. The problem is  
> that when we initially attach to an existing process on a remote target,  
> only the PC and SP registers are available. This worked fine with GDB 6.3 
> when doing a backtrace. However, GDB 6.7.1 fails when doing a backtrace in 
> this case, and it seems that it tries to use the framepointer register 
> (R31) for doing the backtrace and since this register is not available 
> (i.e. it has value 0 in GDB's perspective), the backtrace fails.
>
> Does GDB 6.7.1 requires the framepoint register (R31) for doing a backtrace?

It depends on your program and the available symbols and unwind
information.  For instance, it will use DWARF unwind tables if
they are provided.

> I have also noticed that if I don't install the dwarf2_frame_sniffer()  
> and rs6000_adjust_frame_regnum() functions in rs6000_gdbarch_init() in  
> rs6000-tdep.c, the backtrace works again even if the framepointer  
> register is not available. However, I'm not sure exactly why... Is it  
> safe to omit these two functions?

It sounds to me like you have DWARF information that says to use the
frame pointer.  Do you know if that's true?

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Does GDB 6.7.1 for PowerPC require the framepointer register  for backtracing?
  2008-02-11 13:08 ` Daniel Jacobowitz
@ 2008-02-11 17:29   ` Stefan Bylund
  2008-02-11 17:33     ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Bylund @ 2008-02-11 17:29 UTC (permalink / raw)
  To: gdb

Hi Daniel,

Thanks for your information. We use GCC 3.4.4, and when debugging we use 
the compiler options -g -O0. I tried to add the compiler option 
-fomit-frame-pointer (which seems to be included by -O1 and higher but 
not by -O0) and then it works!!! So, my conclusion is that GDB 6.7.1 for 
PowerPC tries to take advantage of frame pointer information in the 
DWARF-2 debug information while GDB 6.3 does not. Is that correct? Is it 
always safe to use -fomit-frame-pointer on PowerPC, i.e. will it not 
make some type of C/C++ code undebuggable?

Regards,
Stefan


Daniel Jacobowitz wrote:

>On Mon, Feb 11, 2008 at 12:03:25PM +0100, Stefan Bylund wrote:
>  
>
>>Hi,
>>
>>We recently upgraded from GDB 6.3 to GDB 6.7.1 and noticed that for  
>>PowerPC we can longer get a backtrace in certain cases. The problem is  
>>that when we initially attach to an existing process on a remote target,  
>>only the PC and SP registers are available. This worked fine with GDB 6.3 
>>when doing a backtrace. However, GDB 6.7.1 fails when doing a backtrace in 
>>this case, and it seems that it tries to use the framepointer register 
>>(R31) for doing the backtrace and since this register is not available 
>>(i.e. it has value 0 in GDB's perspective), the backtrace fails.
>>
>>Does GDB 6.7.1 requires the framepoint register (R31) for doing a backtrace?
>>    
>>
>
>It depends on your program and the available symbols and unwind
>information.  For instance, it will use DWARF unwind tables if
>they are provided.
>
>  
>
>>I have also noticed that if I don't install the dwarf2_frame_sniffer()  
>>and rs6000_adjust_frame_regnum() functions in rs6000_gdbarch_init() in  
>>rs6000-tdep.c, the backtrace works again even if the framepointer  
>>register is not available. However, I'm not sure exactly why... Is it  
>>safe to omit these two functions?
>>    
>>
>
>It sounds to me like you have DWARF information that says to use the
>frame pointer.  Do you know if that's true?
>
>  
>


-- 
---------------------------------
Stefan Bylund
Senior Software Engineer
Enea
Skalholtsgatan 9,
Box 1033, SE-164 21 Kista, Sweden
Direct: +46 8 50 71 43 25
Mobile: +46 709 71 43 25
stefan.bylund@enea.com
www.enea.com
---------------------------------
Enea - Embedded for Leaders
---------------------------------


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

* Re: Does GDB 6.7.1 for PowerPC require the framepointer register  for backtracing?
  2008-02-11 17:29   ` Stefan Bylund
@ 2008-02-11 17:33     ` Daniel Jacobowitz
  2008-02-12 10:24       ` Stefan Bylund
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2008-02-11 17:33 UTC (permalink / raw)
  To: Stefan Bylund; +Cc: gdb

On Mon, Feb 11, 2008 at 06:28:31PM +0100, Stefan Bylund wrote:
> Hi Daniel,
>
> Thanks for your information. We use GCC 3.4.4, and when debugging we use  
> the compiler options -g -O0. I tried to add the compiler option  
> -fomit-frame-pointer (which seems to be included by -O1 and higher but  
> not by -O0) and then it works!!! So, my conclusion is that GDB 6.7.1 for  
> PowerPC tries to take advantage of frame pointer information in the  
> DWARF-2 debug information while GDB 6.3 does not. Is that correct? Is it  
> always safe to use -fomit-frame-pointer on PowerPC, i.e. will it not make 
> some type of C/C++ code undebuggable?

GDB 6.7 does use DWARF.  GDB 6.3 did not.

It sounds to me like you have a bug in the debug information generated
by your compiler.  I've seen some other bugs in the unwind tables
generated by GCC 3.4.x that were fixed in GCC 4.x.

-fomit-frame-pointer should not cause a problem for GDB as long as you
have valid DWARF information.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Does GDB 6.7.1 for PowerPC require the framepointer register  for backtracing?
  2008-02-11 17:33     ` Daniel Jacobowitz
@ 2008-02-12 10:24       ` Stefan Bylund
  2008-02-12 13:31         ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Bylund @ 2008-02-12 10:24 UTC (permalink / raw)
  To: gdb

Hi Daniel,

Thanks for all your valuable answers! We will use -fomit-frame-pointer 
as a workaround for now. Later on we will add support for handling the 
frame pointer register in our OS kernel. That seems to be the 
future-proof solution.

Regards,
Stefan


Daniel Jacobowitz wrote:

>On Mon, Feb 11, 2008 at 06:28:31PM +0100, Stefan Bylund wrote:
>  
>
>>Hi Daniel,
>>
>>Thanks for your information. We use GCC 3.4.4, and when debugging we use  
>>the compiler options -g -O0. I tried to add the compiler option  
>>-fomit-frame-pointer (which seems to be included by -O1 and higher but  
>>not by -O0) and then it works!!! So, my conclusion is that GDB 6.7.1 for  
>>PowerPC tries to take advantage of frame pointer information in the  
>>DWARF-2 debug information while GDB 6.3 does not. Is that correct? Is it  
>>always safe to use -fomit-frame-pointer on PowerPC, i.e. will it not make 
>>some type of C/C++ code undebuggable?
>>    
>>
>
>GDB 6.7 does use DWARF.  GDB 6.3 did not.
>
>It sounds to me like you have a bug in the debug information generated
>by your compiler.  I've seen some other bugs in the unwind tables
>generated by GCC 3.4.x that were fixed in GCC 4.x.
>
>-fomit-frame-pointer should not cause a problem for GDB as long as you
>have valid DWARF information.
>
>  
>


-- 
---------------------------------
Stefan Bylund
Senior Software Engineer
Enea
Skalholtsgatan 9,
Box 1033, SE-164 21 Kista, Sweden
Direct: +46 8 50 71 43 25
Mobile: +46 709 71 43 25
stefan.bylund@enea.com
www.enea.com
---------------------------------
Enea - Embedded for Leaders
---------------------------------


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

* Re: Does GDB 6.7.1 for PowerPC require the framepointer register  for backtracing?
  2008-02-12 10:24       ` Stefan Bylund
@ 2008-02-12 13:31         ` Daniel Jacobowitz
  2008-02-12 15:21           ` Stefan Bylund
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2008-02-12 13:31 UTC (permalink / raw)
  To: Stefan Bylund; +Cc: gdb

On Tue, Feb 12, 2008 at 11:23:47AM +0100, Stefan Bylund wrote:
> Hi Daniel,
>
> Thanks for all your valuable answers! We will use -fomit-frame-pointer as 
> a workaround for now. Later on we will add support for handling the frame 
> pointer register in our OS kernel. That seems to be the future-proof 
> solution.

Oh, I see what you mean now.  You really have only access to those two
registers.  Sorry for being dense.

I recommend you allow GDB to access the full register set.  Future
versions of GDB may use any register at all in the unwind information.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Does GDB 6.7.1 for PowerPC require the framepointer register  for backtracing?
  2008-02-12 13:31         ` Daniel Jacobowitz
@ 2008-02-12 15:21           ` Stefan Bylund
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Bylund @ 2008-02-12 15:21 UTC (permalink / raw)
  To: gdb

You're not being dense. You really helped me. Thanks again.

/Stefan


Daniel Jacobowitz wrote:

>On Tue, Feb 12, 2008 at 11:23:47AM +0100, Stefan Bylund wrote:
>  
>
>>Hi Daniel,
>>
>>Thanks for all your valuable answers! We will use -fomit-frame-pointer as 
>>a workaround for now. Later on we will add support for handling the frame 
>>pointer register in our OS kernel. That seems to be the future-proof 
>>solution.
>>    
>>
>
>Oh, I see what you mean now.  You really have only access to those two
>registers.  Sorry for being dense.
>
>I recommend you allow GDB to access the full register set.  Future
>versions of GDB may use any register at all in the unwind information.
>
>  
>


-- 
---------------------------------
Stefan Bylund
Senior Software Engineer
Enea
Skalholtsgatan 9,
Box 1033, SE-164 21 Kista, Sweden
Direct: +46 8 50 71 43 25
Mobile: +46 709 71 43 25
stefan.bylund@enea.com
www.enea.com
---------------------------------
Enea - Embedded for Leaders
---------------------------------


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

end of thread, other threads:[~2008-02-12 15:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-11 11:03 Does GDB 6.7.1 for PowerPC require the framepointer register for backtracing? Stefan Bylund
2008-02-11 13:08 ` Daniel Jacobowitz
2008-02-11 17:29   ` Stefan Bylund
2008-02-11 17:33     ` Daniel Jacobowitz
2008-02-12 10:24       ` Stefan Bylund
2008-02-12 13:31         ` Daniel Jacobowitz
2008-02-12 15:21           ` Stefan Bylund

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