Skip to content

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

Open

Description

@oold

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"}]

Activity

  1. iyerrakesh commented on Jul 17, 2024

    @iyerrakesh

    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(),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions