gdbclient: Read thread uid, gid and status from procfs#6263
Conversation
8558a82 to
6e20bea
Compare
|
@wargio Could you approve the CI workflows when you get a chance? Keeping the PR as draft until CI passes. |
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 7 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
b192765 to
11a851d
Compare
notxvilka
left a comment
There was a problem hiding this comment.
Good idea but more work is needed
11a851d to
613efc9
Compare
|
@notxvilka I've addressed all the feedback. Could you re-review and mark this ready for review when you get a chance? |
613efc9 to
dafb52e
Compare
dafb52e to
756b537
Compare
|
The char buffer caused a -Wpointer-sign error when passed to gdbr_read_file(ut8 *buf). Added (ut8 *) cast at the call site, matching how gdbr_parse_processes_xml does it in xml.c. |
| } | ||
|
|
||
| /** | ||
| * @brief Read thread uid, gid and status from /proc/<pid>/task/<tid>/status via vFile. |
756b537 to
30176a0
Compare
|
@notxvilka All three of your feedback points have been addressed. Could you re-review when you get a chance? |
@Rot127 Happy to add a test. This change requires a Linux gdbserver with a multi-threaded binary and vFile support to verify. Could you point me to existing test infrastructure I should follow, or suggest a pattern for testing gdbserver-dependent functionality? |
|
There are already tests which use a gdb server in For the binary: You can check the existing rizin-testbins repo for one. |
30176a0 to
ee10bc9
Compare
Done, added test in test/db/archos/linux-x64/dbg_gdbserver. Binary + source in rizinorg/rizin-testbins#287. |
|
Merged it, please rebase |
ee10bc9 to
80ce64f
Compare
There was a problem hiding this comment.
Can the output of the test be more descriptive?
Just a * and - has no meaning.
There was a problem hiding this comment.
Fixed -- changed EOF2 to EOF (parser only accepts EOF) and updated the expected output to show the status character for each thread (* t and - t), which is more descriptive.
80ce64f to
e897506
Compare
Your checklist for this pull request
RZ_APIfunction and struct this PR changes.RZ_API).Detailed description
gdbr_threads_listwas hardcoding uid, gid and status to -1 andRZ_DBG_PROC_STOP. I noticedgdbr_parse_processes_xmlalready does this for processes by reading/proc/<pid>/statusover vFile, so I did the same for threads using/proc/<pid>/task/<tid>/status. Falls back to defaults if the remote doesn't support vFile or isn't Linux.Test plan
This change requires a Linux gdbserver with a multi-threaded binary and vFile support to verify. Open to suggestions on how to add a test for this.
Closing issues
N/A