From cbd641edf3323ce354c0bc7eb54496057040b564 Mon Sep 17 00:00:00 2001 From: Pitchumani Sivanupandi Date: Tue, 6 Oct 2015 18:29:03 +0200 Subject: [PATCH] parse load_offset (bias) of restore command as long Following failures are noticed for avr-gdb. This may be the case for targets like AVR which has integer_to_address hook defined. FAIL: gdb.base/dump.exp: struct copy, srec; value restored ok FAIL: gdb.base/dump.exp: struct copy, ihex; value restored ok FAIL: gdb.base/dump.exp: struct copy, tekhex; value restored ok These tests are failed because load_offset(bias) of restore command parsed as address. command: restore filename [binary] bias start end Except binary, other BFDs have a built-in location; gdb restores content at offset 'bias' from that location. So, 'bias' of 'restore' command should be parsed as address only when the file is binary. Below patch changes gdb to parse 'bias' as long if the file is not binary. gdb/ChangeLog 2015-10-06 Pitchumani Sivanupandi * cli/cli-dump.c (restore_command): Parse load_offset (bias) as address only when the file is binary. --- gdb/ChangeLog | 5 +++++ gdb/cli/cli-dump.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 20d4a4b425f..1cb28c69e6d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2015-10-06 Pitchumani Sivanupandi + + * cli/cli-dump.c (restore_command): Parse load_offset (bias) as address + only when the file is binary. + 2015-10-02 James Bowman * ft32-tdep.c (ft32_analyze_prologue): Add function prolog diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 931bb4a64c6..a434ac18ea3 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -596,8 +596,9 @@ restore_command (char *args_in, int from_tty) } /* Parse offset (optional). */ if (args != NULL && *args != '\0') - data.load_offset = - parse_and_eval_address (scan_expression_with_cleanup (&args, NULL)); + data.load_offset = binary_flag ? + parse_and_eval_address (scan_expression_with_cleanup (&args, NULL)) : + parse_and_eval_long (scan_expression_with_cleanup (&args, NULL)); if (args != NULL && *args != '\0') { /* Parse start address (optional). */ -- 2.30.2