This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] arc: Select CPU model properly before disassembling


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]