Skip to content

Commit 10d8964

Browse files
authored
[docs] Add LLDB debugging instructions for Mono running a runtime test (#60410)
* [docs] Add LLDB debugging instructions for Mono running a runtime test * Also add a note about building a single test
1 parent cf49643 commit 10d8964

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/workflow/testing/mono/testing.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ cd src/tests
2020
./build.sh excludemonofailures <release|debug>
2121
```
2222

23+
To build an individual test, test directory, or a whole subdirectory tree, use the `-test:`, `-dir:` or `-tree:` options (without the src/tests prefix)
24+
For example: `./build.sh excludemonofailures release -test:JIT/opt/InstructionCombining/DivToMul.csproj`
25+
26+
2327
Run individual test:
2428
```
2529
cd src/mono
@@ -32,6 +36,24 @@ cd src/mono
3236
make run-tests-coreclr-all
3337
```
3438

39+
To debug a single test with `lldb`:
40+
41+
1. Run the test at least once normally (or manually run the `mono.proj` `PatchCoreClrCoreRoot` target)
42+
2. Edit the `.sh` file for the test and change the line
43+
```
44+
LAUNCHER="$_DebuggerFullPath "$CORE_ROOT/corerun" -p "System.Reflection.Metadata.MetadataUpdater.IsSupported=false" ${__DotEnvArg}"
45+
```
46+
to add `--` after the debugger full path
47+
```
48+
LAUNCHER="$_DebuggerFullPath -- "$CORE_ROOT/corerun" -p "System.Reflection.Metadata.MetadataUpdater.IsSupported=false" ${__DotEnvArg}"
49+
```
50+
3. Run the shell script for the test case manually:
51+
```
52+
bash ./artifacts/tests/coreclr/OSX.x64.Release/JIT/opt/InstructionCombining/DivToMul/DivToMul.sh -coreroot=`pwd`/artifacts/tests/coreclr/OSX.x64.Release/Tests/Core_Root -debug=/usr/bin/lldb
53+
```
54+
4. In LLDB add the debug symbols for mono: `add-dsym <CORE_ROOT>/libcoreclr.dylib.dwarf`
55+
5. Run/debug the test
56+
3557
### WebAssembly:
3658
Build the runtime tests for WebAssembly
3759
```

0 commit comments

Comments
 (0)