This is an archive of the discontinued LLVM Phabricator instance.

Add a breakpoint manager that matches based on File/Line/Col Locations
ClosedPublic

Authored by mehdi_amini on Feb 25 2023, 10:19 PM.

Diff Detail

Event Timeline

mehdi_amini created this revision.Feb 25 2023, 10:19 PM
mehdi_amini requested review of this revision.Feb 25 2023, 10:19 PM
Mogball added inline comments.
mlir/include/mlir/Debug/BreakpointManagers/FileLineColLocBreakpointManager.h
63

does this work on PointerUnion?

64

drop trivial braces

99

Couldn't you hash the FileLineColLoc directly?

mlir/lib/Debug/BreakpointManagers/FileLineColLocBreakpointManager.cpp
48

e

mlir/lib/Tools/mlir-opt/MlirOptMain.cpp
109

would it make more sense to set up this machinery inside MlirOptMain.cpp based on the string option? The static tricks going on here feel a little automagical

mlir/unittests/Debug/FileLineColLocBreakpointManagerTest.cpp
233

newline

mehdi_amini marked 4 inline comments as done.Mar 12 2023, 3:56 PM
mehdi_amini added inline comments.
mlir/include/mlir/Debug/BreakpointManagers/FileLineColLocBreakpointManager.h
63

It does not

99

Absolutely!

mlir/lib/Tools/mlir-opt/MlirOptMain.cpp
109

would it make more sense to set up this machinery inside MlirOptMain.cpp

We are inside MlirOptMain.cpp :)

I could move the vector outside of the lambda if you prefer, but it would still be static (like all the cl:: options actually.

I don't quite see where to handle this differently actually? The config does not hold a vector of strings and none of the cl options are available anywhere else.

mehdi_amini marked 3 inline comments as done.

address comments

rriddle added inline comments.Mar 13 2023, 12:14 AM
mlir/include/mlir/Debug/BreakpointManagers/FileLineColLocBreakpointManager.h
24

Can you document this class?

54–55

Same here, would love docs on this.

57

Can you add documentation to the various methods in this class?

73

Drop the trivial braces here.

89–93

Can we make this private?

90

Can we use StringAttr instead of StringRef here? Will be much more optimal on lookup.

95

Please use std::optional in new code.

96–98

Can we have a little bit more advanced checking here? This will miss out on things like FusedLoc/NameLoc/etc.

mlir/include/mlir/Debug/Observers/ActionLogging.h
33–34

Can you add a little more context here? I had to read the comment a few times to understand what it meant.

mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
89–90

This comment feels slightly unrelated to the function, e.g. doesn't mention break point manager at all. Can this be tweaked?

95–96

I'm missing the connection between LocFilters(in the function name) and location breakpoints to use for logging actions? Can this comment be tweaked/beefed up?

mlir/lib/Debug/BreakpointManagers/FileLineColLocBreakpointManager.cpp
19

Likely can drop the llvm:: here.

46–51

Can you update the diagnostic function to use Twine instead of StringRef? That would simplify this function.

mehdi_amini marked 11 inline comments as done.

Address comments

mlir/include/mlir/Debug/BreakpointManagers/FileLineColLocBreakpointManager.h
57

These are override, do we usually repeat the parent comment here?

90

I don't think so: we don't have an MLIRContext when we create breakpoints. Imagine a gdb session connected to a process with multiple MLIRContext and you set a breakpoint based on a filename.

96–98

NameLoc isn't relevant I believe, FusedLoc matters though, using a walk should do?

rriddle added inline comments.Mar 21 2023, 11:59 AM
mlir/include/mlir/Debug/BreakpointManagers/FileLineColLocBreakpointManager.h
57

Missed it was override. Generally we don't if the behavior is clearly defined from the class, which should be the case here (if we get a class doc).

90

Gotcha, makes sense.

96–98

Yeah, though I think you'd just have to be careful to not include caller locations from callsites.

@rriddle : I think I addressed all of your comments? (judging by your last answer), but you didn't approve so I'm not sure if you wanted to review more?

rriddle accepted this revision.Apr 21 2023, 9:08 PM
This revision is now accepted and ready to land.Apr 21 2023, 9:08 PM
This revision was landed with ongoing or failed builds.Apr 21 2023, 9:28 PM
This revision was automatically updated to reflect the committed changes.