This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [rfa] Re: The problem with stabs and sign extension


Daniel Jacobowitz writes:
 > On Wed, Aug 08, 2001 at 05:03:26PM -0700, H . J . Lu wrote:
 > > On Wed, Aug 08, 2001 at 04:53:59PM -0700, H . J . Lu wrote:
 > > > With this patch, I can do
 > > > 
 > > > # gdb vmlinux
 > > > ...
 > > > (gdb) print printk
 > > > $1 = {int (char *)} 0x8011c5b0 <printk>
 > > > (gdb) list printk
 > > > 250     printk.c: No such file or directory.
 > > >         in printk.c
 > > > 
 > > > 
 > > 
 > > Here is an update.
 > 
 > This isn't quite the right solution, I think.  In particular,
 > 
 > > 	(SWAP_SYMBOL): Removed.
 > > 	(INTERNALIZE_SYMBOL): Check sign extended vma.
 > 
 > are correct, but:
 > 
 > > 	* dbxread.c (COERCE32): New.
 > > 	(read_ofile_symtab): Set text_offset with COERCE32 if
 > > 	necessary.
 > 
 > are not.  The psymtab has the wrong offsets in it if you do this.
 > 
 > There's actually a clear bug here, once you know where to look.  A
 > CORE_ADDR is assigned to a long int in partial-stab.h.  There's a
 > warning flag in GCC for this, isn't there?
 > 
 > Please try the patch attached.
 > 
 > -- 
 > Daniel Jacobowitz                           Carnegie Mellon University
 > MontaVista Software                         Debian GNU/Linux Developer
 > 

This looks ok to me, can you commit it? Should we commit it to the 5.1
branch as well? How many targets is it going to affect? Just mips, right?
Probably yes then. 

Elena
 


 > 2001-08-08  Daniel Jacobowitz  <drow@mvista.com>
 > 
 > 	* partial-stab.h: valu should be a CORE_ADDR.
 > 
 > 2001-08-08  H.J. Lu  (hjl@gnu.org)
 > 
 > 	* dbxread.c (SWAP_SYMBOL): Removed.
 > 	(INTERNALIZE_SYMBOL): Check sign extended vma.
 > 
 > Index: partial-stab.h
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/partial-stab.h,v
 > retrieving revision 1.11
 > diff -u -p -r1.11 partial-stab.h
 > --- partial-stab.h	2001/06/01 21:17:50	1.11
 > +++ partial-stab.h	2001/08/09 00:11:41
 > @@ -201,7 +201,7 @@ switch (CUR_SYMBOL_TYPE)
 >  
 >    case N_SO:
 >      {
 > -      unsigned long valu;
 > +      CORE_ADDR valu;
 >        static int prev_so_symnum = -10;
 >        static int first_so_symnum;
 >        char *p;
 > Index: dbxread.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/dbxread.c,v
 > retrieving revision 1.19
 > diff -u -p -r1.19 dbxread.c
 > --- dbxread.c	2001/07/07 17:19:50	1.19
 > +++ dbxread.c	2001/08/09 00:11:41
 > @@ -944,22 +944,15 @@
 >    symbuf_read += nbytes;
 >  }
 >  
 > -#define SWAP_SYMBOL(symp, abfd) \
 > -  { \
 > -    (symp)->n_strx = bfd_h_get_32(abfd,			\
 > -				(unsigned char *)&(symp)->n_strx);	\
 > -    (symp)->n_desc = bfd_h_get_16 (abfd,			\
 > -				(unsigned char *)&(symp)->n_desc);  	\
 > -    (symp)->n_value = bfd_h_get_32 (abfd,			\
 > -				(unsigned char *)&(symp)->n_value); 	\
 > -  }
 > -
 >  #define INTERNALIZE_SYMBOL(intern, extern, abfd)			\
 >    {									\
 >      (intern).n_type = bfd_h_get_8 (abfd, (extern)->e_type);		\
 >      (intern).n_strx = bfd_h_get_32 (abfd, (extern)->e_strx);		\
 >      (intern).n_desc = bfd_h_get_16 (abfd, (extern)->e_desc);  		\
 > -    (intern).n_value = bfd_h_get_32 (abfd, (extern)->e_value);		\
 > +    if (bfd_get_sign_extend_vma (abfd))					\
 > +      (intern).n_value = bfd_h_get_signed_32 (abfd, (extern)->e_value);	\
 > +    else								\
 > +      (intern).n_value = bfd_h_get_32 (abfd, (extern)->e_value);	\
 >    }
 >  
 >  /* Invariant: The symbol pointed to by symbuf_idx is the first one


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]