Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA/PATCH]: H8/300 - Update the generated debug information
@ 2003-02-25  5:16 Shrinivas Atre
  2003-02-25 16:48 ` Andrew Cagney
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Shrinivas Atre @ 2003-02-25  5:16 UTC (permalink / raw)
  To: gcc-patches, gdb-patches

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

Hi,

The GDB for Hitachi H8 target does not show values of integers when compiled 
with -mint32 option. e.g. If you use something like "int i=30000;" 
and compile program with -mint32 option, GDB shows value of "i" as zero.

This is because, for H8 targets, GDB always treats integers as 16 bits.

There is one more reason for this, which needs one change in GCC. 

While generating COFF debug information for "int" type, the compiler 
simply inserts type "T_INT" for this.
This doesn't say if the "int" is 32 bit or 16 bit.

Attached GCC patch , depending upon size of data will export 
"int" as "short int" if the size of integer is 16 bit and
as "int" if the size of integers is 32 bits.

And to decode this on GDB, a patch is attached.
This patch will make all integers as 32 bits for h8 targets. 
Assuming that the compiler have taken care of 16 bit integers as short 
integers.

Regards,
Shrinivas

=============================================================================

GCC Changelog - 

gcc/ChangeLog 
2003-02-24 Shrinivas Atre <shrinivasa@kpit.com> 

	* gcc/sdbout.c (plain_type_1): Update COFF debug output information.
					Output "short int" if integer size is 16 bit.

GCC Patch -

--- gcc/sdbout.c.orig	Wed Feb  5 10:43:48 2003
+++ gcc/sdbout.c	Wed Feb  5 10:49:26 2003
@@ -529,9 +529,19 @@ plain_type_1 (type, level)
 	    if (!strcmp (name, "signed char"))
 	      return T_CHAR;
 	    if (!strcmp (name, "int"))
-	      return T_INT;
+	      {
+		if (size == SHORT_TYPE_SIZE)
+		  return T_SHORT;
+		else
+	      	  return T_INT;
+	      }
 	    if (!strcmp (name, "unsigned int"))
-	      return T_UINT;
+	      {
+		if (size == SHORT_TYPE_SIZE)
+		  return T_USHORT;
+		else
+	      	  return T_UINT;
+	      }
 	    if (!strcmp (name, "short int"))
 	      return T_SHORT;
 	    if (!strcmp (name, "short unsigned int"))
				       
------------------------------------------------------------------------------


GDB Changelog - 

gdb/ChangeLog 
2003-02-24 Shrinivas Atre <shrinivasa@kpit.com> 

	* gdb/h8300-tdep.c (h8300_gdbarch_init): Make default integer size as 32 bits.
				       	   	

GDB Patch -

--- gdb/h8300-tdep.orig.c	Mon Feb 24 16:47:05 2003
+++ gdb/h8300-tdep.c	Mon Feb 24 16:47:45 2003
@@ -1170,7 +1170,7 @@ h8300_gdbarch_init (struct gdbarch_info 
   set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
   set_gdbarch_breakpoint_from_pc (gdbarch, h8300_breakpoint_from_pc);
 
-  set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
+  set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
   set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
   set_gdbarch_ptr_bit (gdbarch, BINWORD * TARGET_CHAR_BIT);
   set_gdbarch_addr_bit (gdbarch, BINWORD * TARGET_CHAR_BIT);


=============================================================================

-----------------------------------------------------------------------------
Free download of GNUSH and GNUH8 tool chains for Hitachi's SH and H8 Series.
The following site also offers free support to European customers.
Read more at http://www.gnush.com and http://www.gnuh8.com
Latest versions of GNUSH and GNUH8 are released on January 31, 2003.
----------------------------------------------------------------------------- 

[-- Attachment #2: gdb.changelog --]
[-- Type: application/octet-stream, Size: 167 bytes --]

gdb/ChangeLog 
2003-02-24 Shrinivas Atre <shrinivasa@kpit.com> 

	* gdb/h8300-tdep.c (h8300_gdbarch_init): Make default integer size as 32 bits.
				       	   	

[-- Attachment #3: gcc.changelog --]
[-- Type: application/octet-stream, Size: 197 bytes --]

gcc/ChangeLog 
2003-02-24 Shrinivas Atre <shrinivasa@kpit.com> 

	* gcc/sdbout.c (plain_type_1): Update COFF debug output information.
				       Output "short int" if integer size is 16 bit.

[-- Attachment #4: h8300-tdep.diff --]
[-- Type: application/octet-stream, Size: 587 bytes --]

--- gdb/h8300-tdep.orig.c	Mon Feb 24 16:47:05 2003
+++ gdb/h8300-tdep.c	Mon Feb 24 16:47:45 2003
@@ -1170,7 +1170,7 @@ h8300_gdbarch_init (struct gdbarch_info 
   set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
   set_gdbarch_breakpoint_from_pc (gdbarch, h8300_breakpoint_from_pc);
 
-  set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
+  set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
   set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
   set_gdbarch_ptr_bit (gdbarch, BINWORD * TARGET_CHAR_BIT);
   set_gdbarch_addr_bit (gdbarch, BINWORD * TARGET_CHAR_BIT);

[-- Attachment #5: sdbout.diff --]
[-- Type: application/octet-stream, Size: 670 bytes --]

--- gcc/sdbout.c.orig	Wed Feb  5 10:43:48 2003
+++ gcc/sdbout.c	Wed Feb  5 10:49:26 2003
@@ -529,9 +529,19 @@ plain_type_1 (type, level)
 	    if (!strcmp (name, "signed char"))
 	      return T_CHAR;
 	    if (!strcmp (name, "int"))
-	      return T_INT;
+	      {
+		if (size == SHORT_TYPE_SIZE)
+		  return T_SHORT;
+		else
+	      	  return T_INT;
+	      }
 	    if (!strcmp (name, "unsigned int"))
-	      return T_UINT;
+	      {
+		if (size == SHORT_TYPE_SIZE)
+		  return T_USHORT;
+		else
+	      	  return T_UINT;
+	      }
 	    if (!strcmp (name, "short int"))
 	      return T_SHORT;
 	    if (!strcmp (name, "short unsigned int"))

^ permalink raw reply	[flat|nested] 6+ messages in thread
* RE: [RFA/PATCH]: H8/300 - Update the generated debug information
@ 2003-02-26  5:52 Shrinivas Atre
  0 siblings, 0 replies; 6+ messages in thread
From: Shrinivas Atre @ 2003-02-26  5:52 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gcc-patches, gdb-patches

Hi Andrew,

Thank you for quick review and response.

>  
> > -  set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
> > +  set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
> >    set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
> 
> Just FYI, while the above is apparently trivial, the required 
> change isn't.
> 
> GCC should be providing information (either via special 
> headers or via 
> other debug info or magic sections) that informs GDB of the selected 
> size of an int.  GDB can then adjust its configuration 
> accordingly.  See 
> other GDB architectures (MIPS, PPC, SH, ...) that do this.
> 

I will look into this and try to use mechanism used by other architectures.

Regards,
Shrinivas


^ permalink raw reply	[flat|nested] 6+ messages in thread
* RE: [RFA/PATCH]: H8/300 - Update the generated debug information
@ 2003-02-26  5:55 Shrinivas Atre
  0 siblings, 0 replies; 6+ messages in thread
From: Shrinivas Atre @ 2003-02-26  5:55 UTC (permalink / raw)
  To: Jim Wilson, gcc-patches, gdb-patches

Hi Jim,

Thank you for review and suggestions.

> The SDB/coff debug format is old, limited, and unextensible.  It is 
> almost always wrong to use it.  Since you are using gdb, a better 
> solution is to use stabs which doesn't have this problem.
> 

Yes. This is problem of the COFF format. This is not observed in stabs or ELF.

> Or, alternatively, if you must fix the SDB/coff debug info, I suggest 
> doing the same thing Andrew Cagney suggested.  Make gcc emit a special
> directive (.int32) and/or pass an option to gas.  Have gas set an ELF 
> section header flag when it sees the directive or the option.  Then 
> modify gdb to set the int size appropriately depending on the ELF 
> section header flags.
> 

I will try to implement this.

> > 	* gcc/sdbout.c (plain_type_1): Update COFF debug output 
> information.
> > 					Output "short int" if 
> integer size is 16 bit.
> 
> This isn't OK.  It is wrong to emit a type of "short int" for 
> an "int" even if they are the same size, because they aren't the same 
> type.  This will break the gdb testsuite.

Thanks. I missed it out.

Regards,
Shrinivas


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

end of thread, other threads:[~2003-02-26  5:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-25  5:16 [RFA/PATCH]: H8/300 - Update the generated debug information Shrinivas Atre
2003-02-25 16:48 ` Andrew Cagney
2003-02-25 16:55 ` Andrew Cagney
2003-02-26  4:22 ` Jim Wilson
2003-02-26  5:52 Shrinivas Atre
2003-02-26  5:55 Shrinivas Atre

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