Skip Montanaro | 6 Sep 2005 05:06
Picon
Favicon

How to break from loop in gdb command language?

Some time ago I implemented a routine in gdb's command language that mimics
the line number calculation performed by Python's virtual machine.  Not thinking,
I wrote it like so:

define lineno
    set $__co = f->f_code
    set $__lasti = f->f_lasti
    set $__sz = ((PyStringObject *)$__co->co_lnotab)->ob_size/2
    set $__p = (unsigned char *)((PyStringObject *)$__co->co_lnotab)->ob_sval
    set $__li = $__co->co_firstlineno
    set $__ad = 0
    while ($__sz-1 >= 0)
      set $__sz = $__sz - 1
      set $__ad = $__ad + *$__p
      set $__p = $__p + 1
      if ($__ad > $__lasti)
	break
      end
      set $__li = $__li + *$__p
      set $__p = $__p + 1
    end
    printf "%d", $__li
end

This is more-or-less a direct translation of what Python's C code does.

Unfortunately, the C code uses the break statement.  Not being at the
top of my game at the time I forgot that "break" means something
entirely different in GDB's command language than in C.  What's
the equivalent?  Set a flag and test?  What about an equivalent for C's
(Continue reading)

Satendra Pratap | 24 Sep 2005 11:56
Picon

Regarding backtracing through GDB

Hi,

 

I have implemented a remote Stub for sparc.

Implemented commands are: b,c,m,M,X,? and k.

I am not able to backtrace while debugging the remote

Application.

 

Can you please tell me , do I need to implement some more commands

Or Is there any problem in GDB host.

 

When I use bt command, It sends a memory read packet and get the

Content for the address sent , after this it hangs. To return back to GDB prompt

I need to press Ctrl-c twice and It asks for yes and no. If yes then GDB

Quits else hangs on.

 

Thanks,

Satendra

 

_______________________________________________
Gdb mailing list
Gdb <at> gnu.org
http://lists.gnu.org/mailman/listinfo/gdb

Gmane