[committed] Fix negative load offset in restore command
Ulrich Weigand
uweigand@de.ibm.com
Thu Mar 8 16:56:00 GMT 2007
Hello,
cli/cli-dump.c has a structure
struct callback_data {
unsigned long load_offset;
CORE_ADDR load_start;
CORE_ADDR load_end;
};
used to hold parameters of a restore command. Note that load_offset
has an unsigned type, even though the restore command supports negative
offsets. This causes incorrect results on computing load_start + load_offset
on systems where "unsigned long" is a 32-bit type but CORE_ADDR is 64-bit.
Fixed by using a signed long data type instead.
Tested on spu-elf, committed to mainline.
Bye,
Ulrich
ChangeLog:
* cli/cli-dump.c (struct callback_data): load_offset needs to
have signed long type.
Index: gdb/cli/cli-dump.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-dump.c,v
retrieving revision 1.25
diff -u -p -r1.25 cli-dump.c
--- gdb/cli/cli-dump.c 9 Jan 2007 17:59:00 -0000 1.25
+++ gdb/cli/cli-dump.c 8 Mar 2007 16:47:57 -0000
@@ -443,7 +443,7 @@ add_dump_command (char *name, void (*fun
/* Opaque data for restore_section_callback. */
struct callback_data {
- unsigned long load_offset;
+ long load_offset;
CORE_ADDR load_start;
CORE_ADDR load_end;
};
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
More information about the Gdb-patches
mailing list