This is an archive of the discontinued LLVM Phabricator instance.

[lldb/test] Update lldbutil.fetch_next_event to match broadcaster class
ClosedPublic

Authored by mib on Apr 25 2023, 11:15 AM.

Details

Summary

[lldb/test] Update lldbutil.fetch_next_event to match broadcaster class

This patch updates the lldbutil.fetch_next_event helper function to
either match a specific broadcaster or match a whole broadcaster class.

This is very handy when testing process events for interactive scripted
process debugging.

This also fixes a bug in the failing case, where SBEvent.GetDescription
expects a SBStream argument. We never took that code path in the
original implementation so we didn't hit that bug.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>

Diff Detail

Event Timeline

mib created this revision.Apr 25 2023, 11:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 25 2023, 11:15 AM
mib requested review of this revision.Apr 25 2023, 11:15 AM
bulbazord added inline comments.Apr 25 2023, 11:19 AM
lldb/packages/Python/lldbsuite/test/lldbutil.py
1206–1208

Maybe update the docstring to reflect this new parameter? Something like If match_class is true, the provided broadcaster will be matched by class rather than instance?

1220–1221

I'm not sure why you added this part? Is there something not great about calling SBEvent::GetDescription directly?

mib updated this revision to Diff 516854.Apr 25 2023, 11:26 AM
mib marked 2 inline comments as done.
mib edited the summary of this revision. (Show Details)

Address @bulbazord comments.

lldb/packages/Python/lldbsuite/test/lldbutil.py
1220–1221

This is actually a fix of the original implementation (SBEvent::GetDescription requires a SBStream argument but when added this helper function, we never took this code path, so we never hit that error).

This revision is now accepted and ready to land.Apr 25 2023, 11:27 AM