* RFA: char is unsigned on some architectures
@ 2001-12-19 14:43 Jim Blandy
2001-12-19 14:48 ` Andrew Cagney
2001-12-19 23:04 ` Eli Zaretskii
0 siblings, 2 replies; 10+ messages in thread
From: Jim Blandy @ 2001-12-19 14:43 UTC (permalink / raw)
To: gdb-patches
ISO C specifies that `char' acts like either `signed char' or
`unsigned char'. At the moment, GDB assumes that `char' is `signed
char'. This patch allows the architecture to specify the correct
answer, and sets the value correctly for the IBM S/390 architecture.
2001-12-19 Jim Blandy <jimb@redhat.com>
* gdbarch.sh (TARGET_CHAR_SIGNED): New macro.
* gdbarch.c, gdbarch.h: Regenerated.
* gdbtypes.c (build_gdbtypes): If TARGET_CHAR_SIGNED is zero,
set the TYPE_FLAG_UNSIGNED bit on the type.
* s390-tdep.c (s390_gdbarch_init): On the S/390, characters
are unsigned by default.
Index: gdb/gdbarch.sh
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/gdbarch.sh,v
retrieving revision 2.91
diff -c -r2.91 gdbarch.sh
*** gdb/gdbarch.sh 2001/12/11 00:04:41 2.91
--- gdb/gdbarch.sh 2001/12/19 22:35:08
***************
*** 384,389 ****
--- 384,392 ----
# Number of bits in a BFD_VMA for the target object file format.
v::TARGET_BFD_VMA_BIT:int:bfd_vma_bit::::8 * sizeof (void*):TARGET_ARCHITECTURE->bits_per_address::0
#
+ # One if \`char' acts like \`signed char', zero if \`unsigned char'.
+ v::TARGET_CHAR_SIGNED:int:char_signed::::1:-1:1::%d::
+ #
v::IEEE_FLOAT:int:ieee_float::::0:0::0:::
#
f::TARGET_READ_PC:CORE_ADDR:read_pc:ptid_t ptid:ptid::0:generic_target_read_pc::0
Index: gdb/gdbtypes.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/gdbtypes.c,v
retrieving revision 2.126
diff -c -r2.126 gdbtypes.c
*** gdb/gdbtypes.c 2001/12/11 00:04:41 2.126
--- gdb/gdbtypes.c 2001/12/19 22:35:09
***************
*** 2977,2983 ****
"void", (struct objfile *) NULL);
builtin_type_char =
init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
! TYPE_FLAG_NOSIGN,
"char", (struct objfile *) NULL);
builtin_type_true_char =
init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
--- 2977,2984 ----
"void", (struct objfile *) NULL);
builtin_type_char =
init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
! (TYPE_FLAG_NOSIGN
! | (TARGET_CHAR_SIGNED ? 0 : TYPE_FLAG_UNSIGNED)),
"char", (struct objfile *) NULL);
builtin_type_true_char =
init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
Index: gdb/s390-tdep.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/s390-tdep.c,v
retrieving revision 2.31
diff -c -r2.31 s390-tdep.c
*** gdb/s390-tdep.c 2001/12/19 22:33:10 2.31
--- gdb/s390-tdep.c 2001/12/19 22:35:10
***************
*** 1760,1765 ****
--- 1760,1766 ----
gdbarch = gdbarch_alloc (&info, NULL);
set_gdbarch_believe_pcc_promotion (gdbarch, 0);
+ set_gdbarch_char_signed (gdbarch, 0);
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_frame_args_address (gdbarch, s390_frame_args_address);
Index: gdb/gdbarch.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/gdbarch.c,v
retrieving revision 2.112
diff -c -r2.112 gdbarch.c
*** gdb/gdbarch.c 2001/12/11 00:04:41 2.112
--- gdb/gdbarch.c 2001/12/19 22:35:05
***************
*** 144,149 ****
--- 144,150 ----
int ptr_bit;
int addr_bit;
int bfd_vma_bit;
+ int char_signed;
int ieee_float;
gdbarch_read_pc_ftype *read_pc;
gdbarch_write_pc_ftype *write_pc;
***************
*** 285,290 ****
--- 286,292 ----
8 * sizeof (void*),
8 * sizeof (void*),
8 * sizeof (void*),
+ 1,
0,
0,
0,
***************
*** 446,451 ****
--- 448,454 ----
current_gdbarch->long_double_bit = 2*TARGET_DOUBLE_BIT;
current_gdbarch->ptr_bit = TARGET_INT_BIT;
current_gdbarch->bfd_vma_bit = TARGET_ARCHITECTURE->bits_per_address;
+ current_gdbarch->char_signed = -1;
current_gdbarch->read_pc = generic_target_read_pc;
current_gdbarch->write_pc = generic_target_write_pc;
current_gdbarch->read_fp = generic_target_read_fp;
***************
*** 561,566 ****
--- 564,571 ----
if (gdbarch->addr_bit == 0)
gdbarch->addr_bit = TARGET_PTR_BIT;
/* Skip verify of bfd_vma_bit, invalid_p == 0 */
+ if (gdbarch->char_signed == -1)
+ gdbarch->char_signed = 1;
/* Skip verify of ieee_float, invalid_p == 0 */
/* Skip verify of read_pc, invalid_p == 0 */
/* Skip verify of write_pc, invalid_p == 0 */
***************
*** 1867,1872 ****
--- 1872,1885 ----
"gdbarch_dump: TARGET_BYTE_ORDER = %ld\n",
(long) TARGET_BYTE_ORDER);
#endif
+ #ifdef TARGET_CHAR_SIGNED
+ fprintf_unfiltered (file,
+ "gdbarch_dump: TARGET_CHAR_SIGNED # %s\n",
+ XSTRING (TARGET_CHAR_SIGNED));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: TARGET_CHAR_SIGNED = %d\n",
+ (long) TARGET_CHAR_SIGNED);
+ #endif
#ifdef TARGET_DOUBLE_BIT
fprintf_unfiltered (file,
"gdbarch_dump: TARGET_DOUBLE_BIT # %s\n",
***************
*** 2263,2268 ****
--- 2276,2299 ----
int bfd_vma_bit)
{
gdbarch->bfd_vma_bit = bfd_vma_bit;
+ }
+
+ int
+ gdbarch_char_signed (struct gdbarch *gdbarch)
+ {
+ if (gdbarch->char_signed == -1)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_char_signed invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_char_signed called\n");
+ return gdbarch->char_signed;
+ }
+
+ void
+ set_gdbarch_char_signed (struct gdbarch *gdbarch,
+ int char_signed)
+ {
+ gdbarch->char_signed = char_signed;
}
int
Index: gdb/gdbarch.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/gdbarch.h,v
retrieving revision 2.104
diff -c -r2.104 gdbarch.h
*** gdb/gdbarch.h 2001/12/11 00:04:41 2.104
--- gdb/gdbarch.h 2001/12/19 22:35:06
***************
*** 287,292 ****
--- 287,310 ----
#endif
#endif
+ /* One if `char' acts like `signed char', zero if `unsigned char'. */
+
+ /* Default (value) for non- multi-arch platforms. */
+ #if (!GDB_MULTI_ARCH) && !defined (TARGET_CHAR_SIGNED)
+ #define TARGET_CHAR_SIGNED (1)
+ #endif
+
+ extern int gdbarch_char_signed (struct gdbarch *gdbarch);
+ extern void set_gdbarch_char_signed (struct gdbarch *gdbarch, int char_signed);
+ #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_CHAR_SIGNED)
+ #error "Non multi-arch definition of TARGET_CHAR_SIGNED"
+ #endif
+ #if GDB_MULTI_ARCH
+ #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_CHAR_SIGNED)
+ #define TARGET_CHAR_SIGNED (gdbarch_char_signed (current_gdbarch))
+ #endif
+ #endif
+
/* Default (value) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (IEEE_FLOAT)
#define IEEE_FLOAT (0)
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: RFA: char is unsigned on some architectures 2001-12-19 14:43 RFA: char is unsigned on some architectures Jim Blandy @ 2001-12-19 14:48 ` Andrew Cagney 2001-12-19 19:11 ` Jim Blandy ` (3 more replies) 2001-12-19 23:04 ` Eli Zaretskii 1 sibling, 4 replies; 10+ messages in thread From: Andrew Cagney @ 2001-12-19 14:48 UTC (permalink / raw) To: Jim Blandy; +Cc: gdb-patches > ISO C specifies that `char' acts like either `signed char' or > `unsigned char'. At the moment, GDB assumes that `char' is `signed > char'. This patch allows the architecture to specify the correct > answer, and sets the value correctly for the IBM S/390 architecture. > > 2001-12-19 Jim Blandy <jimb@redhat.com> > > * gdbarch.sh (TARGET_CHAR_SIGNED): New macro. > * gdbarch.c, gdbarch.h: Regenerated. > * gdbtypes.c (build_gdbtypes): If TARGET_CHAR_SIGNED is zero, > set the TYPE_FLAG_UNSIGNED bit on the type. > * s390-tdep.c (s390_gdbarch_init): On the S/390, characters > are unsigned by default. > Hmm, the rs6000 and prodogy (Hmm, IBM ...) are also unsigned. Want to add that ``obvious'' tweek? Andrew ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: RFA: char is unsigned on some architectures 2001-12-19 14:48 ` Andrew Cagney @ 2001-12-19 19:11 ` Jim Blandy 2001-12-19 19:26 ` Jim Blandy ` (2 subsequent siblings) 3 siblings, 0 replies; 10+ messages in thread From: Jim Blandy @ 2001-12-19 19:11 UTC (permalink / raw) To: Andrew Cagney; +Cc: gdb-patches Andrew Cagney <ac131313@cygnus.com> writes: > Hmm, the rs6000 and prodogy (Hmm, IBM ...) are also unsigned. Want to > add that ``obvious'' tweek? Sure. Thanks for the quick response. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: RFA: char is unsigned on some architectures 2001-12-19 14:48 ` Andrew Cagney 2001-12-19 19:11 ` Jim Blandy @ 2001-12-19 19:26 ` Jim Blandy 2001-12-20 0:44 ` Lars Brinkhoff 2002-01-07 9:13 ` Richard Earnshaw 3 siblings, 0 replies; 10+ messages in thread From: Jim Blandy @ 2001-12-19 19:26 UTC (permalink / raw) To: Andrew Cagney; +Cc: gdb-patches Andrew Cagney <ac131313@cygnus.com> writes: > Hmm, the rs6000 and prodogy (Hmm, IBM ...) are also unsigned. Want to > add that ``obvious'' tweek? Okay, here's the patch I actually committed: 2001-12-19 Jim Blandy <jimb@redhat.com> * gdbarch.sh (TARGET_CHAR_SIGNED): New macro. * gdbarch.c, gdbarch.h: Regenerated. * gdbtypes.c (build_gdbtypes): If TARGET_CHAR_SIGNED is zero, set the TYPE_FLAG_UNSIGNED bit on the type. * s390-tdep.c (s390_gdbarch_init): On the S/390, characters are unsigned by default. * rs6000-tdep.c (rs6000_gdbarch_init): Same for PowerPC and RS6000. Index: gdb/gdbarch.c =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/gdbarch.c,v retrieving revision 2.113 diff -c -r2.113 gdbarch.c *** gdb/gdbarch.c 2001/12/19 21:20:29 2.113 --- gdb/gdbarch.c 2001/12/20 03:16:50 *************** *** 144,149 **** --- 144,150 ---- int ptr_bit; int addr_bit; int bfd_vma_bit; + int char_signed; int ieee_float; gdbarch_read_pc_ftype *read_pc; gdbarch_write_pc_ftype *write_pc; *************** *** 285,290 **** --- 286,292 ---- 8 * sizeof (void*), 8 * sizeof (void*), 8 * sizeof (void*), + 1, 0, 0, 0, *************** *** 446,451 **** --- 448,454 ---- current_gdbarch->long_double_bit = 2*TARGET_DOUBLE_BIT; current_gdbarch->ptr_bit = TARGET_INT_BIT; current_gdbarch->bfd_vma_bit = TARGET_ARCHITECTURE->bits_per_address; + current_gdbarch->char_signed = -1; current_gdbarch->read_pc = generic_target_read_pc; current_gdbarch->write_pc = generic_target_write_pc; current_gdbarch->read_fp = generic_target_read_fp; *************** *** 561,566 **** --- 564,571 ---- if (gdbarch->addr_bit == 0) gdbarch->addr_bit = TARGET_PTR_BIT; /* Skip verify of bfd_vma_bit, invalid_p == 0 */ + if (gdbarch->char_signed == -1) + gdbarch->char_signed = 1; /* Skip verify of ieee_float, invalid_p == 0 */ /* Skip verify of read_pc, invalid_p == 0 */ /* Skip verify of write_pc, invalid_p == 0 */ *************** *** 1867,1872 **** --- 1872,1885 ---- "gdbarch_dump: TARGET_BYTE_ORDER = %ld\n", (long) TARGET_BYTE_ORDER); #endif + #ifdef TARGET_CHAR_SIGNED + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_CHAR_SIGNED # %s\n", + XSTRING (TARGET_CHAR_SIGNED)); + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_CHAR_SIGNED = %d\n", + (long) TARGET_CHAR_SIGNED); + #endif #ifdef TARGET_DOUBLE_BIT fprintf_unfiltered (file, "gdbarch_dump: TARGET_DOUBLE_BIT # %s\n", *************** *** 2263,2268 **** --- 2276,2299 ---- int bfd_vma_bit) { gdbarch->bfd_vma_bit = bfd_vma_bit; + } + + int + gdbarch_char_signed (struct gdbarch *gdbarch) + { + if (gdbarch->char_signed == -1) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_char_signed invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_char_signed called\n"); + return gdbarch->char_signed; + } + + void + set_gdbarch_char_signed (struct gdbarch *gdbarch, + int char_signed) + { + gdbarch->char_signed = char_signed; } int Index: gdb/gdbarch.h =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/gdbarch.h,v retrieving revision 2.104 diff -c -r2.104 gdbarch.h *** gdb/gdbarch.h 2001/12/11 00:04:41 2.104 --- gdb/gdbarch.h 2001/12/20 03:16:51 *************** *** 287,292 **** --- 287,310 ---- #endif #endif + /* One if `char' acts like `signed char', zero if `unsigned char'. */ + + /* Default (value) for non- multi-arch platforms. */ + #if (!GDB_MULTI_ARCH) && !defined (TARGET_CHAR_SIGNED) + #define TARGET_CHAR_SIGNED (1) + #endif + + extern int gdbarch_char_signed (struct gdbarch *gdbarch); + extern void set_gdbarch_char_signed (struct gdbarch *gdbarch, int char_signed); + #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_CHAR_SIGNED) + #error "Non multi-arch definition of TARGET_CHAR_SIGNED" + #endif + #if GDB_MULTI_ARCH + #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_CHAR_SIGNED) + #define TARGET_CHAR_SIGNED (gdbarch_char_signed (current_gdbarch)) + #endif + #endif + /* Default (value) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (IEEE_FLOAT) #define IEEE_FLOAT (0) Index: gdb/gdbarch.sh =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/gdbarch.sh,v retrieving revision 2.92 diff -c -r2.92 gdbarch.sh *** gdb/gdbarch.sh 2001/12/19 21:20:29 2.92 --- gdb/gdbarch.sh 2001/12/20 03:16:51 *************** *** 384,389 **** --- 384,392 ---- # Number of bits in a BFD_VMA for the target object file format. v::TARGET_BFD_VMA_BIT:int:bfd_vma_bit::::8 * sizeof (void*):TARGET_ARCHITECTURE->bits_per_address::0 # + # One if \`char' acts like \`signed char', zero if \`unsigned char'. + v::TARGET_CHAR_SIGNED:int:char_signed::::1:-1:1::%d:: + # v::IEEE_FLOAT:int:ieee_float::::0:0::0::: # f::TARGET_READ_PC:CORE_ADDR:read_pc:ptid_t ptid:ptid::0:generic_target_read_pc::0 Index: gdb/gdbtypes.c =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/gdbtypes.c,v retrieving revision 2.127 diff -c -r2.127 gdbtypes.c *** gdb/gdbtypes.c 2001/12/19 21:20:29 2.127 --- gdb/gdbtypes.c 2001/12/20 03:16:53 *************** *** 3029,3035 **** "void", (struct objfile *) NULL); builtin_type_char = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT, ! TYPE_FLAG_NOSIGN, "char", (struct objfile *) NULL); builtin_type_true_char = init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT, --- 3029,3036 ---- "void", (struct objfile *) NULL); builtin_type_char = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT, ! (TYPE_FLAG_NOSIGN ! | (TARGET_CHAR_SIGNED ? 0 : TYPE_FLAG_UNSIGNED)), "char", (struct objfile *) NULL); builtin_type_true_char = init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT, Index: gdb/rs6000-tdep.c =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/rs6000-tdep.c,v retrieving revision 2.129 diff -c -r2.129 rs6000-tdep.c *** gdb/rs6000-tdep.c 2001/12/19 21:20:29 2.129 --- gdb/rs6000-tdep.c 2001/12/20 03:16:54 *************** *** 2298,2303 **** --- 2298,2304 ---- set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); + set_gdbarch_char_signed (gdbarch, 0); set_gdbarch_use_generic_dummy_frames (gdbarch, 1); set_gdbarch_call_dummy_length (gdbarch, 0); Index: gdb/s390-tdep.c =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/s390-tdep.c,v retrieving revision 2.32 diff -c -r2.32 s390-tdep.c *** gdb/s390-tdep.c 2001/12/19 23:08:16 2.32 --- gdb/s390-tdep.c 2001/12/20 03:16:55 *************** *** 1763,1768 **** --- 1763,1769 ---- gdbarch = gdbarch_alloc (&info, NULL); set_gdbarch_believe_pcc_promotion (gdbarch, 0); + set_gdbarch_char_signed (gdbarch, 0); set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frame_args_address (gdbarch, s390_frame_args_address); ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: RFA: char is unsigned on some architectures 2001-12-19 14:48 ` Andrew Cagney 2001-12-19 19:11 ` Jim Blandy 2001-12-19 19:26 ` Jim Blandy @ 2001-12-20 0:44 ` Lars Brinkhoff 2001-12-20 12:24 ` Jim Blandy 2002-01-07 9:13 ` Richard Earnshaw 3 siblings, 1 reply; 10+ messages in thread From: Lars Brinkhoff @ 2001-12-20 0:44 UTC (permalink / raw) To: Andrew Cagney; +Cc: Jim Blandy, gdb-patches Andrew Cagney <ac131313@cygnus.com> writes: > > ISO C specifies that `char' acts like either `signed char' or > > `unsigned char'. At the moment, GDB assumes that `char' is `signed > > char'. This patch allows the architecture to specify the correct > > answer, and sets the value correctly for the IBM S/390 architecture. > > 2001-12-19 Jim Blandy <jimb@redhat.com> > > * gdbarch.sh (TARGET_CHAR_SIGNED): New macro. > > * gdbarch.c, gdbarch.h: Regenerated. > > * gdbtypes.c (build_gdbtypes): If TARGET_CHAR_SIGNED is zero, > > set the TYPE_FLAG_UNSIGNED bit on the type. > > * s390-tdep.c (s390_gdbarch_init): On the S/390, characters > > are unsigned by default. > > Hmm, the rs6000 and prodogy (Hmm, IBM ...) are also unsigned. How about ARM? -- Lars Brinkhoff http://lars.nocrew.org/ Linux, GCC, PDP-10 Brinkhoff Consulting http://www.brinkhoff.se/ programming ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: RFA: char is unsigned on some architectures 2001-12-20 0:44 ` Lars Brinkhoff @ 2001-12-20 12:24 ` Jim Blandy 0 siblings, 0 replies; 10+ messages in thread From: Jim Blandy @ 2001-12-20 12:24 UTC (permalink / raw) To: Lars Brinkhoff; +Cc: gdb-patches Lars Brinkhoff <lars.spam@nocrew.org> writes: > Andrew Cagney <ac131313@cygnus.com> writes: > > > ISO C specifies that `char' acts like either `signed char' or > > > `unsigned char'. At the moment, GDB assumes that `char' is `signed > > > char'. This patch allows the architecture to specify the correct > > > answer, and sets the value correctly for the IBM S/390 architecture. > > > 2001-12-19 Jim Blandy <jimb@redhat.com> > > > * gdbarch.sh (TARGET_CHAR_SIGNED): New macro. > > > * gdbarch.c, gdbarch.h: Regenerated. > > > * gdbtypes.c (build_gdbtypes): If TARGET_CHAR_SIGNED is zero, > > > set the TYPE_FLAG_UNSIGNED bit on the type. > > > * s390-tdep.c (s390_gdbarch_init): On the S/390, characters > > > are unsigned by default. > > > > Hmm, the rs6000 and prodogy (Hmm, IBM ...) are also unsigned. > > How about ARM? I don't know anything about the ARM. If you do, well, it's a one-line patch. :) ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: RFA: char is unsigned on some architectures 2001-12-19 14:48 ` Andrew Cagney ` (2 preceding siblings ...) 2001-12-20 0:44 ` Lars Brinkhoff @ 2002-01-07 9:13 ` Richard Earnshaw 3 siblings, 0 replies; 10+ messages in thread From: Richard Earnshaw @ 2002-01-07 9:13 UTC (permalink / raw) To: Andrew Cagney; +Cc: Jim Blandy, gdb-patches, Richard.Earnshaw > > ISO C specifies that `char' acts like either `signed char' or > > `unsigned char'. At the moment, GDB assumes that `char' is `signed > > char'. This patch allows the architecture to specify the correct > > answer, and sets the value correctly for the IBM S/390 architecture. > > > > 2001-12-19 Jim Blandy <jimb@redhat.com> > > > > * gdbarch.sh (TARGET_CHAR_SIGNED): New macro. > > * gdbarch.c, gdbarch.h: Regenerated. > > * gdbtypes.c (build_gdbtypes): If TARGET_CHAR_SIGNED is zero, > > set the TYPE_FLAG_UNSIGNED bit on the type. > > * s390-tdep.c (s390_gdbarch_init): On the S/390, characters > > are unsigned by default. > > > > > Hmm, the rs6000 and prodogy (Hmm, IBM ...) are also unsigned. Want to > add that ``obvious'' tweek? > > Andrew > And the ARM. R. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: RFA: char is unsigned on some architectures 2001-12-19 14:43 RFA: char is unsigned on some architectures Jim Blandy 2001-12-19 14:48 ` Andrew Cagney @ 2001-12-19 23:04 ` Eli Zaretskii 2001-12-20 1:14 ` Jim Blandy 1 sibling, 1 reply; 10+ messages in thread From: Eli Zaretskii @ 2001-12-19 23:04 UTC (permalink / raw) To: Jim Blandy; +Cc: gdb-patches Jim Blandy wrote: > > ISO C specifies that `char' acts like either `signed char' or > `unsigned char'. At the moment, GDB assumes that `char' is `signed > char'. This patch allows the architecture to specify the correct > answer, and sets the value correctly for the IBM S/390 architecture. > > 2001-12-19 Jim Blandy <jimb@redhat.com> > > * gdbarch.sh (TARGET_CHAR_SIGNED): New macro. This new macro should be documented in gdbint.texinfo, I think. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: RFA: char is unsigned on some architectures 2001-12-19 23:04 ` Eli Zaretskii @ 2001-12-20 1:14 ` Jim Blandy 2001-12-20 3:10 ` Eli Zaretskii 0 siblings, 1 reply; 10+ messages in thread From: Jim Blandy @ 2001-12-20 1:14 UTC (permalink / raw) To: Eli Zaretskii; +Cc: gdb-patches Eli Zaretskii <eliz@is.elta.co.il> writes: > > 2001-12-19 Jim Blandy <jimb@redhat.com> > > > > * gdbarch.sh (TARGET_CHAR_SIGNED): New macro. > > This new macro should be documented in gdbint.texinfo, I think. Certainly. How is this? Index: gdbint.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v retrieving revision 1.48 diff -c -c -b -F'^(' -r1.48 gdbint.texinfo *** gdbint.texinfo 2001/12/15 16:53:24 1.48 --- gdbint.texinfo 2001/12/20 09:13:22 *************** *** 3501,3506 **** --- 3501,3517 ---- @findex TARGET_CHAR_BIT Number of bits in a char; defaults to 8. + @item TARGET_CHAR_SIGNED + @findex TARGET_CHAR_SIGNED + Non-zero if @code{char} is normally signed on this architecture; zero if + it should be unsigned. + + The ISO C standard requires the compiler to treat @code{char} as + equivalent to either @code{signed char} or @code{unsigned char}; any + character in the standard execution set is supposed to be positive. + Most compilers treat @code{char} as signed, but @code{char} is unsigned + on the IBM S/390, RS6000, and PowerPC targets. + @item TARGET_COMPLEX_BIT @findex TARGET_COMPLEX_BIT Number of bits in a complex number; defaults to @code{2 * TARGET_FLOAT_BIT}. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: RFA: char is unsigned on some architectures 2001-12-20 1:14 ` Jim Blandy @ 2001-12-20 3:10 ` Eli Zaretskii 0 siblings, 0 replies; 10+ messages in thread From: Eli Zaretskii @ 2001-12-20 3:10 UTC (permalink / raw) To: Jim Blandy; +Cc: gdb-patches Jim Blandy wrote: > > Eli Zaretskii <eliz@is.elta.co.il> writes: > > > 2001-12-19 Jim Blandy <jimb@redhat.com> > > > > > > * gdbarch.sh (TARGET_CHAR_SIGNED): New macro. > > > > This new macro should be documented in gdbint.texinfo, I think. > > Certainly. How is this? > > Index: gdbint.texinfo Perfect! Thanks. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2002-01-07 17:13 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2001-12-19 14:43 RFA: char is unsigned on some architectures Jim Blandy 2001-12-19 14:48 ` Andrew Cagney 2001-12-19 19:11 ` Jim Blandy 2001-12-19 19:26 ` Jim Blandy 2001-12-20 0:44 ` Lars Brinkhoff 2001-12-20 12:24 ` Jim Blandy 2002-01-07 9:13 ` Richard Earnshaw 2001-12-19 23:04 ` Eli Zaretskii 2001-12-20 1:14 ` Jim Blandy 2001-12-20 3:10 ` Eli Zaretskii
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox