Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa] Re: The problem with stabs and sign extension
       [not found]     ` <20010808170326.A4132@lucon.org>
@ 2001-08-08 17:15       ` Daniel Jacobowitz
  2001-08-08 21:06         ` H . J . Lu
                           ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Daniel Jacobowitz @ 2001-08-08 17:15 UTC (permalink / raw)
  To: gdb; +Cc: gdb-patches

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

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


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

* Re: [rfa] Re: The problem with stabs and sign extension
  2001-08-08 17:15       ` [rfa] Re: The problem with stabs and sign extension Daniel Jacobowitz
@ 2001-08-08 21:06         ` H . J . Lu
  2001-08-09 12:36         ` Andrew Cagney
                           ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: H . J . Lu @ 2001-08-08 21:06 UTC (permalink / raw)
  To: gdb, gdb-patches

On Wed, Aug 08, 2001 at 05:16:16PM -0700, Daniel Jacobowitz wrote:
> > 	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.

(gdb) list printk
250     printk.c: No such file or directory.
        in printk.c

works. But

(gdb) print printk
During symbol reading, inner block (0x802ac9d4-0xffffffff) not inside outer block (0x802aca18-0xffffffff).
$1 = {int (char *)} 0x8011c5b0 <printk>

Something is still wrong.


H.J.


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

* Re: [rfa] Re: The problem with stabs and sign extension
  2001-08-08 17:15       ` [rfa] Re: The problem with stabs and sign extension Daniel Jacobowitz
  2001-08-08 21:06         ` H . J . Lu
@ 2001-08-09 12:36         ` Andrew Cagney
  2001-08-09 13:59           ` Daniel Jacobowitz
       [not found]         ` <20010810153149.A15186@lucon.org>
  2001-08-14 21:58         ` Elena Zannoni
  3 siblings, 1 reply; 10+ messages in thread
From: Andrew Cagney @ 2001-08-09 12:36 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

>  * dbxread.c (SWAP_SYMBOL): Removed.


I'll avoid the rest (not my area).  However, this bit caught my 
attention.  As far as I can tell it is obvious (the macro is not used?) 
and hence can be factored out of the patch being discussed.

Another macro bites the dust! :-)

	Andrew


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

* Re: [rfa] Re: The problem with stabs and sign extension
  2001-08-09 12:36         ` Andrew Cagney
@ 2001-08-09 13:59           ` Daniel Jacobowitz
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Jacobowitz @ 2001-08-09 13:59 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

On Thu, Aug 09, 2001 at 03:35:59PM -0400, Andrew Cagney wrote:
> >  * dbxread.c (SWAP_SYMBOL): Removed.
> 
> 
> I'll avoid the rest (not my area).  However, this bit caught my 
> attention.  As far as I can tell it is obvious (the macro is not used?) 
> and hence can be factored out of the patch being discussed.
> 
> Another macro bites the dust! :-)

Yep :)  The changelogs mention its introduction, but not its removal
from use.  Probably just slipped away gracefully...

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: [rfa] Re: The problem with stabs and sign extension
       [not found]         ` <20010810153149.A15186@lucon.org>
@ 2001-08-10 15:37           ` Daniel Jacobowitz
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Jacobowitz @ 2001-08-10 15:37 UTC (permalink / raw)
  To: H . J . Lu; +Cc: gdb-patches

On Fri, Aug 10, 2001 at 03:31:49PM -0700, H . J . Lu wrote:
> On Wed, Aug 08, 2001 at 05:16:16PM -0700, Daniel Jacobowitz wrote:
> > 
> > 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?
> > 
> 
> You miised one CORE_ADDR in partial-stab.h. This patch seems to fix
> my problem. Any comments?

This looks right to me, though I can't approve anything - Jim?  Elena?

