[Lldb-commits] [PATCH] D128541: [WIP][lldb][windows] Handle OutputDebugString from debuggee
Alvin Wong via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 29 08:46:52 PDT 2022
alvinhochun created this revision.
Herald added a project: All.
alvinhochun added reviewers: mstorsjo, DavidSpickett, labath, omjavaid.
alvinhochun added a comment.
alvinhochun updated this revision to Diff 439961.
alvinhochun updated this revision to Diff 441032.
alvinhochun edited the summary of this revision.
alvinhochun published this revision for review.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
WIP. To test this, first compile a test program (not needed if you already have programs that does OutputDebugString):
#include <windows.h>
int main() {
OutputDebugStringW(L"Hello debug string");
return 0;
}
Debug the program in lldb. Before running the program, you need to run the command `log enable windows dbgprint`. When you run the program, you should see "DEBUG: Hello debug string" output in lldb.
I think this should be enabled by default, but none of the logging categories for `LLDB_LOG` has default active. Is there a better way to do this? The log output can also get mixed with command output.
alvinhochun added a comment.
Add size check
mstorsjo added a comment.
For context - does gdb handle this too, and is it printed out to the gdb console?
Did you test this both with and without lldb-server? (See `ShouldUseLLDBServer` in `ProcessWindows.cpp`.)
alvinhochun added a comment.
In D128541#3611052 <https://reviews.llvm.org/D128541#3611052>, @mstorsjo wrote:
> For context - does gdb handle this too, and is it printed out to the gdb console?
Yes, gdb prints them to the console with a `warning: ` prefix.
> Did you test this both with and without lldb-server? (See `ShouldUseLLDBServer` in `ProcessWindows.cpp`.)
It works without lldb-server. I tested lldb-server just now and found that none of the log output is printed -- I tried enabling all windows logging categories but got nothing. (I rebased the change onto 0aa6df65756d3ec7769e55424a41c7074849fe12 <https://reviews.llvm.org/rG0aa6df65756d3ec7769e55424a41c7074849fe12> before testing.)
alvinhochun added a comment.
Added test for Windows
This implements handling of OUTPUT_DEBUG_STRING_EVENT which prints the
debug strings using LLDB_LOG (channel "windows", category "dbgprint").
- TODO: see if there is a better way to output the debug strings...
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D128541
Files:
lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
lldb/source/Plugins/Process/Windows/Common/IDebugDelegate.h
lldb/source/Plugins/Process/Windows/Common/LocalDebugDelegate.cpp
lldb/source/Plugins/Process/Windows/Common/LocalDebugDelegate.h
lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h
lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.h
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h
lldb/test/Shell/Process/Windows/outputdebugstring.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128541.441032.patch
Type: text/x-patch
Size: 10624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220629/a9a615c3/attachment-0001.bin>
More information about the lldb-commits
mailing list