From: Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
To: tromey@redhat.com
Cc: gdb-patches@sourceware.org, Richard Earnshaw <Richard.Earnshaw@arm.com>
Subject: Re: [PATCH] Gracefully handle not being able to access a DWARF register number
Date: Tue, 27 Apr 2010 10:54:00 -0000 [thread overview]
Message-ID: <1272365614.19466.6.camel@e102111-lin.cambridge.arm.com> (raw)
In-Reply-To: <m3eii2m111.fsf@fleche.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1378 bytes --]
On Mon, 2010-04-26 at 14:06 -0600, Tom Tromey wrote:
> >>>>> "Matthew" == Matthew Gretton-Dann <matthew.gretton-dann@arm.com> writes:
>
> Matthew> The attached patch changes these internal errors into warnings, and
> Matthew> tries to return something sensible to the user.
>
> Why a warning and not an error?
>
> It seems to me that an error is preferable to returning incorrect
> information.
Agreed.
> Matthew> Please could someone review and comment on the patch, and then if this
> Matthew> is approved can they please commit it as I don't have commit rights.
>
> Do you have copyright assignment paperwork in place?
Yes - through my employer (ARM).
> Matthew> + warning (_("Unable to access DWARF register number %" BFD_VMA_FMT "d"),
> Matthew> + p->v.expr.value);
>
> I think there is some other way to print a CORE_ADDR, but I forget what
> it is. BFD_VMA_FMT seems suspect, just because it is not used anywhere
> else in gdb.
Okay.
Please find attached an updated patch that addresses the above two
issues.
Proposed ChangeLog:
2010-04-27 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* dwarf2loc.c (read_pieced_value, write_pieced_value,
dwarf2_evaluate_loc_desc): Handle not being able to access DWARF
registers gracefully.
Thanks,
Matt
--
Matthew Gretton-Dann
Principal Engineer - Tools, PD Software
ARM Limited
[-- Attachment #2: 1004-gdb-dwarf2loc.patch --]
[-- Type: text/x-patch, Size: 2100 bytes --]
Index: gdb/dwarf2loc.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2loc.c,v
retrieving revision 1.74
diff -u -p -u -p -r1.74 dwarf2loc.c
--- gdb/dwarf2loc.c 17 Mar 2010 22:04:43 -0000 1.74
+++ gdb/dwarf2loc.c 27 Apr 2010 09:44:34 -0000
@@ -284,8 +284,16 @@ read_pieced_value (struct value *v)
/* Big-endian, and we want less than full size. */
reg_offset = register_size (arch, gdb_regnum) - p->size;
- get_frame_register_bytes (frame, gdb_regnum, reg_offset, p->size,
- contents + offset);
+ if (gdb_regnum != -1)
+ {
+ get_frame_register_bytes (frame, gdb_regnum, reg_offset,
+ p->size, contents + offset);
+ }
+ else
+ {
+ error (_("Unable to access DWARF register number %s"),
+ paddress (arch, p->v.expr.value));
+ }
}
break;
@@ -356,8 +364,16 @@ write_pieced_value (struct value *to, st
/* Big-endian, and we want less than full size. */
reg_offset = register_size (arch, gdb_regnum) - p->size;
- put_frame_register_bytes (frame, gdb_regnum, reg_offset, p->size,
- contents + offset);
+ if (gdb_regnum != -1)
+ {
+ put_frame_register_bytes (frame, gdb_regnum, reg_offset,
+ p->size, contents + offset);
+ }
+ else
+ {
+ error (_("Unable to write to DWARF register number %s"),
+ paddress (arch, p->v.expr.value));
+ }
}
break;
case DWARF_VALUE_MEMORY:
@@ -454,7 +470,16 @@ dwarf2_evaluate_loc_desc (struct symbol
struct gdbarch *arch = get_frame_arch (frame);
CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0);
int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, dwarf_regnum);
- retval = value_from_register (SYMBOL_TYPE (var), gdb_regnum, frame);
+ if (gdb_regnum != -1)
+ {
+ retval = value_from_register (SYMBOL_TYPE (var),
+ gdb_regnum, frame);
+ }
+ else
+ {
+ error (_("Unable to access DWARF register number %s"),
+ paddress (arch, dwarf_regnum));
+ }
}
break;
next prev parent reply other threads:[~2010-04-27 10:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-26 15:28 Matthew Gretton-Dann
2010-04-26 20:06 ` Tom Tromey
2010-04-26 20:21 ` Sergio Durigan Junior
2010-04-27 10:54 ` Matthew Gretton-Dann [this message]
2010-04-30 18:08 ` Tom Tromey
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=1272365614.19466.6.camel@e102111-lin.cambridge.arm.com \
--to=matthew.gretton-dann@arm.com \
--cc=Richard.Earnshaw@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.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