Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Re: Why does gdb implement 'next' command with a series of "vCont;s"?
@ 2007-08-01  1:26 congli
  0 siblings, 0 replies; 4+ messages in thread
From: congli @ 2007-08-01  1:26 UTC (permalink / raw)
  To: gdb

I got it. Thanks!

 > GDB does not know what the instructions between here and there do.
 > One of them might be a branch or a function call.
 >
 > --
 > Daniel Jacobowitz
 > CodeSourcery


^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: Why does gdb implement 'next' command with a series of "vCont;s"?
@ 2007-07-30  8:14 congli
  0 siblings, 0 replies; 4+ messages in thread
From: congli @ 2007-07-30  8:14 UTC (permalink / raw)
  To: gdb

There is an error in my example. When I issue a 'next' command at
line 6, the step_range_end should be the first instruction of line 7,
0x8048372, not 804836f.

 >  I have a simple test program (x86 platform), debug it from
 >  a remote machine. First, let the program stop at line 6,
 >  then issue a 'next' command. I have set the 'debug remote'
 >  option, and the command line output is:
 >
 >  6           j = i + 1;
 >  (gdb) n
 >  Sending packet: $m45e2ca,1#8e...Ack
 >  Packet received: 55
 >  Sending packet: $M45e2ca,1:cc#6e...Ack
 >  Packet received: OK
 >  Sending packet: $m8048364,1#3b...Ack
 >  Packet received: c7
 >  Sending packet: $M8048364,1:cc#1b...Ack
 >  Packet received: OK
 >  Sending packet: $m464005,1#fd...Ack
 >  Packet received: 55
 >  Sending packet: $M464005,1:cc#dd...Ack
 >  Packet received: OK
 >  Sending packet: $m496014,1#02...Ack
 >  Packet received: 55
 >  Sending packet: $M496014,1:cc#e2...Ack
 >  Packet received: OK
 >  Sending packet: $vCont;s#b8...Ack
 >  Packet received: T0505:887a80bf;04:607a80bf;08:6e830408;
 >  Sending packet: $vCont;s#b8...Ack
 >  Packet received: T0505:887a80bf;04:607a80bf;08:6f830408;
 >  Sending packet: $vCont;s#b8...Ack
 >  Packet received: T0505:887a80bf;04:607a80bf;08:72830408;
 >  ...
 >
 >  this is the objdump of line 6 and line 7 of my program:
 >
 >     j = i + 1;
 >   804836b:	8b 45 f4             	mov    0xfffffff4(%ebp),%eax
 >   804836e:	40                   	inc    %eax
 >   804836f:	89 45 f8             	mov    %eax,0xfffffff8(%ebp)
 >      k = j + 1;
 >   8048372:	8b 45 f8             	mov    0xfffffff8(%ebp),%eax
 >   8048375:	40                   	inc    %eax
 >   8048376:	89 45 fc             	mov    %eax,0xfffffffc(%ebp)
 >
 >   As you can see, line 6 of my program consists of three assembly
 >   instructions. gdb implements the 'next' command by three "vCont;s",
 >   and stop at the first instruction of line 7, which address is
 >   0x8048372.
 >
 >   My question is, when I issue the 'next' command, gdb already
 >   know the 'step_range_end' is 0x804836f, why not implement the
 >   'next' command by set a breakpoint at 0x804836f and then issue
 >   "vCont;c"? When the program meet the breakpoint at 0x804836f,
 >   we can do a single "vCont;s" to the first instruction of
 >   line 7, 0x8048372.
 >
 >   This implementation of 'next' command will decrease network
 >   traffic and make the command more efficient, especially when
 >   there is a lot of assembly instructions within one C souce line.
 >   But why does gdb take the "vCont;s" method?
 >
 >   Thanks.
 >


^ permalink raw reply	[flat|nested] 4+ messages in thread
* Why does gdb implement 'next' command with a series of "vCont;s"?
@ 2007-07-30  6:40 congli
  2007-07-30 19:47 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: congli @ 2007-07-30  6:40 UTC (permalink / raw)
  To: gdb

I have a simple test program (x86 platform), debug it from
a remote machine. First, let the program stop at line 6,
then issue a 'next' command. I have set the 'debug remote'
option, and the command line output is:

6           j = i + 1;
(gdb) n
Sending packet: $m45e2ca,1#8e...Ack
Packet received: 55
Sending packet: $M45e2ca,1:cc#6e...Ack
Packet received: OK
Sending packet: $m8048364,1#3b...Ack
Packet received: c7
Sending packet: $M8048364,1:cc#1b...Ack
Packet received: OK
Sending packet: $m464005,1#fd...Ack
Packet received: 55
Sending packet: $M464005,1:cc#dd...Ack
Packet received: OK
Sending packet: $m496014,1#02...Ack
Packet received: 55
Sending packet: $M496014,1:cc#e2...Ack
Packet received: OK
Sending packet: $vCont;s#b8...Ack
Packet received: T0505:887a80bf;04:607a80bf;08:6e830408;
Sending packet: $vCont;s#b8...Ack
Packet received: T0505:887a80bf;04:607a80bf;08:6f830408;
Sending packet: $vCont;s#b8...Ack
Packet received: T0505:887a80bf;04:607a80bf;08:72830408;
...

this is the objdump of line 6 and line 7 of my program:

   j = i + 1;
 804836b:	8b 45 f4             	mov    0xfffffff4(%ebp),%eax
 804836e:	40                   	inc    %eax
 804836f:	89 45 f8             	mov    %eax,0xfffffff8(%ebp)
    k = j + 1;
 8048372:	8b 45 f8             	mov    0xfffffff8(%ebp),%eax
 8048375:	40                   	inc    %eax
 8048376:	89 45 fc             	mov    %eax,0xfffffffc(%ebp)

 As you can see, line 6 of my program consists of three assembly
 instructions. gdb implements the 'next' command by three "vCont;s",
 and stop at the first instruction of line 7, which address is
 0x8048372.

 My question is, when I issue the 'next' command, gdb already
 know the 'step_range_end' is 0x804836f, why not implement the
 'next' command by set a breakpoint at 0x804836f and then issue
 "vCont;c"? When the program meet the breakpoint at 0x804836f,
 we can do a single "vCont;s" to the first instruction of
 line 7, 0x8048372.

 This implementation of 'next' command will decrease network
 traffic and make the command more efficient, especially when
 there is a lot of assembly instructions within one C souce line.
 But why does gdb take the "vCont;s" method?

 Thanks.


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

end of thread, other threads:[~2007-08-01  1:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-01  1:26 Why does gdb implement 'next' command with a series of "vCont;s"? congli
  -- strict thread matches above, loose matches on Subject: below --
2007-07-30  8:14 congli
2007-07-30  6:40 congli
2007-07-30 19:47 ` Daniel Jacobowitz

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