[lldb-dev] Question about -break-insert in lldb-mi

Ted Woodward via lldb-dev lldb-dev at lists.llvm.org
Tue Jul 12 11:37:11 PDT 2016


It looks like the current implementation expects the -f to be right before the break location. So "-break-insert main" or "-break-insert -t -f main -d" would work, but "-break-insert -t main -f -d" would not.
It also looks as if restricting the breakpoint to the thread id (incorrectly) only works if a condition is set.

>From my reading of the spec at https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Breakpoint-Commands.html , -f should not take a parameter.

--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project


-----Original Message-----
From: Pierson Lee (PIE) [mailto:Pierson.Lee at microsoft.com] 
Sent: Monday, July 11, 2016 3:59 PM
To: Ted Woodward <ted.woodward at codeaurora.org>; jingham at apple.com; 'LLDB' <lldb-dev at lists.llvm.org>
Subject: RE: [lldb-dev] Question about -break-insert in lldb-mi

So the instance I run into the error is setting a conditional breakpoint:

-break-insert -f -c "x==0" main.cpp:13

And I get: 

MI: Error: Command Args. Validation failed. Args missing additional information: f ^error,msg="Command 'break-insert'. Command Args. Validation failed. Args missing additional information: f"

It seems in the tests/examples, -f is the last parameter and the function/code location happens after the -f. 

>From my understanding of the MI Command, the -f is a flag that tells it the breakpoint is to be set as pending if the debugger cannot determine the location of the breakpoint. The optional "parameter" doesn't seem to be used. 

Does this seem like a bug or am I misunderstanding what the -f flag does on -break-insert ?

Thanks
Pierson 

-----Original Message-----
From: Ted Woodward [mailto:ted.woodward at codeaurora.org]
Sent: Monday, July 11, 2016 1:13 PM
To: Pierson Lee (PIE) <Pierson.Lee at microsoft.com>; jingham at apple.com; 'LLDB' <lldb-dev at lists.llvm.org>
Subject: RE: [lldb-dev] Question about -break-insert in lldb-mi

This is what Eclipse does when setting a breakpoint at main on a Hexagon target, before -exec-run:

TX:21-break-insert -t -f main

--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project


-----Original Message-----
From: lldb-dev [mailto:lldb-dev-bounces at lists.llvm.org] On Behalf Of Pierson Lee (PIE) via lldb-dev
Sent: Monday, July 11, 2016 1:33 PM
To: jingham at apple.com
Cc: lldb-dev at lists.llvm.org
Subject: Re: [lldb-dev] Question about -break-insert in lldb-mi

If I don't specify the -f flag (with some random parameter), then a pending breakpoint is not created and the initial binding fails. But if I specify the -f with the random parameter, then it will bind when the library is loaded. This is the behavior I see on gdb also, but sans the random parameter. I looked at the source code and can't figure out what it expects the parameter to be and what it does with the value. 

-----Original Message-----
From: jingham at apple.com [mailto:jingham at apple.com]
Sent: Friday, July 8, 2016 7:03 PM
To: Pierson Lee (PIE) <Pierson.Lee at microsoft.com>
Cc: lldb-dev at lists.llvm.org
Subject: Re: [lldb-dev] Question about -break-insert in lldb-mi


gdb used to try to find a symbol matching the breakpoint specification and if it didn't find one immediately, it would raise an error.  If you didn't want this behavior (in a world with many shared libraries you seldom did) then you could set a "future-break" which is what the -f flag turns on.  This was better though a bit bogus, because it would set the breakpoint the FIRST time it took, then never look again.

But this was quite a while ago, and I think gdb's gotten better about organizing breakpoints.  But I haven't used a modern gdb for a while, so I'm not sure how it works now-a-days.

Anyway, lldb's breakpoints don't work that way.  They stay active till you delete them, and keep searching for new matches every time a shared library is loaded.  You could make them emulate the gdb behavior by judiciously deleting & duplicating breakpoints from the original specification, but there's no way to get the native lldb breakpoints to do so (nor should there be IMHO...)

So if you are using the lldb-mi, there's no reason to bother with the -f flag.  But also lldb-mi should probably just ignore this flag.

Jim
 

> On Jul 8, 2016, at 5:58 PM, Pierson Lee (PIE) via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> 
> Hi,
>  
> I’m trying to use -break-insert and the -f flag for it. 
>  
> I noticed in MICmdCmdBreak.cpp , in CmICmdCmdBreakInsert::ParseArgs() that the -f has a required parameter.
>  
>     m_setCmdArgs.Add(new CMICmdArgValOptionShort(m_constStrArgNamedPendinfBrkPt, false, true,
>                                                    CMICmdArgValListBase::eArgValType_StringQuotedNumberPath, 1));
>  
>  
> Based on the GDB MI documentation (at https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fsourceware.org%2fgdb%2fonlinedocs%2fgdb%2fGDB_002fMI-Breakpoint-Commands.html%23GDB_002fMI-Breakpoint-Commands&data=01%7c01%7cPierson.Lee%40microsoft.com%7c2f7fe625424341c8101908d3a79d5c33%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=vA0kav9epp3zRa4QivQ9wmimjEHYiJ0AiQfJcGKdzEs%3d) for -break-insert shows:
>  
> ‘-f’
> If location cannot be parsed (for example if it refers to unknown files or functions), create a pending breakpoint. Without this flag, gdb will report an error, and won't create a breakpoint, if location cannot be parsed. 
>  
> Is there a reason why it requires a parameter and what should this parameter be ?
>  
> Thanks
> Pierson
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2flists.llvm.org%2fcgi-bin%2fmailman%2flistinfo%2flldb-dev&data=01%7c01%7cPierson.Lee%40microsoft.com%7c2f7fe625424341c8101908d3a79d5c33%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=mCckfTlDjZ8w%2fTvABG6OSj8kZIpC8VeHtjQqHYS8uAk%3d

_______________________________________________
lldb-dev mailing list
lldb-dev at lists.llvm.org
https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2flists.llvm.org%2fcgi-bin%2fmailman%2flistinfo%2flldb-dev&data=01%7c01%7cPierson.Lee%40microsoft.com%7c258410127f594b7d43a308d3a9c7b6a0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=v%2f9dViTplp3Q%2fkzdp6RujCg1B0lRkBUVCJS2wWKw2Bk%3d




More information about the lldb-dev mailing list