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.
This commit is contained in:
Ulrich Weigand 2009-06-17 18:49:37 +00:00
parent a78c2d625f
commit 1fac167a76
7 changed files with 39 additions and 18 deletions

View file

@ -1,3 +1,17 @@
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.

View file

@ -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). */

View file

@ -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;

View file

@ -1,3 +1,7 @@
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.

View file

@ -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

View file

@ -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
{

View file

@ -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;
}