diff options
author | Jim Blandy <jimb@codesourcery.com> | 2001-12-20 03:26:08 +0000 |
---|---|---|
committer | Jim Blandy <jimb@codesourcery.com> | 2001-12-20 03:26:08 +0000 |
commit | 4e40929968103f27fba096429d4df7e1be8b80e6 (patch) | |
tree | 089bb00c6ba305f22a3745efd81aecdee053f56b | |
parent | 3695c2997d939be2c281d498c1b232805b4cb09b (diff) | |
download | gdb-4e40929968103f27fba096429d4df7e1be8b80e6.zip gdb-4e40929968103f27fba096429d4df7e1be8b80e6.tar.gz gdb-4e40929968103f27fba096429d4df7e1be8b80e6.tar.bz2 |
* 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.
-rw-r--r-- | gdb/gdbarch.c | 31 | ||||
-rw-r--r-- | gdb/gdbarch.h | 18 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 3 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 3 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 1 | ||||
-rw-r--r-- | gdb/s390-tdep.c | 1 |
6 files changed, 56 insertions, 1 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 6a1b61b..2de3360 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -144,6 +144,7 @@ struct gdbarch 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,6 +286,7 @@ struct gdbarch startup_gdbarch = 8 * sizeof (void*), 8 * sizeof (void*), 8 * sizeof (void*), + 1, 0, 0, 0, @@ -446,6 +448,7 @@ gdbarch_alloc (const struct gdbarch_info *info, 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,6 +564,8 @@ verify_gdbarch (struct gdbarch *gdbarch) 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,6 +1872,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "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", @@ -2266,6 +2279,24 @@ set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch, } 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 gdbarch_ieee_float (struct gdbarch *gdbarch) { /* Skip verify of ieee_float, invalid_p == 0 */ diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 21e5317..84e5c16 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -287,6 +287,24 @@ extern void set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch, int bfd_vma_bit); #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) diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index c474232..e263e45 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -384,6 +384,9 @@ v::TARGET_ADDR_BIT:int:addr_bit::::8 * sizeof (void*):0:TARGET_PTR_BIT: # 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 diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 4a4ff1e..1204a0c 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3029,7 +3029,8 @@ build_gdbtypes (void) "void", (struct objfile *) NULL); builtin_type_char = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_NOSIGN, + (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, diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 70facb4..081eccb 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2298,6 +2298,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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); diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 7bab1a8..02786ec 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1763,6 +1763,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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); |