[PATCH] D36347: Add new script to launch lldb and set breakpoints for diagnostics all diagnostics seen.

Jason Molenda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 20 12:45:37 PDT 2017


jasonmolenda added a comment.

Sorry for missing this back in August.

I think it'd be clearer to import your python once in the startup, like

-o "script import $module" \

Multiple imports are a no-op IIUC so it's harmless to re-import the module every time the breakpoint is hit (I'm guessing it's only hit once, for that matter), but I think it's clearer to have this on its own line.

For what it's worth, if you use breakpoint command add -F python-function, your function is passed in the frame as well as the SBBreakpointLocation.  See 'help breakpoint add' for more information about this; I used this in a breakpoint python command I wrote a while back,

def handle_pthread_create_return(frame, bp_loc, dict):

  global pthreads_being_created
  
  thread_index_id = frame.GetThread().GetIndexID()

[...]

it might be a good idea to name the breakpoint you're adding and then you can delete it explicitly, in case the user is doing something unexpected with breakpoints.  e.g.

% ~/k/svn/lldb/build/Debug/lldb /tmp/a.out
(lldb) target create "/tmp/a.out"
Current executable set to '/tmp/a.out' (x86_64).
(lldb) br s -n main -N worker
Breakpoint 1: where = a.out`main, address = 0x0000000100000ec0
(lldb) br del worker
1 breakpoints deleted; 0 breakpoint locations disabled.
(lldb) br li
No breakpoints currently set.
(lldb)


https://reviews.llvm.org/D36347





More information about the cfe-commits mailing list