Uh oh!
There was an error while loading. Please reload this page.
Use local variable instead of instance variable to store the current thread client - #293
Use local variable instead of instance variable to store the current thread client#293st0012 wants to merge 4 commits into
Conversation
16c137c to
6c66c17Compare| assert_line_text( | ||
| [ | ||
| /#0 \(#{POSSIBLE_STATES}\)@.*:\d+:in `<main>'/, | ||
| /--> #1 \(#{POSSIBLE_STATES}\)/ |
There was a problem hiding this comment.
@ko1 I've tried various approaches but I can't find a way to make sure a thread is in the under control state, no matter it's running or sleeping. So I need to skip this case first to avoid randomly breaking tests.
ko1
commented
Sep 21, 2021
Sorry I can't understand the chart. How to read it? |
|
So do I'm not sure (1) why there are two events from TC-1 at the same time (2) why session is finished. |
st0012
commented
Sep 23, 2021
@ko1 that's a typo 🤦♂️ I meant x-axis is time, sorry. |
6c66c17 to
36ab038Compareko1
commented
Sep 23, 2021
Ah, I see. Your opinion is, using local variables is cleaner than using ivars. Let me consider about that. |
ko1
commented
Sep 29, 2021
Now, I'm thinking current ivar approach is better because most of methods are limited run in session server and there is no danger to introduce wrong ivar ( This assertion (methods should run only in session server) should be guaranteed by the code. |
@ko1 I know it'd be a bug if For example, # this would workrepl_add_breakpointstep_command# this would breakstep_commandrepl_add_breakpointI can see myself getting bitten by this kind of implicit ordering when developing features in the future. (I spotted this when experimenting with TUI support). So the idea is that if we can make |
36ab038 to
01704c5Compare01704c5 to
e70d2dbCompare
In the current design, thread clients' relationship with the debugger session looks like this
It always comes with an event and doesn't stay in the session after the event is processed.
But because it's currently stored in the session's instance variable
@tc, we need to manage its state manually to make suredebug/lib/debug/session.rb
Lines 296 to 298 in 07c1a7c
debug/lib/debug/session.rb
Lines 1344 to 1353 in 07c1a7c
Also, its availability is not guaranteed when processing different commands. For example, if the command is
step, the@tcwill benil(reseted byrestart_all_threads) until the next event sets its thread client. But if the command isbt,@tcwill be remain unchanged.Although none of these behaviors are causing issues, I think by making it a local variable we can: