public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Anton Kolesov <Anton.Kolesov@synopsys.com>
Cc: gdb-patches@sourceware.org,
	Francois Bedard <Francois.Bedard@synopsys.com>
Subject: Re: [PATCH] arc: Select CPU model properly before disassembling
Date: Tue, 13 Jun 2017 21:31:00 -0000	[thread overview]
Message-ID: <85d6db352b9a796f92bb97af8cf32037@polymtl.ca> (raw)
In-Reply-To: <39A54937CC95F24AA2F794E2D2B66B135874F238@DE02WEMBXB.internal.synopsys.com>

On 2017-06-06 15:51, Anton Kolesov wrote:
>> Could gdb_disassembler set the section field of disassemble_info 
>> itself?
>>   What you are doing to set the section field here is not 
>> ARC-specific,
>> it looks like it could potentially help other architectures to have 
>> that
>> field set.
>> 
>> Other places that use the disassembler would have to set it too, for
>> example in the object prepared by the arc_disassemble_info function.
> 
> I think this info->section initialization code can be moved to
> arch-utils.c:default_print_insn, however I'm not sure if that wouldn't 
> cause
> any troubles with other architectures.

I don't see why setting the section would cause a problem.  If it does, 
I'd say it's more likely a bug in these other architectures code.  You 
could argue that for architectures that don't have disassembler options, 
it would be some wasted cycles though...

> Doing initialization in gdb_disassembler
> constructor is complicated, because we don't really know what would be 
> the
> disassembled address at this stage, hence what would be the section.
> Gdb_dissassembler construction can use .text section as a default, but 
> then
> might now work with some multi-arch ELFs, I presume (unlikely to be a
> problem for ARC, though).

That might be a good default behavior, to be overridden by the few 
architectures that have some more corner cases.

> Another option is, of course, to partially revert [2] for ARC - make
> arc_delayed_print_insn a printer for ARC, but change it, so it will 
> only
> set info->section and then call default_print_insn. I believe that same 
> change
> is needed in mep-tdep.c. At least for ARC we would need to use 
> print_insn
> anyway to disassemble, because opcodes/arc-dis.c:arc_insn_decode relies 
> on it.

That's fine with me.

Simon

      parent reply	other threads:[~2017-06-13 21:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01 16:02 Anton Kolesov
2017-06-05 20:07 ` Simon Marchi
2017-06-06 13:51   ` Anton Kolesov
2017-06-13 13:49     ` [PATCH v2] " Anton Kolesov
2017-06-13 22:16       ` Simon Marchi
2017-06-14 14:02         ` Anton Kolesov
2017-06-14 16:27           ` Simon Marchi
2017-06-14 16:37             ` Pedro Alves
2017-06-15 13:20               ` Anton Kolesov
2017-06-15 13:20               ` [PATCH v3] " Anton Kolesov
2017-06-15 21:12                 ` Simon Marchi
2017-06-16 12:03                   ` Anton Kolesov
2017-06-13 21:31     ` Simon Marchi [this message]

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=85d6db352b9a796f92bb97af8cf32037@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=Anton.Kolesov@synopsys.com \
    --cc=Francois.Bedard@synopsys.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).