Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* "disassemble" shows code, but not with /m
@ 2014-03-19 17:50 Eli Zaretskii
  2014-03-19 18:45 ` Jan Kratochvil
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2014-03-19 17:50 UTC (permalink / raw)
  To: gdb

Did anyone bump into something like below with GDB 7.7?
SUBRP is an inline function defined on the header file lisp.h in
Emacs:

  INLINE bool
  SUBRP (Lisp_Object a)
  {
    return PSEUDOVECTORP (a, PVEC_SUBR);
  }


Trying to disassemble it, I get these results:

  (gdb) disassemble 0x10f3110,+30
  Dump of assembler code from 0x10f3110 to 0x10f312e:
     0x010f3110 <SUBRP+0>:        push   %ebp
     0x010f3111 <SUBRP+1>:        mov    %esp,%ebp
     0x010f3113 <SUBRP+3>:        sub    $0x8,%esp
     0x010f3116 <SUBRP+6>:        movl   $0xa,0x4(%esp)
     0x010f311e <SUBRP+14>:       mov    0x8(%ebp),%eax
     0x010f3121 <SUBRP+17>:       mov    %eax,(%esp)
     0x010f3124 <SUBRP+20>:       call   0x10f306f <PSEUDOVECTORP>
     0x010f3129 <SUBRP+25>:       leave
     0x010f312a <SUBRP+26>:       ret
     0x010f312b <COMPILEDP+0>:    push   %ebp
     0x010f312c <COMPILEDP+1>:    mov    %esp,%ebp
  End of assembler dump.
  (gdb) disassemble 0x10f3110
  Dump of assembler code for function SUBRP:
     0x010f3110 <+0>:     push   %ebp
     0x010f3111 <+1>:     mov    %esp,%ebp
     0x010f3113 <+3>:     sub    $0x8,%esp
     0x010f3116 <+6>:     movl   $0xa,0x4(%esp)
     0x010f311e <+14>:    mov    0x8(%ebp),%eax
     0x010f3121 <+17>:    mov    %eax,(%esp)
     0x010f3124 <+20>:    call   0x10f306f <PSEUDOVECTORP>
     0x010f3129 <+25>:    leave
     0x010f312a <+26>:    ret
  End of assembler dump.
  (gdb) disassemble 'lisp.h'::SUBRP
  Dump of assembler code for function SUBRP:
     0x010f3110 <+0>:     push   %ebp
     0x010f3111 <+1>:     mov    %esp,%ebp
     0x010f3113 <+3>:     sub    $0x8,%esp
     0x010f3116 <+6>:     movl   $0xa,0x4(%esp)
     0x010f311e <+14>:    mov    0x8(%ebp),%eax
     0x010f3121 <+17>:    mov    %eax,(%esp)
     0x010f3124 <+20>:    call   0x10f306f <PSEUDOVECTORP>
     0x010f3129 <+25>:    leave
     0x010f312a <+26>:    ret
  End of assembler dump.

But:

  (gdb) disassemble /m 0x10f3110
  Dump of assembler code for function SUBRP:
  End of assembler dump.
  (gdb) disassemble /m 0x10f3110,+30
  Dump of assembler code from 0x10f3110 to 0x10f312e:
  End of assembler dump.
  (gdb) disassemble /m 'lisp.h'::SUBRP
  Dump of assembler code for function SUBRP:
  End of assembler dump.
  (gdb)

IOW, the /m switch somehow inhibits the disassembly.  FWIW, using x/i
for the respective addresses shows the instructions just fine.

Is this a bug?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: "disassemble" shows code, but not with /m
  2014-03-19 17:50 "disassemble" shows code, but not with /m Eli Zaretskii
@ 2014-03-19 18:45 ` Jan Kratochvil
  2014-03-19 19:04   ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2014-03-19 18:45 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb

On Wed, 19 Mar 2014 18:50:22 +0100, Eli Zaretskii wrote:
> IOW, the /m switch somehow inhibits the disassembly.

The /m switch is broken for -O2 -g code even if it prints something:
	disassemble/m should be PC-driven, not source line driven
	http://sourceware.org/bugzilla/show_bug.cgi?id=11833

Use objdump -dS in these cases - that one works
(although I prefer rather objdump -dl for -O2 -g cases).

/m is dependent on .debug_line which I guess is not right in your inferior.


Jan


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: "disassemble" shows code, but not with /m
  2014-03-19 18:45 ` Jan Kratochvil
@ 2014-03-19 19:04   ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2014-03-19 19:04 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb

> Date: Wed, 19 Mar 2014 19:45:06 +0100
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: gdb@sourceware.org
> 
> On Wed, 19 Mar 2014 18:50:22 +0100, Eli Zaretskii wrote:
> > IOW, the /m switch somehow inhibits the disassembly.
> 
> The /m switch is broken for -O2 -g code even if it prints something:

That executable is compiled with -O0, not -O2.  Sorry I didn't mention
that.

Also, the /m switch does work for functions not declared inline in the
same executable.

> 	http://sourceware.org/bugzilla/show_bug.cgi?id=11833

That bug does not show such a complete failure to disassembly that I
experienced.

> Use objdump -dS in these cases - that one works
> (although I prefer rather objdump -dl for -O2 -g cases).

Thanks for the tip.

> /m is dependent on .debug_line which I guess is not right in your inferior.

Why not? it has DWARF2 debug info.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-19 19:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-19 17:50 "disassemble" shows code, but not with /m Eli Zaretskii
2014-03-19 18:45 ` Jan Kratochvil
2014-03-19 19:04   ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox