Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add thread tracking extension to myst-gdb #1418

Merged
merged 1 commit into from
Nov 23, 2022
Merged

Conversation

asvrada
Copy link
Collaborator

@asvrada asvrada commented Sep 13, 2022

This extension tracks all threads created inside Enclave, and report their pid, tid to facilitate debugging.
This extension also tracks all command-line arguments that a process runs.

Example usage: tests/dotnet-lib-5

make gdb-runner

>>> myst-thread

        myst-thread: Mystikos thread tracker
        Commands:
        myst-thread help
          Print this message

        myst-thread thread
          List all tracked threads
        
        myst-thread cmdline
          List the command line for each process
        
        myst-thread exe
          List the executable for each process

        myst-thread cwd
          List the current working directory for each process
        
>>> myst-thread thread
List of Mystikos controlled threads:
ppid pid tid(target_tid)
100 101 101(5666)
100 101 102(5730)
100 101 103(5731)
100 101 104(5732)
100 101 105(5733)
100 101 106(5734)
100 101 107(5736)
100 101 108(5738)
100 101 109(5742)
100 101 110(5746)
100 101 111(5747)
100 101 112(5748)
100 101 113(5749)
100 101 114(5750)
100 101 117(5766)
100 101 118(5767)
100 101 119(5771)
100 101 120(5772)
100 101 121(5774)
100 101 122(5775)
>>> myst-thread cmdline
Process 101 (Parent 100) cmdline: /runner/bin/Release/net5.0/runner /testcases/pass.1 /dotnet-lib-release/

@asvrada asvrada force-pushed the debug-ext branch 2 times, most recently from a2e83ec to 8a363c9 Compare September 14, 2022 07:11
@asvrada asvrada requested a review from vtikoo September 15, 2022 18:22
debugger/gdb-sgx-plugin/debug_ext.py Outdated Show resolved Hide resolved
debugger/gdb-sgx-plugin/debug_ext.py Outdated Show resolved Hide resolved
debugger/gdb-sgx-plugin/debug_ext.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@vtikoo vtikoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this, looks good!

Copy link
Collaborator

@anakrish anakrish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to make sure that the hook functions are compiled with debug information, and aren't optimized out.

Do we expect the debugger extension to work in a RelWithDebInfo build of Mystikos?

debugger/gdb-sgx-plugin/thread.py Show resolved Hide resolved
@asvrada asvrada merged commit d11eb5c into deislabs:main Nov 23, 2022
@asvrada asvrada deleted the debug-ext branch November 23, 2022 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants