diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2009-06-17 18:49:36 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2009-06-17 18:49:36 +0000 |
commit | 7990ef6595652e8ee3b2d73066ab446a99091ff4 (patch) | |
tree | 15efb90b78336eebadb876c864d1fdfc78238fe9 | |
parent | 1f0842dcc1f88af26bb9160abcacd07b37c4b80d (diff) | |
download | gdb-7990ef6595652e8ee3b2d73066ab446a99091ff4.tar.gz |
ChangeLog:
* printcmd.c (print_scalar_formatted): Always truncate
unsigned data types.
* cli-dump.c (struct callback_data): Change type of load_offset
to CORE_ADDR.
(restore_binary_file): Update type casts.
(restore_command): Parse load_offset as address, not long.
* utils.c (string_to_core_addr): Do not sign-extend value.
* varobj.c (find_frame_addr_in_frame_chain): Truncate frame_base
before comparing against requested frame address.
testsuite/ChangeLog:
* gdb.base/dump.exp: Handle SPU like 64-bit platforms.
-rw-r--r-- | gdb/ChangeLog | 14 | ||||
-rw-r--r-- | gdb/cli/cli-dump.c | 8 | ||||
-rw-r--r-- | gdb/printcmd.c | 2 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/dump.exp | 6 | ||||
-rw-r--r-- | gdb/utils.c | 12 | ||||
-rw-r--r-- | gdb/varobj.c | 11 |
7 files changed, 39 insertions, 18 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 48952aa769f..639f8641c4e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,19 @@ 2009-06-17 Ulrich Weigand <uweigand@de.ibm.com> + * printcmd.c (print_scalar_formatted): Always truncate + unsigned data types. + + * cli-dump.c (struct callback_data): Change type of load_offset + to CORE_ADDR. + (restore_binary_file): Update type casts. + (restore_command): Parse load_offset as address, not long. + + * utils.c (string_to_core_addr): Do not sign-extend value. + * varobj.c (find_frame_addr_in_frame_chain): Truncate frame_base + before comparing against requested frame address. + +2009-06-17 Ulrich Weigand <uweigand@de.ibm.com> + * gdbarch.sh (gcore_bfd_target): New gdbarch callback. * gdbarch.h, gdbarch.c: Regenerate. diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 96e61117fd5..82062a1a82a 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -428,7 +428,7 @@ add_dump_command (char *name, void (*func) (char *args, char *mode), /* Opaque data for restore_section_callback. */ struct callback_data { - long load_offset; + CORE_ADDR load_offset; CORE_ADDR load_start; CORE_ADDR load_end; }; @@ -533,8 +533,8 @@ restore_binary_file (char *filename, struct callback_data *data) printf_filtered ("Restoring binary file %s into memory (0x%lx to 0x%lx)\n", filename, - (unsigned long) data->load_start + data->load_offset, - (unsigned long) data->load_start + data->load_offset + len); + (unsigned long) (data->load_start + data->load_offset), + (unsigned long) (data->load_start + data->load_offset + len)); /* Now set the file pos to the requested load start pos. */ if (fseek (file, data->load_start, SEEK_SET) != 0) @@ -584,7 +584,7 @@ restore_command (char *args, int from_tty) /* Parse offset (optional). */ if (args != NULL && *args != '\0') data.load_offset = - parse_and_eval_long (scan_expression_with_cleanup (&args, NULL)); + parse_and_eval_address (scan_expression_with_cleanup (&args, NULL)); if (args != NULL && *args != '\0') { /* Parse start address (optional). */ diff --git a/gdb/printcmd.c b/gdb/printcmd.c index c95b156a58d..eeffa6ea7d5 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -407,7 +407,7 @@ print_scalar_formatted (const void *valaddr, struct type *type, /* If we are printing it as unsigned, truncate it in case it is actually a negative signed value (e.g. "print/u (short)-1" should print 65535 (if shorts are 16 bits) instead of 4294967295). */ - if (options->format != 'd') + if (options->format != 'd' || TYPE_UNSIGNED (type)) { if (len < sizeof (LONGEST)) val_long &= ((LONGEST) 1 << HOST_CHAR_BIT * len) - 1; diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 877f52718d4..8f0e2189d45 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2009-06-17 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + * gdb.base/dump.exp: Handle SPU like 64-bit platforms. + +2009-06-17 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + * gdb.mi/gdb680.exp: Update test for error message. 2009-06-17 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp index 4d48e5c0a86..072fcfdaedc 100644 --- a/gdb/testsuite/gdb.base/dump.exp +++ b/gdb/testsuite/gdb.base/dump.exp @@ -42,6 +42,12 @@ if {[istarget "ia64*-*-*"] || [istarget "hppa64-*-*"]} then { set is64bitonly "yes" } +if {[istarget "spu*-*-*"]} then { + # The internal address format used for the combined Cell/B.E. + # debugger requires 64-bit. + set is64bitonly "yes" +} + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${options}] != "" } { untested dump.exp return -1 diff --git a/gdb/utils.c b/gdb/utils.c index 4396d145df7..05081597c99 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -3154,7 +3154,6 @@ core_addr_to_string_nz (const CORE_ADDR addr) CORE_ADDR string_to_core_addr (const char *my_string) { - int addr_bit = gdbarch_addr_bit (current_gdbarch); CORE_ADDR addr = 0; if (my_string[0] == '0' && tolower (my_string[1]) == 'x') @@ -3170,17 +3169,6 @@ string_to_core_addr (const char *my_string) else error (_("invalid hex \"%s\""), my_string); } - - /* Not very modular, but if the executable format expects - addresses to be sign-extended, then do so if the address was - specified with only 32 significant bits. Really this should - be determined by the target architecture, not by the object - file. */ - if (i - 2 == addr_bit / 4 - && exec_bfd - && bfd_get_sign_extend_vma (exec_bfd)) - addr = (addr ^ ((CORE_ADDR) 1 << (addr_bit - 1))) - - ((CORE_ADDR) 1 << (addr_bit - 1)); } else { diff --git a/gdb/varobj.c b/gdb/varobj.c index 7df7fed2446..089fc5347e8 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -462,7 +462,16 @@ find_frame_addr_in_frame_chain (CORE_ADDR frame_addr) frame != NULL; frame = get_prev_frame (frame)) { - if (get_frame_base_address (frame) == frame_addr) + /* The CORE_ADDR we get as argument was parsed from a string GDB + output as $fp. This output got truncated to gdbarch_addr_bit. + Truncate the frame base address in the same manner before + comparing it against our argument. */ + CORE_ADDR frame_base = get_frame_base_address (frame); + int addr_bit = gdbarch_addr_bit (get_frame_arch (frame)); + if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT)) + frame_base &= ((CORE_ADDR) 1 << addr_bit) - 1; + + if (frame_base == frame_addr) return frame; } |