This is an archive of the discontinued LLVM Phabricator instance.

[lldb-mi] Fix breakpoints on functions when C++ namespaces are used.
ClosedPublic

Authored by dawn on Jul 21 2015, 2:55 PM.

Details

Summary

The command "-break-insert ns::foo" for function 'foo' in namespace 'ns'
was being parsed as file:function, and the command "-break-insert file:::foo" for global function 'foo' in file 'file' was being parsed as 'file::' + ':' + 'foo'. This patch fixes these cases by adding checks for '::' and ':::'. (Note: '::func' is not parsed correctly by lldb, but that's a different bug...)

Diff Detail

Repository
rL LLVM

Event Timeline

dawn updated this revision to Diff 30289.Jul 21 2015, 2:55 PM
dawn retitled this revision from to [lldb-mi] Fix breakpoints on functions when C++ namespaces are used..
dawn updated this object.
dawn added reviewers: brucem, abidh, ki.stfu.
dawn set the repository for this revision to rL LLVM.
dawn planned changes to this revision.Jul 21 2015, 3:55 PM

This patch isn't quite right as it doesn't handle foo.c:std::string. will post new patch...

dawn updated this revision to Diff 30300.Jul 21 2015, 5:04 PM
dawn added a subscriber: lldb-commits.

This revision fixes the case that we have 'file:ns::func' and enables a test case.

brucem edited edge metadata.Jul 21 2015, 5:35 PM

Could you please add a test for the file: + ::func case?

dawn added a comment.EditedJul 22 2015, 12:16 PM

Could you please add a test for the file: + ::func case?

Setting breakpoints on ::func doesn't work in lldb! It needs to be fixed there first. If/when it is fixed, I will add a test.

(lldb) br set --name ::func
Breakpoint 6: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.
ki.stfu requested changes to this revision.Jul 22 2015, 8:41 PM
ki.stfu edited edge metadata.
In D11396#209959, @dawn wrote:

Could you please add a test for the file: + ::func case?

Setting breakpoints on ::func doesn't work in lldb! It needs to be fixed there first. If/when it is fixed, I will add a test.

(lldb) br set --name ::func
Breakpoint 6: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.

Please add this test and comment it out with FIXME explanation why it's disabled. Also, could you please create a bug for this and add a link in FIXME?

This revision now requires changes to proceed.Jul 22 2015, 8:41 PM
dawn added a comment.Jul 23 2015, 5:49 PM

Please add this test and comment it out with FIXME explanation why it's disabled. Also, could you please create a bug for this and add a link in FIXME?

I don't have an account on bugzilla and don't want to create one due to the warnings about public e-mails. Can you add the bug for me please?

I will add a test and comment it out (but won't bother to resubmit new patch just for that minor addition). Ok to commit?

dawn updated this revision to Diff 30609.Jul 24 2015, 2:30 PM
dawn edited edge metadata.

Comment about "::func" syntax not working in lldb added as requested. Please accept this patch - it fixes namespace tokens used in lldb-mi breakpoints like "-break-insert ns::func". Patches to lldb and other issues are not intended to be part of this patch and should be handled separately. Thank you.

ki.stfu accepted this revision.Jul 26 2015, 11:38 PM
ki.stfu edited edge metadata.

Add a link to the bug please and go ahead.

test/tools/lldb-mi/breakpoint/TestMiBreak.py
79 ↗(On Diff #30609)

Add a link to the bug please: "llvm.org/pr24271"

This revision is now accepted and ready to land.Jul 26 2015, 11:38 PM
This revision was automatically updated to reflect the committed changes.