DynamoRIO / DynamoRIO/dynamorio

gdb fails to see app threads in some cases

Open
#2,201 2 comments 0 reactions 0 assignees View on GitHub
Bug-AppFail Maintainability OpSys-Linux
Dominant language
C
Stars
3.2k
Forks
629
Avg merge
2d 15h
Merged PRs (30d)
31

Description

Xref #2199

I have run large proprietary apps where gdb shows only 2 threads while DR (in its data structs or logfiles for debug build) and `/proc/self/task` show hundreds of threads.

I checked typical reasons for gdb failing to see threads: a stripped libpthread.so.0, and a non-matching libthread_db.so.1. Those are not the problem: the same app, natively, has all of its hundreds of threads show up under gdb. The problem only happens under DR.

It's something to do with TLS and the pthread data structures. It may be -mangle_app_seg, where the app's TLS is stolen to better support private libraries. DR restores the app's TLS on explicit app actions that view the underlying state, but gdb using ptrace is going to see the non-app state.

As for how to fix it, perhaps we could make a convenience function we could call from gdb to restore the app TLS state, and again to reverse? Although I have had trouble executing functions in gdb on some of these large apps (gdb bugs or shortcomings of some kind I believe).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.