This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Port lldb gdb-server to libOption
ClosedPublic

Authored by labath on Oct 15 2020, 8:56 AM.

Details

Summary

The existing help text was very terse and was missing several important
options. In the new version, I add a short description of each option
and a slightly longer description of the tool as a whole.

The new option list does not include undocumented no-op options:
--debug and --verbose. It also does not include undocumented short
aliases for long options, with two exceptions: -h, because it's
well-known; and -S (--setsid), as it's used in one test. Using these
options will now produce an error. I believe that is acceptable as users
aren't generally invoking lldb-server directly, and the only way to
learn about the short aliases was by looking at the source.

Diff Detail

Event Timeline

labath created this revision.Oct 15 2020, 8:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 15 2020, 8:56 AM
Herald added subscribers: dang, mgorny. · View Herald Transcript
labath requested review of this revision.Oct 15 2020, 8:56 AM
JDevlieghere added inline comments.Oct 15 2020, 11:27 AM
lldb/source/Utility/Args.cpp
178

Maybe StringList should have a ctor that takes an ArrayRef<StringRef>, but probably not worth the extra copies here.

lldb/tools/lldb-server/lldb-gdbserver.cpp
424

Should we extract this code into a utility that we can use here and in the lldb driver?

MaskRay added inline comments.Oct 15 2020, 2:33 PM
lldb/tools/lldb-server/CMakeLists.txt
62

Otherwise it fails in a BUILD_SHARED_LIBS=on build because the -Wl,-z,defs linker option requires a module to have fully specified dependencies

MaskRay added inline comments.Oct 15 2020, 4:35 PM
lldb/tools/lldb-server/lldb-gdbserver.cpp
422

Consider using parseArgs I added in D83639

MaskRay added inline comments.Oct 15 2020, 4:37 PM
lldb/tools/lldb-server/lldb-gdbserver.cpp
369

a startup -> at startup

DavidSpickett added inline comments.
lldb/tools/lldb-server/lldb-gdbserver.cpp
370

attach a process -> attach to a process

Also maybe it reads better as:
the lldb-server can be directed by the LLDB client to launch or attach to a process.

labath marked 2 inline comments as done.Oct 16 2020, 5:46 AM
labath added inline comments.
lldb/source/Utility/Args.cpp
178

I think it can have that constructor if it's needed (though I'd rather delete that class altogether), but I think this constructor would be good to have regardless.

lldb/tools/lldb-server/CMakeLists.txt
62

Thanks.

lldb/tools/lldb-server/lldb-gdbserver.cpp
424

I started implementing that but then I realized we the two are on the opposite sides of the SB API so we don't have a very good place to put it. I don't think this line of text is worth the trouble of figuring that out.

labath updated this revision to Diff 298606.Oct 16 2020, 5:46 AM
labath marked an inline comment as done.

address review feedback

MaskRay added inline comments.Oct 16 2020, 9:02 AM
lldb/tools/lldb-server/lldb-gdbserver.cpp
405

Seems that the variable naming is inconsistent with the rest of LLDB and this file.

labath added inline comments.Oct 19 2020, 6:35 AM
lldb/tools/lldb-server/lldb-gdbserver.cpp
405

The only consistent thing about naming in lldb is that it's inconsistent :P. Code that heavily interacts with llvm is particularly problematic, since it's going to look bad that no matter how you write it...

JDevlieghere accepted this revision.Oct 19 2020, 9:03 AM

LGTM

lldb/source/Utility/Args.cpp
178

Agreed on both accounts

This revision is now accepted and ready to land.Oct 19 2020, 9:03 AM
MaskRay accepted this revision.Oct 19 2020, 9:23 AM
This revision was landed with ongoing or failed builds.Oct 21 2020, 7:16 AM
This revision was automatically updated to reflect the committed changes.