Skip to content

Conversation

3rdit
Copy link

@3rdit 3rdit commented Oct 10, 2025

Added active_pid property to get the PID of the process that is currently being debugged. Returns 0 if unavailable or nothing is yet attached.

Implementation is added for every adapter, for GDB it's cached at connection time (as then we know the thread id equals the process pid).

@CLAassistant
Copy link

CLAassistant commented Oct 10, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@xusheng6 xusheng6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made two small comments. I will take care of them and then do some functionality tests

One thing that I am not sure about is that the debugger normally uses the DebuggerState object to cache the information about the target, e.g., the registers, threads, etc. And it is updated whenever necessary, e.g., when the target stops. This PR does not follow that pattern. However, I have not yet decided for things like the PID, whether we want it to be cached at all -- because it does not change very often, and it is also not frequently used

}


std::uint32_t QueuedAdapter::GetActivePID()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no need to change anything in queedadapter.cpp, it is a legacy file that is no longer used


uint32_t DebuggerController::GetActivePID()
{
std::lock_guard<std::mutex> lock(m_adapterMutex);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to take the lock here

@xusheng6 xusheng6 self-assigned this Oct 17, 2025
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.

3 participants