Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Skip next n breakpoints in lldb

Tags:

python

xcode

lldb

In gdb I could skip next n breakpoints by "continue n", or skip next n lines by "next n". What's the equivalents in lldb?

And if there was none, how could I create them myself in lldb python extension? I tried something like this, but it didn't work, lldb hangs when I type the command I added.

def cc(debugger, args, result, dict):
    target = debugger.GetSelectedTarget()
    process = target.GetProcess()
    process.Continue()
like image 766
Rick Avatar asked Mar 09 '13 05:03

Rick


1 Answers

The process continue command accepts a -i option which will ignore the next i matches for the breakpoint you're currently stopped at on the current thread. e.g.

Process 13559 stopped
* thread #1: tid = 0xb7da5, 0x0000000100000f21 a.out`main + 49 at a.c:7, stop reason = breakpoint 2.1
    #0: 0x0000000100000f21 a.out`main + 49 at a.c:7
   4        int i;
   5        for (i = 0; i < 100; i++)
   6        {
-> 7            printf ("%d\n", i);
   8        }
   9    }
(lldb) c -i 5
Process 13559 resuming
0
1
2
3
4
5
Process 13559 stopped
* thread #1: tid = 0xb7da5, 0x0000000100000f21 a.out`main + 49 at a.c:7, stop reason = breakpoint 2.1
    #0: 0x0000000100000f21 a.out`main + 49 at a.c:7
   4        int i;
   5        for (i = 0; i < 100; i++)
   6        {
-> 7            printf ("%d\n", i);
   8        }
   9    }
(lldb) 

You can also set the ignore-count of a breakpoint directly with breakpoint modify -i count bpnum.

like image 68
Jason Molenda Avatar answered Sep 19 '22 09:09

Jason Molenda