Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Jiong Wang <jiong.wang@foss.arm.com>,
	Ivo Raisr <ivo.raisr@oracle.com>,
	GDB <gdb-patches@sourceware.org>
Subject: Re: [Patch] New gdbarch method "dwarf_cfa_op" and migrate SPARC to it
Date: Fri, 21 Apr 2017 19:37:00 -0000	[thread overview]
Message-ID: <c92da4cc-a713-6055-f521-6164f5a6e6d8@palves.net> (raw)
In-Reply-To: <1d0d97ca-b503-0303-5efc-600db754bd27@foss.arm.com>

On 04/21/2017 03:56 PM, Jiong Wang wrote:

> Hi Ivo,
> 
>   Thanks very much for testing this on SPARC platform.
> 
>   What's really reused is the DWARF CFA number 0x2d behind
> DW_CFA_GNU_window_save.  It is in vendor extension space (
> DW_CFA_lo_user.. DW_CFA_hi_user) so the semantics depends on vendor
> interpreation.

Maybe the commit log could/should be simplified, because
I was confused too.

Doesn't the Aarch64 version of the opcode have its own
name, like DW_CFA_GNU_Aarch64_whatever, even if it reuses the
opcode number?  I think that would help a lot going forward
if it had one.  E.g., it'd avoid confusion, allow for easier
searching, etc.

On the patch, I think it would be better if in execute_cfa_program:

>  	    case DW_CFA_GNU_window_save:
> -	      /* This is SPARC-specific code, and contains hard-coded
> -		 constants for the register numbering scheme used by

you removed "case CFA_GNU_window_save:" too, and moved the 
gdbarch_dwarf_cfa_op call to the default case.  Then make the hook
return a boolean indication about whether it /recognized the
opcode, and make the caller throw an error if the hook returns
false.  And make that error call be a regular "error()" call instead
of the current internal_error call.  The internal error is bogus
here because we reach that with an unrecognized opcode that comes
from a binary, i.e., input, not a gdb bug.

Replace the gdb_assert in sparc_dwarf_cfa_op by returning false for
unrecognized opcodes, and likewise change default_dwarf_cfa_op
to return false instead of calling error itself.

Add a comment at the hook call site about letting the backend
handle vendor-specific opcodes, and generalize a bit the comment
describing the hook in gdbarch.sh in that direction as well.

Maybe rename to hook from dwarf_cfa_op to something like:

  handle_dwarf_cfa_op
  handle_dwarf_cfa_vendor_op
  execute_dwarf_cfa_op
  execute_dwarf_cfa_vendor_op

too, while at it?

Thanks,
Pedro Alves


  reply	other threads:[~2017-04-21 19:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19 10:17 Jiong Wang
2017-04-21 20:45 ` Ivo Raisr
2017-04-21 18:33   ` Jiong Wang
2017-04-21 19:37     ` Pedro Alves [this message]
2017-04-21 19:53       ` Ivo Raisr
2017-04-25 10:40       ` Jiong Wang
2017-04-26  8:49         ` Ivo Raisr
2017-04-26  9:22           ` Pedro Alves

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=c92da4cc-a713-6055-f521-6164f5a6e6d8@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    --cc=ivo.raisr@oracle.com \
    --cc=jiong.wang@foss.arm.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