Conversation
…mand now builds and almost runs. There is a problem with thread ids between the debugger/DAC and the target/VM/PAL.
…ilds and almost runs except for a thread id problem.
…related to %p). Needed to change how the PAL got the thread id (pthread_self to gettid) and implemented a simple GetThreadContext function.
…pported under windbg/windows runtime. Didn't actually support "*" for the width parameter at all for any format char.
@mikem8361 Do you know what lldb uses on OS X? Its probably the mach port. If not I can go dig it up. |
I don't know what is used for the thread id on OSx. I probably won't have time to look into OSx until later next week or so. Sent from Windows Mail From: Geoff Nortonmailto:notifications@github.com @mikem8361https://github.com/mikem8361 Do you know what lldb uses on OS X? Its probably the mach port. If not I can go dig it up. Reply to this email directly or view it on GitHubhttps://github.com//pull/437#issuecomment-78832069. |
@kangaroo It would be great if you could dig any info on lldb thread ids for OSx. Thanks. |
@mikem8361 I'll spend some cycles on it this weekend. Can you provide a testcase and expected behavior so I can confirm my fixes? |
Loading the sos plugin and running the ClrStack command will test this. The directions below are obviously for Linux and will have to be adjusted for OSx. I would like to know how you install lldb and build the plugin for OSx after Pat Gavlin’s cmake changes? Do we still need to clone and build lldb? Thanks. mikem I will put these directions on our “wiki” as soon as I figure out how (Matt?). First we need to install and build with lldb 3.6 instead of 3.5 (because it has problem debugging corerun/coreclr): sudo echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main" > /etc/apt/sources.list.d/llvm.list Now set the LD_LIBRARY_PATH environment variable to the path of the binaries. BUILD_DIR is just for convenience. export BUILD_DIR=/home/mikem/coreclr/binaries/Product/linux.x64.debug Start lldb like this: lldb-3.6 -o "plugin load %BUILD_DIR/linux.x64.debug /libsosplugin.so" $BUILD_DIR/corerun $BUILD_DIR/HelloTux.exe After the module coreclr is loaded/started/initialized, execute the sos commands like this (the case is significant): (lldb) sos IP2MD 0x00007ffff231c90e You can create an alias to a simpler command only after the plugin is loaded: command alias clrstack sos ClrStack mikem From: Geoff Norton [mailto:notifications@github.com] @mikem8361https://github.com/mikem8361 I'll spend some cycles on it this weekend. Can you provide a testcase and expected behavior so I can confirm my fixes? — |
@mikem8361 I have it working on OS X:
Do you want to wait for review and squash before bringing in my commit? As for instructions, the LLDB build is currently broken on OS X (it'll be in my PR to fix it), but you do need to check out LLDB from source, then you do the following prior to build:
|
BTW, my patches are trivial, but here: https://github.com/kangaroo/coreclr/tree/clrstack |
Go ahead and create a PR for my fork. From: Geoff Norton [mailto:notifications@github.com] @mikem8361https://github.com/mikem8361 I have it working on OS X: (lldb) plugin load libsosplugin.dylib (lldb) r Process 41183 launched: './corerun' (x86_64) Process 41183 stopped
-> 0x11c5d649a: divss 0x16(%rip), %xmm0 0x11c5d64a2: incl %eax 0x11c5d64a4: cmpl $0x400, %eax 0x11c5d64a9: jl 0x11c5d648a (lldb) sos ClrStack OS Thread Id: 0x3e8033 (1)
00007FFF5FBFE1D8 000000011C5D649A Driver.Main(System.String[]) 00007FFF5FBFE5B8 0000000101684F14 [GCFrame: 00007fff5fbfe5b8] 00007FFF5FBFEBE0 0000000101684F14 [GCFrame: 00007fff5fbfebe0] (lldb) Do you want to wait for review and squash before bringing in my commit? As for instructions, the LLDB build is currently broken on OS X (it'll be in my PR to fix it), but you do need to check out LLDB from source, then you do the following prior to build: export LLDB_LIB_DIR=/Library/Developer/CommandLineTools/Library/PrivateFrameworks/ export LLDB_INCLUDE_DIR=/path/to/checkout/of/lldb/include/ — |
Done |
Fixes OSx problems.
@@ -150,7 +150,7 @@ namespace sos | |||
|
|||
|
|||
if (mTypeName == NULL) | |||
return L"<error>"; | |||
return (wchar_t *)W("<error>"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be to change the return type to const wchar_t * instead of adding this cast.
LGTM |
The sos "ClrStack" command now works
Enabled all the sos source necessary to allow ClrStack to run. Had to change how the PAL layer implemented GetCurrentThreadId() to use gettid() instead of pthread_self() so the DAC can find the vm's thread object. The tid's are the only thing available on the lldb side. OSx still uses pthread_self() and will need some future work to get ClrStack working. Fixed the PAL vsnprintf functions to properly handle the "%_._p" format string. The address in the ClrStack (and most other commands) are printed this way.
@jkotas could you review? And @sergiy-k if you get some time.