Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <xdje42@gmail.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Rewrite mixed source/assembler disassembly
Date: Mon, 20 Jul 2015 05:38:00 -0000	[thread overview]
Message-ID: <CAP9bCMRS4C25MYUnbCo6osuYqDGn+2mX_DYmY68DaENS6VsfXg@mail.gmail.com> (raw)
In-Reply-To: <m3h9oz1k4m.fsf@seba.sebabeach.org>

On Sun, Jul 19, 2015 at 10:19 PM, Doug Evans <xdje42@gmail.com> wrote:
> Hi.
>
> This is a patch I've wanted to write for a very long time.
> The current mixed source/assembler disassembly is not very usable.
> In the presence of multiple source files (inlined functions, etc.)
> it doesn't print usable output.
> In the presence of optimized code, trying to be source centric
> just doesn't work IMO. And with no optimization the before/after
> should be identical.
>
> One change I've made here is that I'm printing the source file
> in the output.  This is critical when displaying inlined functions
> from another source file.  If there's only one source file it's
> more a matter of taste. To keep things simple, this patch displays
> the source file name even if there's only one file.
>
> The other change I've made is to remove the blank line between
> assembly and the next source line. I'm ambivalent, what do you think?
>
> E.g.,
>
> (gdb) disas /m main
> Dump of assembler code for function main:
> hello.c: <<<--- this is new
> 5       {
>    0x08048330 <+0>:    push   %ebp
>    0x08048331 <+1>:    mov    %esp,%ebp
>    0x08048333 <+3>:    sub    $0x8,%esp
>    0x08048336 <+6>:    and    $0xfffffff0,%esp
>    0x08048339 <+9>:    sub    $0x10,%esp
> 6         printf ("Hello.\n");
> => 0x0804833c <+12>:   movl   $0x8048440,(%esp)
>    0x08048343 <+19>:   call   0x8048284 <puts@@plt>
> 7         return 0;
>    0x08048348 <+24>:   mov    $0x0,%eax
> 8       }
>    0x0804834d <+29>:   leave
>    0x0804834e <+30>:   ret
>
> I still need to test this with an MI frontend.
>
> 2015-07-19  Doug Evans  <xdje42@gmail.com>
>
>         * NEWS: Document change is mixed source/assembly output.
>         * disasm.c: #include "source.h".
>         (dis_line_entry) <symtab>: New member.
>         (dis_line_entry) <start_pc, end_pc>: Delete members.
>         (hash_dis_line_entry, eq_dis_line_entry): New functions.
>         (allocate_dis_line_table): New functions.
>         (maybe_add_dis_line_entry, line_has_code_p): New functions.
>         (compare_lines): Delete.
>         (dump_insns): New arg end_pc.  All callers updated.
>         (do_mixed_source_and_assembly): Rewrite.  Delete arg nlines, le.
>         Rename arg symtab to main_symtab.  All callers updated.
>
>         doc/
>         * gdb.texinfo (Machine Code): Update docs for mixed source/assembly
>         disassembly.
>
>         testsuite/
>         * gdb.mi/basics.c (main): Add comment.
>         * gdb.mi/mi-cli.exp: Update.
>         * gdb.mi/mi-disassemble.exp: Update.

Hmmm, looks like I need to do a bit of testing with TUI too.

TUI doesn't have a mixed source+assembly in one window AFAICT.
That would be cool, but that's a separate project.
For now I'm just going to make sure things work at least
as well as before (I'm seeing some problems I need to investigate).


  reply	other threads:[~2015-07-20  5:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-20  5:20 Doug Evans
2015-07-20  5:38 ` Doug Evans [this message]
2015-07-21 17:20 ` Joel Brobecker

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=CAP9bCMRS4C25MYUnbCo6osuYqDGn+2mX_DYmY68DaENS6VsfXg@mail.gmail.com \
    --to=xdje42@gmail.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