Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* What about add a interface to output the assembly codes follow   inferior execution
@ 2009-03-03  3:11 teawater
  2009-03-03 16:42 ` Doug Evans
  0 siblings, 1 reply; 19+ messages in thread
From: teawater @ 2009-03-03  3:11 UTC (permalink / raw)
  To: gdb ml

Hi guys,

I am not sure gdb have a interface to output assembly codes except
"disassemble".
Maybe gdb can support a interface can output assembly codes of next
part of code.

For example:
#If exec-disassemble set to auto, just output assembly codes if there
is not line message.
#It will be the default value.
(gdb) set exec-disassemble auto
(gdb) si
0x080483ee	24		b = printf ("a = %d b = %d c = %d\n", a, b, c);
(gdb) si
0x080482d8 in printf@plt ()
Current language:  auto; currently asm
0x080482d8 <printf@plt+0>:	jmp    *0x8049670
(gdb) si
0x080482de in printf@plt ()
0x080482de <printf@plt+6>:	push   $0x10

#If exec-disassemble set to on, gdb will always output assembly codes.
(gdb) set exec-disassemble on
(gdb) n
26		printf ("a = %d b = %d c = %d\n", a, b, c);
 80483fe:	8b 15 84 96 04 08    	mov    0x8049684,%edx
 8048404:	8b 45 f4             	mov    -0xc(%ebp),%eax
 8048407:	89 44 24 0c          	mov    %eax,0xc(%esp)
 804840b:	8b 45 f8             	mov    -0x8(%ebp),%eax
 804840e:	89 44 24 08          	mov    %eax,0x8(%esp)
 8048412:	89 54 24 04          	mov    %edx,0x4(%esp)
 8048416:	c7 04 24 58 85 04 08 	movl   $0x8048558,(%esp)
 804841d:	e8 b6 fe ff ff       	call   80482d8 <printf@plt>

#If exec-disassemble set to off, gdb will work like before.
(gdb) set exec-disassemble off


What do you think about it?


Thanks,
Hui


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

* Re: What about add a interface to output the assembly codes follow   inferior execution
  2009-03-03  3:11 What about add a interface to output the assembly codes follow inferior execution teawater
@ 2009-03-03 16:42 ` Doug Evans
  2009-03-03 17:04   ` Daniel Jacobowitz
  0 siblings, 1 reply; 19+ messages in thread
From: Doug Evans @ 2009-03-03 16:42 UTC (permalink / raw)
  To: teawater; +Cc: gdb ml

On Mon, Mar 2, 2009 at 7:10 PM, teawater <teawater@gmail.com> wrote:
> Hi guys,
>
> I am not sure gdb have a interface to output assembly codes except
> "disassemble".
> Maybe gdb can support a interface can output assembly codes of next
> part of code.
>
> For example:
> #If exec-disassemble set to auto, just output assembly codes if there
> is not line message.
> #It will be the default value.
> (gdb) set exec-disassemble auto
> (gdb) si
> 0x080483ee      24              b = printf ("a = %d b = %d c = %d\n", a, b, c);
> (gdb) si
> 0x080482d8 in printf@plt ()
> Current language:  auto; currently asm
> 0x080482d8 <printf@plt+0>:      jmp    *0x8049670
> (gdb) si
> 0x080482de in printf@plt ()
> 0x080482de <printf@plt+6>:      push   $0x10
>
> #If exec-disassemble set to on, gdb will always output assembly codes.
> (gdb) set exec-disassemble on
> (gdb) n
> 26              printf ("a = %d b = %d c = %d\n", a, b, c);
>  80483fe:       8b 15 84 96 04 08       mov    0x8049684,%edx
>  8048404:       8b 45 f4                mov    -0xc(%ebp),%eax
>  8048407:       89 44 24 0c             mov    %eax,0xc(%esp)
>  804840b:       8b 45 f8                mov    -0x8(%ebp),%eax
>  804840e:       89 44 24 08             mov    %eax,0x8(%esp)
>  8048412:       89 54 24 04             mov    %edx,0x4(%esp)
>  8048416:       c7 04 24 58 85 04 08    movl   $0x8048558,(%esp)
>  804841d:       e8 b6 fe ff ff          call   80482d8 <printf@plt>
>
> #If exec-disassemble set to off, gdb will work like before.
> (gdb) set exec-disassemble off
>
>
> What do you think about it?

Are you looking for behaviour different than what "disp/8i $pc" would give you?


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

* Re: What about add a interface to output the assembly codes follow  inferior execution
  2009-03-03 16:42 ` Doug Evans
