[lldb-dev] What's the best way to use "--all-files" option from python?

Jim Ingham via lldb-dev lldb-dev at lists.llvm.org
Mon Oct 23 18:25:22 PDT 2017


Yeah, that would be easy to implement from the command line, maybe add a --file-is-regex flag or something.  

>From the SB API it would be better to have something like:

SBFileList SBTarget.GetFileListMatchingRegex("regex")

Please file an enhancement request for these of hack'em in if you're so motivated.

Jim


> On Oct 23, 2017, at 6:13 PM, Don Hinton <hintonda at gmail.com> wrote:
> 
> Ah, great, thanks.  I just figured the default was the same for both.
> 
> Just wish I could use a regex for the filename as well, which would cut down the number of files about about half.
> 
> thanks again...
> don
> 
> On Mon, Oct 23, 2017 at 6:02 PM, Jim Ingham <jingham at apple.com> wrote:
> Just pass an invalid FileSpec for the source file spec, like:
> 
> lldb.target.BreakpointCreateBySourceRegex("printf", lldb.SBFileSpec())
> 
> and it acts the same way as the --all-files option.  That was pretty non-obvious, I'll update the docs.
> 
> Actually, the thing you CAN'T do is get the command line behavior where lldb uses the "default file" i.e. when you run "break set -p" but don't supply a file or the --all-files option.  That seemed to me less useful for a programming interface since the default file is history dependent (it's the file with "main" in it before you run, then it's where you last set a breakpoint, or where you last stopped, etc.)  If you needed this behavior it would be better to have the target vend the default file, though right now that's really only maintained by the breakpoint command...
> 
> Jim
> 
> 
> > On Oct 23, 2017, at 5:31 PM, Don Hinton via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> >
> > The only way I've been able to do it is by using the CommandInterpreter, i.e.,
> >
> >   res = lldb.SBCommandReturnObject()
> >   lldb.debugger.GetCommandInterpreter().HandleCommand('breakpoint set -p "diag::%s" --all-files -N %s' % (name, name), res);
> >   lldb.debugger.GetCommandInterpreter().HandleCommand('breakpoint disable %s' % name, res);
> >
> > Is this the best way to do it?  Can't seem to figure out how to use SBTarget.BreakpointCreateBySourceRegex() for all files.
> >
> > thanks...
> > don
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
> 
> 



More information about the lldb-dev mailing list