> 
> Thanks.
> 
> 
> H.J.
> -----
> 2001-08-10  Daniel Jacobowitz  <drow@mvista.com>
> 	    H.J. Lu  (hjl@gnu.org)
> 
> 	* 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.
> 
> --- gdb/dbxread.c.vma	Fri Jul 13 12:12:34 2001
> +++ gdb/dbxread.c	Wed Aug  8 21:02:29 2001
> @@ -946,22 +946,15 @@ fill_symbuf (bfd *sym_bfd)
>    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
> --- gdb/partial-stab.h.vma	Fri Jul 13 12:12:54 2001
> +++ gdb/partial-stab.h	Fri Aug 10 15:25:10 2001
> @@ -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;
> @@ -399,7 +399,7 @@ switch (CUR_SYMBOL_TYPE)
>      /* See if this is an end of function stab.  */
>      if (pst && CUR_SYMBOL_TYPE == N_FUN && *namestring == '\000')
>        {
> -	unsigned long valu;
> +	CORE_ADDR valu;
>  
>  	/* It's value is the size (in bytes) of the function for
>  	   function relative stabs, or the address of the function's
> 

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: [rfa] Re: The problem with stabs and sign extension
  2001-08-08 17:15       ` [rfa] Re: The problem with stabs and sign extension Daniel Jacobowitz
                           ` (2 preceding siblings ...)
       [not found]         ` <20010810153149.A15186@lucon.org>
@ 2001-08-14 21:58         ` Elena Zannoni
  2001-08-14 22:04           ` H . J . Lu
  3 siblings, 1 reply; 10+ messages in thread
From: Elena Zannoni @ 2001-08-14 21:58 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb, gdb-patches

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


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

* Re: [rfa] Re: The problem with stabs and sign extension
  2001-08-14 21:58         ` Elena Zannoni
@ 2001-08-14 22:04           ` H . J . Lu
  2001-08-15 12:01             ` Elena Zannoni
  0 siblings, 1 reply; 10+ messages in thread
From: H . J . Lu @ 2001-08-14 22:04 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: Daniel Jacobowitz, gdb, gdb-patches

On Wed, Aug 15, 2001 at 01:06:44AM -0400, Elena Zannoni wrote:
> 
> This looks ok to me, can you commit it? Should we commit it to the 5.1

I checked it in.

> branch as well? How many targets is it going to affect? Just mips, right?
> Probably yes then. 
> 

Only mips has sign extended vma. I'd like to see it in gdb 5.1. I have
to apply it when I use gdb on mips.


H.J.


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

* Re: [rfa] Re: The problem with stabs and sign extension
  2001-08-14 22:04           ` H . J . Lu
@ 2001-08-15 12:01             ` Elena Zannoni
  2001-08-15 12:04               ` H . J . Lu
  0 siblings, 1 reply; 10+ messages in thread
From: Elena Zannoni @ 2001-08-15 12:01 UTC (permalink / raw)
  To: H . J . Lu; +Cc: Elena Zannoni, Daniel Jacobowitz, gdb, gdb-patches

H . J . Lu writes:
 > On Wed, Aug 15, 2001 at 01:06:44AM -0400, Elena Zannoni wrote:
 > > 
 > > This looks ok to me, can you commit it? Should we commit it to the 5.1
 > 
 > I checked it in.
 > 
 > > branch as well? How many targets is it going to affect? Just mips, right?
 > > Probably yes then. 
 > > 
 > 
 > Only mips has sign extended vma. I'd like to see it in gdb 5.1. I have
 > to apply it when I use gdb on mips.


It is probably OK. Do you or Daniel want to check it in?

Elena


 > 
 > 
 > H.J.


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

* Re: [rfa] Re: The problem with stabs and sign extension
  2001-08-15 12:01             ` Elena Zannoni
@ 2001-08-15 12:04               ` H . J . Lu
  2001-08-16 15:13                 ` Daniel Jacobowitz
  0 siblings, 1 reply; 10+ messages in thread
From: H . J . Lu @ 2001-08-15 12:04 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: Daniel Jacobowitz, gdb, gdb-patches

On Wed, Aug 15, 2001 at 03:09:24PM -0400, Elena Zannoni wrote:
> H . J . Lu writes:
>  > On Wed, Aug 15, 2001 at 01:06:44AM -0400, Elena Zannoni wrote:
>  > > 
>  > > This looks ok to me, can you commit it? Should we commit it to the 5.1
>  > 
>  > I checked it in.
>  > 
>  > > branch as well? How many targets is it going to affect? Just mips, right?
>  > > Probably yes then. 
>  > > 
>  > 
>  > Only mips has sign extended vma. I'd like to see it in gdb 5.1. I have
>  > to apply it when I use gdb on mips.
> 
> 
> It is probably OK. Do you or Daniel want to check it in?

I don't have the setup for gdb 5.1. Daniel, can you check it in?

Thanks.


H.J.


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

* Re: [rfa] Re: The problem with stabs and sign extension
  2001-08-15 12:04               ` H . J . Lu
@ 2001-08-16 15:13                 ` Daniel Jacobowitz
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Jacobowitz @ 2001-08-16 15:13 UTC (permalink / raw)
  To: H . J . Lu; +Cc: Elena Zannoni, gdb, gdb-patches

On Wed, Aug 15, 2001 at 12:04:45PM -0700, H . J . Lu wrote:
> On Wed, Aug 15, 2001 at 03:09:24PM -0400, Elena Zannoni wrote:
> > H . J . Lu writes:
> >  > On Wed, Aug 15, 2001 at 01:06:44AM -0400, Elena Zannoni wrote:
> >  > > 
> >  > > This looks ok to me, can you commit it? Should we commit it to the 5.1
> >  > 
> >  > I checked it in.
> >  > 
> >  > > branch as well? How many targets is it going to affect? Just mips, right?
> >  > > Probably yes then. 
> >  > > 
> >  > 
> >  > Only mips has sign extended vma. I'd like to see it in gdb 5.1. I have
> >  > to apply it when I use gdb on mips.
> > 
> > 
> > It is probably OK. Do you or Daniel want to check it in?
> 
> I don't have the setup for gdb 5.1. Daniel, can you check it in?

Doing that right now.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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

end of thread, other threads:[~2001-08-16 15:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20010808141207.A31287@nevyn.them.org>
     [not found] ` <20010808161421.A3360@lucon.org>
     [not found]   ` <20010808165359.A3964@lucon.org>
     [not found]     ` <20010808170326.A4132@lucon.org>
2001-08-08 17:15       ` [rfa] Re: The problem with stabs and sign extension Daniel Jacobowitz
2001-08-08 21:06         ` H . J . Lu
2001-08-09 12:36         ` Andrew Cagney
2001-08-09 13:59           ` Daniel Jacobowitz
     [not found]         ` <20010810153149.A15186@lucon.org>
2001-08-10 15:37           ` Daniel Jacobowitz
2001-08-14 21:58         ` Elena Zannoni
2001-08-14 22:04           ` H . J . Lu
2001-08-15 12:01             ` Elena Zannoni
2001-08-15 12:04               ` H . J . Lu
2001-08-16 15:13                 ` Daniel Jacobowitz

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