@ 2009-03-03 17:04   ` Daniel Jacobowitz
  2009-03-04  2:29     ` teawater
  0 siblings, 1 reply; 19+ messages in thread
From: Daniel Jacobowitz @ 2009-03-03 17:04 UTC (permalink / raw)
  To: Doug Evans; +Cc: teawater, gdb ml

On Tue, Mar 03, 2009 at 08:41:53AM -0800, Doug Evans wrote:
> Are you looking for behaviour different than what "disp/8i $pc" would give you?

I often run with display/i $pc.  But I think the 'auto' setting is a
nice idea; it's when I don't have source code that this is most useful.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: What about add a interface to output the assembly codes follow   inferior execution
  2009-03-03 17:04   ` Daniel Jacobowitz
@ 2009-03-04  2:29     ` teawater
  2009-03-04  4:09       ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: teawater @ 2009-03-04  2:29 UTC (permalink / raw)
  To: Doug Evans, Daniel Jacobowitz; +Cc: gdb ml

Hi Doug and Daniel,

Thanks for your reply.

I think I didn't talk clear of my idea.
When exec-disassemble is on,
If the $pc doesn't have the line message, gdb will output the assembly
code for $pc.
If the $pc has the line message, gdb will output the assembly codes of
this line.

For example:
(gdb) set exec-disassemble on
(gdb) n
26              printf ("a = %d b = %d c = %d\n", a, b, c);
 80483fe:       8b 15 84 96 04 08       mov    0x8049684,%edx
 8048404:       8b 45 f4                mov    -0xc(%ebp),%eax
 8048407:       89 44 24 0c             mov    %eax,0xc(%esp)
 804840b:       8b 45 f8                mov    -0x8(%ebp),%eax
 804840e:       89 44 24 08             mov    %eax,0x8(%esp)
 8048412:       89 54 24 04             mov    %edx,0x4(%esp)
 8048416:       c7 04 24 58 85 04 08    movl   $0x8048558,(%esp)
 804841d:       e8 b6 fe ff ff          call   80482d8 <printf@plt>
This assembly codes is for line 26 printf ("a = %d b = %d c = %d\n", a, b, c);

(gdb) n
21	       int     c = 1;
80483c8:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
This assembly codes is for line 21 int     c = 1;

It will make user clear what instructions will be execute in next line.



The "disp/8i $pc" just can output 8 instructions, even if the next
line just have 1 instruction.
For example:
(gdb) n
21	       int     c = 1;
1: x/8i $pc
0x80483c8 <main+24>:	movl   $0x1,-0xc(%ebp)
0x80483cf <main+31>:	mov    0x8049684,%edx
0x80483d5 <main+37>:	mov    -0xc(%ebp),%eax
0x80483d8 <main+40>:	mov    %eax,0xc(%esp)
0x80483dc <main+44>:	mov    -0x8(%ebp),%eax
0x80483df <main+47>:	mov    %eax,0x8(%esp)
0x80483e3 <main+51>:	mov    %edx,0x4(%esp)
0x80483e7 <main+55>:	movl   $0x8048558,(%esp)
Just 1 line for line 21.


Thanks,
Hui



On Wed, Mar 4, 2009 at 01:04, Daniel Jacobowitz <drow@false.org> wrote:
> On Tue, Mar 03, 2009 at 08:41:53AM -0800, Doug Evans wrote:
>> Are you looking for behaviour different than what "disp/8i $pc" would give you?
>
> I often run with display/i $pc.  But I think the 'auto' setting is a
> nice idea; it's when I don't have source code that this is most useful.
>
> --
> Daniel Jacobowitz
> CodeSourcery
>


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

