This is an archive of the discontinued LLVM Phabricator instance.

[LLDB] Fix missing return value in SBBreakpointLocation::GetQueueName()
ClosedPublic

Authored by fixathon on Jul 27 2022, 1:04 PM.

Details

Summary

Seems like a typo in the function that never returns a significant value

Diff Detail

Event Timeline

fixathon created this revision.Jul 27 2022, 1:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2022, 1:04 PM
fixathon requested review of this revision.Jul 27 2022, 1:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2022, 1:04 PM

There must be a test for this, obviously we don't have one, but check the blame log and ask the original author how this should be tested.

So far as I can tell, we don't have any significant tests for the "queue specific breakpoint or breakpoint location" feature. There's a pretty extensive test for identifying queues & getting more detail from them in test/API/macosx/queues/TestQueues.py, but it doesn't test the breakpoint feature.

Both SetQueueName and GetQueueName are called in the api/default_constructor test, but those tests don't assert anything about values, since they are on default-constructed objects. We also test that we can set a queue name on a breakpoint, serialize the breakpoint, deserialize it and get the queue name back out. But we can't reuse that for locations since we don't serialize breakpoint locations.

SBBreakpointLocation.{Get,Set}QueueName can be applied to any breakpoint, it doesn't require any queue support from the underlying OS. Get just gets back whatever string Set put in. So for coverage of this bug it should be enough to find some test that makes a breakpoint, then set a queue, make sure you get it back again.

But we really should add some tests that show this actually works.

Jim

Thanks for the info! Should be easy to test this function at least like you mentioned

fixathon planned changes to this revision.Jul 27 2022, 7:50 PM

Working on adding unit tests

fixathon updated this revision to Diff 448453.Jul 28 2022, 3:10 PM

Added unit tests, and verified the fix is working.

fixathon updated this revision to Diff 448457.Jul 28 2022, 3:35 PM

Fix duplicate name of the test function

Looks good. I would just inline the contents of shadowed_bkpt_locations_setters_getters_test into test_shadowed_location_getters_setters since it isn't use anywhere else.

lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
29

unless you plan on re-using shadowed_bkpt_locations_setters_getters_test() I would just inline the function's contents here.

fixathon updated this revision to Diff 448463.Jul 28 2022, 3:51 PM

Address the review comments and inline the tests into an existing test function

fixathon marked an inline comment as done.Jul 28 2022, 3:53 PM

Address the review comments

clayborg accepted this revision.Jul 28 2022, 3:58 PM

As long as all values being set on the location differ from any that might be set on the breakpoint itself for any get/set tests you added this is good to go!

This revision is now accepted and ready to land.Jul 28 2022, 3:58 PM