Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfc] Fix separate debuginfo files on Cell (do not mask off high address bits)
@ 2010-03-04 20:01 Ulrich Weigand
  2010-03-04 20:32 ` Jan Kratochvil
  0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Weigand @ 2010-03-04 20:01 UTC (permalink / raw)
  To: gdb-patches, jan.kratochvil

Hello,

when using the Cell/B.E. combined debugger, separate debug objfiles for
SPE executables are currently completely broken.  This is because the
new relocation code now masks off high address bits, corrupting the
encoded SPU ID in GDB CORE_ADDR values.

Jan, I understand you said this masking-off should no longer be necessary
due to other changes that occurred in the meantime.  Could you verify that
PIE still works for you with the patch below?

Tested on Cell/B.E. (PPU and SPU), fixes the sepdebug.exp test cases.

Bye,
Ulrich


ChangeLog:

	* symfile.c (build_section_addr_info_from_objfile): Do not mask
	off high address bits.

Index: gdb/symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.274
diff -u -p -r1.274 symfile.c
--- gdb/symfile.c	25 Feb 2010 15:40:01 -0000	1.274
+++ gdb/symfile.c	4 Mar 2010 13:20:32 -0000
@@ -364,18 +364,13 @@ build_section_addr_info_from_objfile (co
   struct section_addr_info *sap;
   int i;
   struct bfd_section *sec;
-  int addr_bit = gdbarch_addr_bit (objfile->gdbarch);
-  CORE_ADDR mask = CORE_ADDR_MAX;
-
-  if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
-    mask = ((CORE_ADDR) 1 << addr_bit) - 1;
 
   sap = alloc_section_addr_info (objfile->num_sections);
   for (i = 0, sec = objfile->obfd->sections; sec != NULL; sec = sec->next)
     if (bfd_get_section_flags (objfile->obfd, sec) & (SEC_ALLOC | SEC_LOAD))
       {
 	sap->other[i].addr = (bfd_get_section_vma (objfile->obfd, sec)
-			      + objfile->section_offsets->offsets[i]) & mask;
+			      + objfile->section_offsets->offsets[i]);
 	sap->other[i].name = xstrdup (bfd_get_section_name (objfile->obfd,
 							    sec));
 	sap->other[i].sectindex = sec->index;
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

* Re: [rfc] Fix separate debuginfo files on Cell (do not mask off high  address bits)
  2010-03-04 20:01 [rfc] Fix separate debuginfo files on Cell (do not mask off high address bits) Ulrich Weigand
@ 2010-03-04 20:32 ` Jan Kratochvil
  2010-03-04 20:32   ` Jan Kratochvil
  2010-03-05 19:35   ` Ulrich Weigand
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Kratochvil @ 2010-03-04 20:32 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gdb-patches

On Thu, 04 Mar 2010 21:01:01 +0100, Ulrich Weigand wrote:
> when using the Cell/B.E. combined debugger, separate debug objfiles for
> SPE executables are currently completely broken.  This is because the
> new relocation code now masks off high address bits, corrupting the
> encoded SPU ID in GDB CORE_ADDR values.

Interesting addr_bit is lower than the valid address width.


> Jan, I understand you said this masking-off should no longer be necessary
> due to other changes that occurred in the meantime.  Could you verify that
> PIE still works for you with the patch below?

Yes, it works.  I have considered this masking is just no-op now (only
possibly with the unresolved negative mips32 addresses reported by Daniel J.).


No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.


Thanks,
Jan


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

* Re: [rfc] Fix separate debuginfo files on Cell (do not mask off high  address bits)
  2010-03-04 20:32 ` Jan Kratochvil
@ 2010-03-04 20:32   ` Jan Kratochvil
  2010-03-05 19:35   ` Ulrich Weigand
  1 sibling, 0 replies; 4+ messages in thread
From: Jan Kratochvil @ 2010-03-04 20:32 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gdb-patches

On Thu, 04 Mar 2010 21:31:53 +0100, Jan Kratochvil wrote:
> On Thu, 04 Mar 2010 21:01:01 +0100, Ulrich Weigand wrote:
> > Jan, I understand you said this masking-off should no longer be necessary
> > due to other changes that occurred in the meantime.  Could you verify that
> > PIE still works for you with the patch below?
> 
> Yes, it works.

Since (+H. J. Lu's fixup)
	[patch] Fix PIE for 64bit gdb -> 32bit inferior
	http://sourceware.org/ml/gdb-patches/2010-02/msg00289.html


Regards,
Jan


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

* Re: [rfc] Fix separate debuginfo files on Cell (do not mask off high  address bits)
  2010-03-04 20:32 ` Jan Kratochvil
  2010-03-04 20:32   ` Jan Kratochvil
@ 2010-03-05 19:35   ` Ulrich Weigand
  1 sibling, 0 replies; 4+ messages in thread
From: Ulrich Weigand @ 2010-03-05 19:35 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

Jan Kratochvil wrote:
> On Thu, 04 Mar 2010 21:01:01 +0100, Ulrich Weigand wrote:
> > when using the Cell/B.E. combined debugger, separate debug objfiles for
> > SPE executables are currently completely broken.  This is because the
> > new relocation code now masks off high address bits, corrupting the
> > encoded SPU ID in GDB CORE_ADDR values.
> 
> Interesting addr_bit is lower than the valid address width.

Yes, the reason for this is to strip off the SPU ID when converting
address back for output as strings ...

> Yes, it works.  I have considered this masking is just no-op now (only
> possibly with the unresolved negative mips32 addresses reported by Daniel J.).
> 
> 
> No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.

Great, thanks for verifying!

I've checked this in to head and 7.1 branch now.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

end of thread, other threads:[~2010-03-05 19:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-04 20:01 [rfc] Fix separate debuginfo files on Cell (do not mask off high address bits) Ulrich Weigand
2010-03-04 20:32 ` Jan Kratochvil
2010-03-04 20:32   ` Jan Kratochvil
2010-03-05 19:35   ` Ulrich Weigand

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