-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Add direct way to access GDB client's current selected TID #147
Comments
Based on the GDB RSP docs for the From https://sourceware.org/gdb/current/onlinedocs/gdb.html/Packets.html#index-T-packet
While it's certainly possible that the GDB RSP docs are subtly incorrect, I don't recall ever finding an issue with those docs in the past... IIRC, its the So I'm not totally sure what's going on here... |
@jakab922, any updates here? I'll leave this open a while longer, but if there's no movement here, I'll likely close this as unactionable 😅 |
I added a workaround to the mentioned function. The thing is that the |
Is
...unless by "where one wants to set the breakpoint/watchpoint", you're referring to "what is the currently selected core"? If so, then you might be on to something... the current i.e: historically,
So, let me get your thoughts on two proposals:
The 1st option is, IMO, cleaner from an overall API design. That said - it will require a breaking change to implement, and I'm not sure I'm ready to cut The 2nd option does not require a breaking change, but it will be a bit less elegant, requiring users to do a bit of manual wiring between the Let me know if that makes sense, of if I'm misunderstanding anything |
T
messages are not handled correctly.
@jakab922, friendly ping :) Before implementing any changes, I want to make sure I've got a good grasp of the pain point / gap here. |
Sorry for the hiatus, I was busy with other things. I think handling the 'H' package is probably the best option. The '[zZ][0-4]' packages although support thread id based filtering but this is client side information only. Given that the official documentation says that the 'H' message selects a specific thread for subsequent operations I think storing the selected thread's id makes sense. I actually wasn't aware of this message and that was the reason I wanted to use the 'T' message for this. So in short I think option 2 is better. My current implementation is basically storing the selected id one layer below gdbstub and I added a python plugin which basically selects a thread and then sets a breakpoint or whatever needs to be done on the client side. It's not an ideal solution, but this is due to the nature of the gdb remote protocol which even it if let's users issue commands for specific threads that information is kept on the client side. |
No worries. The second approach of allowing users to hook into the 'H' packet via some sort of I'm a bit occupied with work / personal life at the moment, so I'm not sure I'll be able to implement this feature myself in the near future. That said - if you'd like to take a stab at implementing this and sending in a PR for it, I'll be more than happy to review, merge, and publish a new point-release of gdbstub with this feature :) Sidenote: GDB appears to have a 'native' way to set a thread-specific breakpoint: https://sourceware.org/gdb/current/onlinedocs/gdb.html/Thread_002dSpecific-Breakpoints.html It might be interesting to explore what packet sequence that feature actually corresponds to, in case we're missing some non-obvious third approach to supporting this sort of feature. |
In the gdb docs for handling threads there is the
thread <thread_id>
command listed for which the documentation is the following:When I issue
thread 1
on the client side a$T<client_side_thread_id>#<checksum>
message is sent to the server.On the server side this message is handled in here by calling is_thread_alive which is not quite right. This call should select a thread as active on a multithreaded environment rather than check if the thread is alive.
The reason this is an issue for me is because I have a multi core environment where each core supports hardware breakpoints and is represented by a thread on the server side. For someone to set a hardware breakpoint they need to issue the following commands for example:
I can add some thread activation logic to the
is_thread_alive
method, but it's a hack. What would be the right way to fix this?The text was updated successfully, but these errors were encountered: