This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [PATCH v2] Fix alignment of disassemble /r
- From: "Metzger, Markus T" <markus dot t dot metzger at intel dot com>
- To: Leonardo Boquillon <leonardo dot boquillon at tallertechnologies dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Wed, 6 Apr 2016 06:56:47 +0000
- Subject: RE: [PATCH v2] Fix alignment of disassemble /r
- Authentication-results: sourceware.org; auth=none
- References: <1459534685-10835-1-git-send-email-leonardo dot boquillon at tallertechnologies dot com> <A78C989F6D9628469189715575E55B233328EFE2 at IRSMSX104 dot ger dot corp dot intel dot com> <CABsS7grbpJ0r_oTQcUQoptd_7xpXaKukY2Ch3yFubPsdsr=X8Q at mail dot gmail dot com>
> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Leonardo Boquillon
> Sent: Tuesday, April 5, 2016 8:11 PM
> To: Metzger, Markus T <markus.t.metzger@intel.com>
> Cc: gdb-patches@sourceware.org
> Subject: Re: [PATCH v2] Fix alignment of disassemble /r
Hi Leonardo,
> > > diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index
> > > 77b5180..72a0b77 100644
> > > --- a/gdb/record-btrace.c
> > > +++ b/gdb/record-btrace.c
> > > @@ -745,7 +745,7 @@ btrace_insn_history (struct ui_out *uiout,
> > > if ((insn->flags & BTRACE_INSN_FLAG_SPECULATIVE) != 0)
> > > dinsn.is_speculative = 1;
> > >
> > > - gdb_pretty_print_insn (gdbarch, uiout, &di, &dinsn, flags, stb);
> > > + gdb_pretty_print_insn_tab (gdbarch, uiout, &di, &dinsn,
> > > + flags, stb);
> >
> > You can compute the longest opcode just like in the low, high case by
> > iterating over the to-be-printed instructions like this:
> >
> > for (it = *begin; btrace_insn_cmp (&it, end) != 0; btrace_insn_next (&it,
> 1))
> > {
> > const struct btrace_insn *insn;
> >
> > insn = btrace_insn_get (&it);
> > if (insn == NULL)
> > continue;
> >
> > <compute longest opcode>
>
> I'm not sure what you meant with this, that snippet is a backtrace code. If
> you mean I should use a iterator, I dont know if there is something similar to
> btrace_insn_iterator that I could use for disassembly.
I was just referring to the record-btrace changes. The patch uses
gdb_pretty_print_insn_tab here. We may instead compute the longest
opcode and use gdb_pretty_print_insn_padding here, as well. Just as the
patch does for disasm.
Record-btrace uses an iterator instead of a low-high address pair. I sketched the
loop to compute the longest opcode in this case.
We wouldn't need gdb_pretty_print_insn_tab anymore as all users now use
gdb_pretty_print_insn_padding.
Regards,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928