Add a "diagnostics dump" command to, as the name implies, dump the diagnostics to disk. The goal of this command is to let the user generate the diagnostics in case of an issue that doesn't cause the debugger to crash. This is also useful for testing.
Details
Diff Detail
Event Timeline
lldb/source/Commands/CommandObjectDiagnostics.cpp | ||
---|---|---|
86 | AppendError sets the status for you now. | |
108 | Is "log" correct here? | |
lldb/source/Commands/Options.td | ||
348 | Worth clarifying whether the path can be absolute or relative to the current working dir? I'd guess either works. | |
lldb/source/Utility/Diagnostics.cpp | ||
50 | You std::move'd some errors above does that apply here? (I'm not sure exactly what requires it and what doesn't) | |
61 | Silly question, is it intentional that we write out files after saying they have been written? Of course it makes sense to print something up front, otherwise the error here would come out of the blue, but perhaps "LLDB diagnostics will be written to..." instead? (this is probably better changed in that earlier patch not sure if that went in yet) | |
lldb/test/Shell/Diagnostics/TestDump.test | ||
2 | "correct directory and creates a new one if needed." ? |
lldb/source/Commands/CommandObjectDiagnostics.cpp | ||
---|---|---|
85 | Do we want to just create a temp directory if the user didn't specify one here and them emit the path to where things were saved instead of erroring out? | |
lldb/source/Utility/Diagnostics.cpp | ||
46–47 | How are we dumping these to the directory the user specifies the directory in "diagnostic dump"? Below we create a unique directory. Seems like this API should take a "Optional<FileSpec> directory" parameter and if it doesn't have a value, then create a unique directory? |
Address code review feedback
lldb/source/Commands/CommandObjectDiagnostics.cpp | ||
---|---|---|
85 | Yes, that's exactly what we do. If we get here we were unable to create either of them. | |
lldb/source/Commands/Options.td | ||
348 | Given that either works I think we don't need to be explicit about it. | |
lldb/source/Utility/Diagnostics.cpp | ||
50 | toString takes ownership of the error, so it needs to be moved here. Errors cannot be copied, so they always need to be moved, except when RVO kicks in. | |
61 | Yes, that was @labath's suggestion because when we call this from the signal handler, we might crash again in the process and wouldn't print anything at all. |
lldb/source/Utility/Diagnostics.cpp | ||
---|---|---|
61 | Maybe I can be clearer: LLDB diagnostics written to <...> Please include the directory content when filing a bug report <we crash during writing the files> So the files haven't been written, or at least they are in an undefined state, but the output looks like we finished writing them. So will be written is more accurate. If I see this in a test log file I'm going to wonder did it crash writing them or did it already write them, which means I'd have to reproduce locally. With the sequence of events clearer, I can at least check obvious things like a full disk before needing to do that. Small thing but it's a few words might save some annoyance down the road. (printing up front I agree with, that part is good) |
The newly added test is failing on the windows buildbot: https://lab.llvm.org/buildbot/#/builders/83/builds/25446
Do we want to just create a temp directory if the user didn't specify one here and them emit the path to where things were saved instead of erroring out?