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 v2] Fix alignment of disassemble /r


> -----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

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