Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Issue 39124: Handle thread preemption in debugger (Closed)

Created:
11 years, 9 months ago by Søren Thygesen Gjesse
Modified:
9 years, 7 months ago
Reviewers:
iposva, Erik Corry
CC:
v8-dev
Visibility:
Public.

Description

All preemption requests are now ignored while in the debugger. This ensures that no change of V8 thread happenes while in the debugger. The only thing that happens is that a flag is set to indicate that preemption happened. When the debugger is left preemption is requested if it occourred while in the debugger. Moved the debugger related global variables from Top to thread local in Debug. Committed: http://code.google.com/p/v8/source/detail?r=1436

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 6

Patch Set 4 : '' #

Patch Set 5 : '' #

Total comments: 8

Patch Set 6 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+132 lines, -90 lines) Patch
M src/debug.h View 1 2 3 4 5 9 chunks +83 lines, -8 lines 0 comments Download
M src/debug.cc View 1 2 3 4 5 7 chunks +28 lines, -4 lines 0 comments Download
M src/execution.cc View 2 3 4 5 1 chunk +6 lines, -1 line 0 comments Download
M src/runtime.cc View 4 5 3 chunks +3 lines, -3 lines 0 comments Download
M src/top.h View 4 5 3 chunks +4 lines, -20 lines 0 comments Download
M src/top.cc View 4 5 3 chunks +0 lines, -45 lines 0 comments Download
M test/cctest/test-debug.cc View 4 5 9 chunks +8 lines, -9 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Søren Thygesen Gjesse
11 years, 9 months ago (2009-03-04 11:13:20 UTC) #1
Søren Thygesen Gjesse
Updated to handle this entirely in the V8 thread being debugged as discussed off-line.
11 years, 9 months ago (2009-03-04 15:36:31 UTC) #2
Søren Thygesen Gjesse
Moved the debugger entry and preemption pending flag from a global variable to a thread ...
11 years, 9 months ago (2009-03-05 07:32:34 UTC) #3
Erik Corry
LGTM http://codereview.chromium.org/39124/diff/19/1003 File src/debug.h (right): http://codereview.chromium.org/39124/diff/19/1003#newcode361 Line 361: // Preemption happened while debugging full stop ...
11 years, 9 months ago (2009-03-05 09:42:51 UTC) #4
Søren Thygesen Gjesse
http://codereview.chromium.org/39124/diff/19/1003 File src/debug.h (right): http://codereview.chromium.org/39124/diff/19/1003#newcode361 Line 361: // Preemption happened while debugging On 2009/03/05 09:42:51, ...
11 years, 9 months ago (2009-03-05 16:11:23 UTC) #5
Søren Thygesen Gjesse
Updated the CL to move the debugger related global variables from Top to thread local ...
11 years, 9 months ago (2009-03-05 16:19:48 UTC) #6
iposva
At the moment I cannot find any threading related issues with the code anymore. Some ...
11 years, 9 months ago (2009-03-06 09:25:35 UTC) #7
Søren Thygesen Gjesse
11 years, 9 months ago (2009-03-06 09:52:36 UTC) #8
http://codereview.chromium.org/39124/diff/1015/30
File src/debug.h (right):

http://codereview.chromium.org/39124/diff/1015/30#newcode574
Line 574: // If a preemption is pending clear it and store this information.
On 2009/03/06 09:25:35, iposva wrote:
> Comment does not match with the code.
> Why do you need to test if prev_ is NULL?
> You are not recording the pending preemption in this case. Did you miss to
> uncomment your setting of the preemption bit after testing? Otherwise if you
do
> not intend to set it, then you should remove the commented code.
> 
> 

Sorry, I forgot to un-comment code after doing some testing. Without storing the
preemption state when the debugger is first entered and restoring it when it is
left I can get starvation in some debugging scenarios. Extended the comment with
this information.

http://codereview.chromium.org/39124/diff/1015/30#newcode607
Line 607: if (prev_ == NULL && Debug::preemption_pending()) {
On 2009/03/06 09:25:35, iposva wrote:
> Please add a comment why you test for prev_ being NULL. For example:
> 
> // Request preemption when leaving the last debugger entry and a preemption
had
> been recorded while debugging. 

Clarified commet.

http://codereview.chromium.org/39124/diff/1015/32
File src/execution.cc (right):

http://codereview.chromium.org/39124/diff/1015/32#newcode527
Line 527: if (!Debug::InDebugger()) {
On 2009/03/06 09:25:35, iposva wrote:
> I would probably turn this around to not get the NOT in the test for
readability
> and then the comment also is closer to the described action.

Done.

http://codereview.chromium.org/39124/diff/1015/33
File test/cctest/test-debug.cc (right):

http://codereview.chromium.org/39124/diff/1015/33#newcode53
Line 53: using ::v8::internal::DeleteArray;
On 2009/03/06 09:25:35, iposva wrote:
> Why did you have to add these?

Removed - left over from temporary test cases.

Powered by Google App Engine
This is Rietveld 408576698