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

TryGetTidFromTargetId() fails to parse thread ID from target-id if format is like Thread 123.123 #1448

Open
oold opened this issue Mar 28, 2024 · 1 comment

Comments

@oold
Copy link

oold commented Mar 28, 2024

The thread ID is not correctly parsed.

Output from -thread-info 1:

MS_MIDebug: 1: (14914) ->1015^done,threads=[{id="1",target-id="Thread 15307.15307",frame={level="0",addr="0xb6f24aa0",func="_start",args=[],from="/cygdrive/e/WORK/CDK/CYGWIN32/ARM_LINUX_GNU_CROSSTOOLS/V5.3-1/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot/lib/ld-linux.so.3",arch="armv5tej"},state="stopped"}]
@intel-rganesh
Copy link
Contributor

intel-rganesh commented Jul 17, 2024

We currently have two fields in DebuggedThread object, namely Id and TargetId.

image

We store the global numeric ID assigned to the thread by GDB in Id.
However, we strip all the target-specific string information and only use the numeric value to store in the TargetId. This can lead to complications when we are debugging with multiple devices. The target ID may be no longer unique. The TargetId needs to be a string and we need to fetch it as is. We had to temporarily change the "target-id" field from ZE to Thread but this cannot be up-streamed to gdb.

Also in AD7Thread that implements IDebugThread2.GetThreadId, we use TargetId to get ThreadId.

threadId = _debuggedThread.TargetId;

This method is called by AD7ExtensionMethods.
thread.GetThreadId(out unsignedId);

This is in turn used to identify ThreadId for Stopped Event.
ThreadId = thread.Id(),

intel-rganesh added a commit to intel-rganesh/MIEngine that referenced this issue Jul 19, 2024
Convert TargetId field to string and remove all parsing logic.
This way, the unique global ID is stored in Id and target specific
target-id is stored in its string format. Stopped events fetch global ID
for thread identification.

This fix should also address [issue 1448](microsoft#1448).

Signed-off-by: intel-rganesh rakesh.ganesh@intel.com
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

No branches or pull requests

2 participants