* Re: What about add a interface to output the assembly codes follow inferior execution
  2009-03-04  2:29     ` teawater
@ 2009-03-04  4:09       ` Eli Zaretskii
  2009-03-04  5:30         ` teawater
  0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2009-03-04  4:09 UTC (permalink / raw)
  To: teawater; +Cc: dje, drow, gdb

> Date: Wed, 4 Mar 2009 10:28:48 +0800
> From: teawater <teawater@gmail.com>
> Cc: gdb ml <gdb@sourceware.org>
> 
> When exec-disassemble is on,
> If the $pc doesn't have the line message, gdb will output the assembly
> code for $pc.
> If the $pc has the line message, gdb will output the assembly codes of
> this line.

I think this is a useful feature, but we need a better name for it.
Something like show-opcodes, for example.


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

* Re: What about add a interface to output the assembly codes follow   inferior execution
  2009-03-04  4:09       ` Eli Zaretskii
@ 2009-03-04  5:30         ` teawater
  2009-03-04 17:15           ` Doug Evans
  0 siblings, 1 reply; 19+ messages in thread
From: teawater @ 2009-03-04  5:30 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: dje, drow, gdb

Thanks Eli.

I think "show-opcodes" is very good.  :)

Hui

On Wed, Mar 4, 2009 at 12:08, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Wed, 4 Mar 2009 10:28:48 +0800
>> From: teawater <teawater@gmail.com>
>> Cc: gdb ml <gdb@sourceware.org>
>>
>> When exec-disassemble is on,
>> If the $pc doesn't have the line message, gdb will output the assembly
>> code for $pc.
>> If the $pc has the line message, gdb will output the assembly codes of
>> this line.
>
> I think this is a useful feature, but we need a better name for it.
> Something like show-opcodes, for example.
>


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

* Re: What about add a interface to output the assembly codes follow   inferior execution
  2009-03-04  5:30         ` teawater
@ 2009-03-04 17:15           ` Doug Evans
  2009-03-04 19:09             ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: Doug Evans @ 2009-03-04 17:15 UTC (permalink / raw)
  To: teawater; +Cc: Eli Zaretskii, drow, gdb

On Tue, Mar 3, 2009 at 9:30 PM, teawater <teawater@gmail.com> wrote:
> Thanks Eli.
>
> I think "show-opcodes" is very good.  :)
>
> Hui
> - Show quoted text -
> On Wed, Mar 4, 2009 at 12:08, Eli Zaretskii <eliz@gnu.org> wrote:
>>> Date: Wed, 4 Mar 2009 10:28:48 +0800
>>> From: teawater <teawater@gmail.com>
>>> Cc: gdb ml <gdb@sourceware.org>
>>>
>>> When exec-disassemble is on,
>>> If the $pc doesn't have the line message, gdb will output the assembly
>>> code for $pc.
>>> If the $pc has the line message, gdb will output the assembly codes of
>>> this line.
>>
>> I think this is a useful feature, but we need a better name for it.
>> Something like show-opcodes, for example.

Thanks for explaining it more clearly.

