This is an archive of the discontinued LLVM Phabricator instance.

[debugserver] Initialize logging earlier in the startup sequence
ClosedPublic

Authored by bulbazord on Feb 15 2023, 2:35 PM.

Details

Summary

Prior to setting up logging, we have uses of RNBLogSTDERR and
RNBLogSTDOUT. These macros will dump to STDERR and STDOUT respectively
if debugserver has a tty. Otherwise, it uses _DNBLog, which will do
nothing if a logging function hasn't been set up. For example, if you
specify a log file that cannot be opened for any reason and you don't
have a tty, you have 0 insight into what happened.

rdar://105473133

Diff Detail

Event Timeline

bulbazord created this revision.Feb 15 2023, 2:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2023, 2:35 PM
bulbazord requested review of this revision.Feb 15 2023, 2:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2023, 2:35 PM
jasonmolenda added inline comments.Feb 15 2023, 2:58 PM
lldb/tools/debugserver/source/debugserver.cpp
1340–1341

Should this be moved out of this log_file != NULL block so that the logging flags are set based on -f value? Otherwise looks good to me.

bulbazord added inline comments.Feb 15 2023, 2:59 PM
lldb/tools/debugserver/source/debugserver.cpp
1340–1341

Good catch, that is indeed the case. I'll update this.

bulbazord updated this revision to Diff 497818.Feb 15 2023, 3:03 PM

Moving second use of DNBSetLogMask outside of the log file block

jasonmolenda accepted this revision.Feb 15 2023, 3:03 PM
This revision is now accepted and ready to land.Feb 15 2023, 3:03 PM