Skip to content

Provide OS thread ID and name in -thread-info response#129

Merged
sunshaoce merged 1 commit intolldb-tools:mainfrom
jld01:thread-name
Feb 4, 2026
Merged

Provide OS thread ID and name in -thread-info response#129
sunshaoce merged 1 commit intolldb-tools:mainfrom
jld01:thread-name

Conversation

@jld01
Copy link
Contributor

@jld01 jld01 commented Feb 1, 2026

No description provided.

@jld01
Copy link
Contributor Author

jld01 commented Feb 1, 2026

Previously, the LLDB-MI -thread-info command returned the LLDB-allocated thread index ID in the target-id field (duplicating information in the id field).

906,787 115-thread-info
906,803 115^done,threads=[{id="3",target-id="Thread 3" ...}, ...

If the thread had a valid name, this was provided in the target-id field instead of the index ID:

906,787 115-thread-info
906,803 115^done,threads=[{id="3",target-id="MyThreadName", ...}, ...

This change brings behaviour in line with GDB/MI which returns the OS-allocated thread ID in target-id and the thread name in name (if present):

906,787 115-thread-info
906,803 115^done,threads=[{id="3",target-id="Thread 10367",name="MyThreadName", ...}, ...

@jld01
Copy link
Contributor Author

jld01 commented Feb 1, 2026

@sunshaoce, I am not sure why the original code tests the thread name for validity using CMIUtilString::IsAllValidAlphaAndNumeric(pThreadName). This seems unnecessarily restrictive. I think spaces and punctuation characters should be acceptable in a thread name, perhaps using a method backed by isprint() rather than isalnum(). What is your opinion? We would need avoid or escape the double quote char (") for MI.

@jld01 jld01 marked this pull request as ready for review February 1, 2026 17:02
@sunshaoce
Copy link
Collaborator

The change itself looks fine. However, since lldb-mi has very limited test coverage, being conservative about relaxing thread name validation is probably safer for now.

@jld01
Copy link
Contributor Author

jld01 commented Feb 4, 2026

OK, could you review this PR in it's current state, then, please?

@sunshaoce
Copy link
Collaborator

LGTM. Thanks for contributing!

@sunshaoce sunshaoce merged commit 7bdbec5 into lldb-tools:main Feb 4, 2026
3 checks passed
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.

2 participants