This is an archive of the discontinued LLVM Phabricator instance.

Tell the user which pathname was invalid...
ClosedPublic

Authored by jingham on Jul 7 2022, 6:03 PM.

Details

Summary

When there's an error with the pathname in "command script import" lldb just says "error: module importing failed: invalid pathname" but doesn't actually tell you what the bad pathname was. When you're loading some python module that imports a bunch of other modules, that makes it hard to figure out which one was bad.

I changed it to either say "empty path" if that was the error, or report the pathname otherwise. I added a test as well.

Diff Detail

Event Timeline

jingham created this revision.Jul 7 2022, 6:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2022, 6:03 PM
jingham requested review of this revision.Jul 7 2022, 6:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2022, 6:03 PM
hawkinsw added inline comments.
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
2717

Sorry for dropping in unsolicited, but would this be another error that we would want to add more specificity for?

DavidSpickett added inline comments.
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
2640

Is this testable? Maybe not because the top level command always wants some string, unless "" is accepted.

jingham updated this revision to Diff 445145.Jul 15 2022, 3:20 PM

I added the pathname to the "invalid directory" output, but when the test passes an invalid directory we still execute the "invalid pathname" branch but not the "invalid directory" branch. I don't know enough about the llvm filesystem stuff to know why that is...

I did add a test for the "empty path" however.

This revision is now accepted and ready to land.Jul 15 2022, 4:23 PM