Having another word for "disassembly" seems clumsy though. ["apropos
opcodes" doesn't print anything today]
Plus to a new user the intent of the option is a bit vague.
"disassemble-next-line" ? [that has a lot to type to become
unambiguous, but it's not something the user would presumably type
often, if not in .gdbinit or some such]

Also, the user might want to set a limit on the number of lines of
disassembly displayed.
If cut short gdb could print "[output cut short due to `set
dissemble-next-line-max 10']" (or some such).

For debugging optimized code, maybe it'd be nice if gdb determined
there were more (discontiguous) lines of disassembly to display for
the current source line and notified the user (by printing
"discontiguous source line" or some such) before and/or after the
output.


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

* Re: What about add a interface to output the assembly codes follow inferior execution
  2009-03-04 17:15           ` Doug Evans
@ 2009-03-04 19:09             ` Eli Zaretskii
  2009-03-04 19:20               ` Pedro Alves
                                 ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Eli Zaretskii @ 2009-03-04 19:09 UTC (permalink / raw)
  To: Doug Evans; +Cc: teawater, drow, gdb

> Date: Wed, 4 Mar 2009 09:15:30 -0800
> From: Doug Evans <dje@google.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, drow@false.org, gdb@sourceware.org
> 
> Having another word for "disassembly" seems clumsy though. ["apropos
> opcodes" doesn't print anything today]

"apropos" searches the first lines of the doc strings, not only the
command names.  So if we document the new commands like this:

  show-opcodes -- display disassembly of next line with each prompt

"apropos disassembly" will find that as well.  Does that solve your
problem with the name I suggested?

> Plus to a new user the intent of the option is a bit vague.
> "disassemble-next-line" ? [that has a lot to type to become
> unambiguous

Right, I thought about something that begins with "disassemble", but
didn't want to shoot our completion habits in the foot, since
currently typing just "disas TAB" is all I need to get disassembly.


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

* Re: What about add a interface to output the assembly codes follow inferior execution
  2009-03-04 19:09             ` Eli Zaretskii
@ 2009-03-04 19:20               ` Pedro Alves
  2009-03-04 22:10                 ` Eli Zaretskii
  2009-03-04 19:24               ` Doug Evans
  2009-03-04 19:26               ` Daniel Jacobowitz
  2 siblings, 1 reply; 19+ messages in thread
From: Pedro Alves @ 2009-03-04 19:20 UTC (permalink / raw)
  To: gdb, Eli Zaretskii; +Cc: Doug Evans, teawater, drow

On Wednesday 04 March 2009 19:08:53, Eli Zaretskii wrote:
>   show-opcodes -- display disassembly of next line with each prompt
> 

Operation codes and disassembly are different things aren't they?

show-opcodes suggests to me that we're doing to show raw, numeric
opcodes, which IIUC, is not what is being suggested.

"disassembly" suggests to me that we're doing to show
assembly mneumonics, which I thought was what is being proposed.

-- 
Pedro Alves


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

* Re: What about add a interface to output the assembly codes follow   inferior execution
  2009-03-04 19:09             ` Eli Zaretskii
  2009-03-04 19:20               ` Pedro Alves
@ 2009-03-04 19:24               ` Doug Evans
  2009-03-04 19:26               ` Daniel Jacobowitz
  2 siblings, 0 replies; 19+ messages in thread
From: Doug Evans @ 2009-03-04 19:24 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: teawater, drow, gdb

On Wed, Mar 4, 2009 at 11:08 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Wed, 4 Mar 2009 09:15:30 -0800
>> From: Doug Evans <dje@google.com>
>> Cc: Eli Zaretskii <eliz@gnu.org>, drow@false.org, gdb@sourceware.org
>>
>> Having another word for "disassembly" seems clumsy though. ["apropos
>> opcodes" doesn't print anything today]
>
> "apropos" searches the first lines of the doc strings, not only the
> command names.  So if we document the new commands like this:
>
>  show-opcodes -- display disassembly of next line with each prompt
>
> "apropos disassembly" will find that as well.  Does that solve your
> problem with the name I suggested?

To be honest it doesn't.
The point about apropos wasn't that "apropos disassembly" wouldn't
find show-opcodes, but rather to point out that we don't use "opcodes"
at all.  It doesn't even appear in gdb.texinfo.  Why not use
"disassemble" when disassemble is what we mean?

[I'd also hate to see a user type "apropos show" while trying to find
show-opcodes.  1/2 :-)]

>
>> Plus to a new user the intent of the option is a bit vague.
>> "disassemble-next-line" ? [that has a lot to type to become
>> unambiguous
>
> Right, I thought about something that begins with "disassemble", but
> didn't want to shoot our completion habits in the foot, since
> currently typing just "disas TAB" is all I need to get disassembly.
>

But users type disas a lot.   I wouldn't expect them to type `set
disassemble-next-line foo' very much at all.


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

* Re: What about add a interface to output the assembly codes follow  inferior execution
  2009-03-04 19:09             ` Eli Zaretskii
  2009-03-04 19:20               ` Pedro Alves
  2009-03-04 19:24               ` Doug Evans
@ 2009-03-04 19:26               ` Daniel Jacobowitz
  2009-03-04 19:32                 ` Pedro Alves
  2009-03-04 23:41                 ` Tom Tromey
  2 siblings, 2 replies; 19+ messages in thread
From: Daniel Jacobowitz @ 2009-03-04 19:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Doug Evans, teawater, gdb

On Wed, Mar 04, 2009 at 09:08:53PM +0200, Eli Zaretskii wrote:
> > Plus to a new user the intent of the option is a bit vague.
> > "disassemble-next-line" ? [that has a lot to type to become
> > unambiguous
> 
> Right, I thought about something that begins with "disassemble", but
> didn't want to shoot our completion habits in the foot, since
> currently typing just "disas TAB" is all I need to get disassembly.

I agree we don't want to change that binding (I use it all the time).
But is it a problem?  This would be under set, if I understand right.

(Another thing that would be useful, perhaps, is a modifier to 'x/i' to
say "a line's worth of instructions".  But I think we'd have a lot of
trouble finding a non-ambiguous command for that.)

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: What about add a interface to output the assembly codes follow  inferior execution
  2009-03-04 19:26               ` Daniel Jacobowitz
@ 2009-03-04 19:32                 ` Pedro Alves
  2009-03-04 21:25                   ` Doug Evans
  2009-03-04 23:41                 ` Tom Tromey
  1 sibling, 1 reply; 19+ messages in thread
From: Pedro Alves @ 2009-03-04 19:32 UTC (permalink / raw)
  To: gdb; +Cc: Daniel Jacobowitz, Eli Zaretskii, Doug Evans, teawater

On Wednesday 04 March 2009 19:26:47, Daniel Jacobowitz wrote:
> (Another thing that would be useful, perhaps, is a modifier to 'x/i' to
> say "a line's worth of instructions".  But I think we'd have a lot of
> trouble finding a non-ambiguous command for that.)
> 

I was thinking the same, while noticing that the
"disassemble" command also doesn't allow a line number or line
number range.

Did I mention already that with the TUI one can see disassembly
and source code at the same time easily ? :-)

-- 
Pedro Alves


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

* Re: What about add a interface to output the assembly codes follow   inferior execution
  2009-03-04 19:32                 ` Pedro Alves
@ 2009-03-04 21:25                   ` Doug Evans
  2009-03-04 22:14                     ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: Doug Evans @ 2009-03-04 21:25 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb, Daniel Jacobowitz, Eli Zaretskii, teawater

On Wed, Mar 4, 2009 at 11:32 AM, Pedro Alves <pedro@codesourcery.com> wrote:
> On Wednesday 04 March 2009 19:26:47, Daniel Jacobowitz wrote:
>> (Another thing that would be useful, perhaps, is a modifier to 'x/i' to
>> say "a line's worth of instructions".  But I think we'd have a lot of
>> trouble finding a non-ambiguous command for that.)
>>
>
> I was thinking the same, while noticing that the
> "disassemble" command also doesn't allow a line number or line
> number range.
>
> Did I mention already that with the TUI one can see disassembly
> and source code at the same time easily ? :-)

Ya, extending the disassemble command makes sense to me.


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

* Re: What about add a interface to output the assembly codes follow inferior execution
  2009-03-04 19:20               ` Pedro Alves
@ 2009-03-04 22:10                 ` Eli Zaretskii
  0 siblings, 0 replies; 19+ messages in thread
From: Eli Zaretskii @ 2009-03-04 22:10 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb, dje, teawater, drow

> From: Pedro Alves <pedro@codesourcery.com>
> Date: Wed, 4 Mar 2009 19:20:50 +0000
> Cc: Doug Evans <dje@google.com>,
>  teawater@gmail.com,
>  drow@false.org
> 
> show-opcodes suggests to me that we're doing to show raw, numeric
> opcodes, which IIUC, is not what is being suggested.
> 
> "disassembly" suggests to me that we're doing to show
> assembly mneumonics, which I thought was what is being proposed.

Actually, what was suggested does both:

    26              printf ("a = %d b = %d c = %d\n", a, b, c);
     80483fe:       8b 15 84 96 04 08       mov    0x8049684,%edx
     8048404:       8b 45 f4                mov    -0xc(%ebp),%eax
     8048407:       89 44 24 0c             mov    %eax,0xc(%esp)
     804840b:       8b 45 f8                mov    -0x8(%ebp),%eax
     804840e:       89 44 24 08             mov    %eax,0x8(%esp)
     8048412:       89 54 24 04             mov    %edx,0x4(%esp)
     8048416:       c7 04 24 58 85 04 08    movl   $0x8048558,(%esp)
     804841d:       e8 b6 fe ff ff          call   80482d8 <printf@plt>
    This assembly codes is for line 26 printf ("a = %d b = %d c = %d\n", a, b, c);


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

* Re: What about add a interface to output the assembly codes follow inferior execution
  2009-03-04 21:25                   ` Doug Evans
@ 2009-03-04 22:14                     ` Eli Zaretskii
  2009-03-04 22:20                       ` Pedro Alves
  2009-03-04 22:31                       ` Doug Evans
  0 siblings, 2 replies; 19+ messages in thread
From: Eli Zaretskii @ 2009-03-04 22:14 UTC (permalink / raw)
  To: Doug Evans; +Cc: pedro, gdb, drow, teawater

> Date: Wed, 4 Mar 2009 13:25:05 -0800
> From: Doug Evans <dje@google.com>
> Cc: gdb@sourceware.org, Daniel Jacobowitz <drow@false.org>,         Eli Zaretskii <eliz@gnu.org>, teawater@gmail.com
> 
> Ya, extending the disassemble command makes sense to me.

I don't see how it can make sense that the same command does both
one-time disassembly and disassemble the next source line each time
GDB stops.  It's like "print" and "display" -- it's not an accident we
have 2 different commands there.

If anything, extending "display" with yet another format specifier, or
maybe a qualifier for /i, would make much more sense to me.


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

* Re: What about add a interface to output the assembly codes follow inferior execution
  2009-03-04 22:14                     ` Eli Zaretskii
@ 2009-03-04 22:20                       ` Pedro Alves
  2009-03-04 22:31                       ` Doug Evans
  1 sibling, 0 replies; 19+ messages in thread
From: Pedro Alves @ 2009-03-04 22:20 UTC (permalink / raw)
  To: gdb, Eli Zaretskii; +Cc: Doug Evans, drow, teawater

On Wednesday 04 March 2009 22:14:32, Eli Zaretskii wrote:
> > Date: Wed, 4 Mar 2009 13:25:05 -0800
> > From: Doug Evans <dje@google.com>
> > Cc: gdb@sourceware.org, Daniel Jacobowitz <drow@false.org>,         Eli Zaretskii <eliz@gnu.org>, teawater@gmail.com
> > 
> > Ya, extending the disassemble command makes sense to me.
> 
> I don't see how it can make sense that the same command does both
> one-time disassembly and disassemble the next source line each time
> GDB stops.  It's like "print" and "display" -- it's not an accident we
> have 2 different commands there.

Certainly.  I was just pointing out that the "disassembly"
command could have said option.  I had a hook-stop in mind --- if it
had such an option already, the user could could just set a hook-stop
to show the disassembly of the current source line.

> If anything, extending "display" with yet another format specifier, or
> maybe a qualifier for /i, would make much more sense to me.

Of course, I don't disagree.  Daniel surely mentioned "x/i", because
"display" takes the exact same formats as the "x" command does.

-- 
Pedro Alves


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

* Re: What about add a interface to output the assembly codes follow   inferior execution
  2009-03-04 22:14                     ` Eli Zaretskii
  2009-03-04 22:20                       ` Pedro Alves
@ 2009-03-04 22:31                       ` Doug Evans
  1 sibling, 0 replies; 19+ messages in thread
From: Doug Evans @ 2009-03-04 22:31 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: pedro, gdb, drow, teawater

On Wed, Mar 4, 2009 at 2:14 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Wed, 4 Mar 2009 13:25:05 -0800
>> From: Doug Evans <dje@google.com>
>> Cc: gdb@sourceware.org, Daniel Jacobowitz <drow@false.org>,         Eli Zaretskii <eliz@gnu.org>, teawater@gmail.com
>>
>> Ya, extending the disassemble command makes sense to me.
>
> I don't see how it can make sense that the same command does both
> one-time disassembly and disassemble the next source line each time
> GDB stops.  It's like "print" and "display" -- it's not an accident we
> have 2 different commands there.

I was not suggesting extending the disassemble command to handle the
specifying of source lines as a way to address the issue being
addressed by "set disassemble-next-line|show-opcodes foo".  [One could
use the stop hook, but that gets tricky if one wants to start doing
multiple things in the stop hook.]  I was merely saying that extending
the disassemble command to handle source lines is A Good Thing.

>
> If anything, extending "display" with yet another format specifier, or
> maybe a qualifier for /i, would make much more sense to me.
>

That would be another way to go instead of
disassemble-next-line|show-opcodes, yes.


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

* Re: What about add a interface to output the assembly codes follow  inferior execution
  2009-03-04 19:26               ` Daniel Jacobowitz
  2009-03-04 19:32                 ` Pedro Alves
@ 2009-03-04 23:41                 ` Tom Tromey
  2009-03-05  2:42                   ` teawater
  1 sibling, 1 reply; 19+ messages in thread
From: Tom Tromey @ 2009-03-04 23:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Doug Evans, teawater, gdb

>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:

>> Right, I thought about something that begins with "disassemble", but
>> didn't want to shoot our completion habits in the foot, since
>> currently typing just "disas TAB" is all I need to get disassembly.

Daniel> I agree we don't want to change that binding (I use it all the time).
Daniel> But is it a problem?  This would be under set, if I understand right.

Yeah, this sounds reasonable to me.
I'd prefer to have some word like "disassemble" in the parameter name.

Tom


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

* Re: What about add a interface to output the assembly codes follow   inferior execution
  2009-03-04 23:41                 ` Tom Tromey
@ 2009-03-05  2:42                   ` teawater
  0 siblings, 0 replies; 19+ messages in thread
From: teawater @ 2009-03-05  2:42 UTC (permalink / raw)
  To: tromey, Eli Zaretskii, Doug Evans, Pedro Alves, Daniel Jacobowitz; +Cc: gdb ml

Thanks guys,

For the people that want extend disassemble:
Output assembly codes of next-line is just one part of this idea.

We still have another part:
1. Auto mode, output assembly codes only if there is not line message
for current pc.
For example:
(gdb) si
0x080483ee      24              b = printf ("a = %d b = %d c = %d\n", a, b, c);
(gdb) si
0x080482d8 in printf@plt ()
Current language:  auto; currently asm
0x080482d8 <printf@plt+0>:      jmp    *0x8049670
(gdb) si
0x080482de in printf@plt ()
0x080482de <printf@plt+6>:      push   $0x10

I think maybe is can be default option of gdb.  Add it to display with itself?


2. Output assembly codes number limit.
This idea form Doug:
Also, the user might want to set a limit on the number of lines of
disassembly displayed.
If cut short gdb could print "[output cut short due to `set
dissemble-next-line-max 10']" (or some such).

I think maybe it need output something like "This message is cut ...
you can set it with ...".


3. Special for optimized code.
This idea form Doug too:
For debugging optimized code, maybe it'd be nice if gdb determined
there were more (discontiguous) lines of disassembly to display for
the current source line and notified the user (by printing
"discontiguous source line" or some such) before and/or after the
output.



I think maybe is too much thing for disassemble.



Thanks,
Hui



On Thu, Mar 5, 2009 at 07:40, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:
>
>>> Right, I thought about something that begins with "disassemble", but
>>> didn't want to shoot our completion habits in the foot, since
>>> currently typing just "disas TAB" is all I need to get disassembly.
>
> Daniel> I agree we don't want to change that binding (I use it all the time).
> Daniel> But is it a problem?  This would be under set, if I understand right.
>
> Yeah, this sounds reasonable to me.
> I'd prefer to have some word like "disassemble" in the parameter name.
>
> Tom
>


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

end of thread, other threads:[~2009-03-05  2:42 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-03  3:11 What about add a interface to output the assembly codes follow inferior execution teawater
2009-03-03 16:42 ` Doug Evans
2009-03-03 17:04   ` Daniel Jacobowitz
2009-03-04  2:29     ` teawater
2009-03-04  4:09       ` Eli Zaretskii
2009-03-04  5:30         ` teawater
2009-03-04 17:15           ` Doug Evans
2009-03-04 19:09             ` Eli Zaretskii
2009-03-04 19:20               ` Pedro Alves
2009-03-04 22:10                 ` Eli Zaretskii
2009-03-04 19:24               ` Doug Evans
2009-03-04 19:26               ` Daniel Jacobowitz
2009-03-04 19:32                 ` Pedro Alves
2009-03-04 21:25                   ` Doug Evans
2009-03-04 22:14                     ` Eli Zaretskii
2009-03-04 22:20                       ` Pedro Alves
2009-03-04 22:31                       ` Doug Evans
2009-03-04 23:41                 ` Tom Tromey
2009-03-05  2:42                   ` teawater

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