Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Sivanupandi, Pitchumani" <Pitchumani.Sivanupandi@atmel.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: Andrew Burgess <andrew.burgess@embecosm.com>,
	Denis Chertykov	<chertykov@gmail.com>,
	"uweigand@de.ibm.com" <uweigand@de.ibm.com>
Subject: [patch] parse load_offset (bias) of restore command as long
Date: Tue, 06 Oct 2015 07:26:00 -0000	[thread overview]
Message-ID: <CAC140656783604CABA6AE60C2A6D5A4A2DF93E3@penmbx02.corp.atmel.com> (raw)

Hi,

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.

diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 931bb4a..8dd2009 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).  */

If ok, could someone commit please? I don't have commit access.

Regards,
Pitchumani

gdb/ChangeLog

2015-10-05  Pitchumani Sivanupandi  <pitchumani.s@atmel.com>

	* cli/cli-dump.c (restore_command): Parse load_offset (bias) as address
	only when the file is binary.


             reply	other threads:[~2015-10-06  7:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-06  7:26 Sivanupandi, Pitchumani [this message]
2015-10-06 16:33 ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAC140656783604CABA6AE60C2A6D5A4A2DF93E3@penmbx02.corp.atmel.com \
    --to=pitchumani.sivanupandi@atmel.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=chertykov@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox