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

Issue 1087383002: Add support for debug break in Dart source. (Closed)

Created:
5 years, 8 months ago by regis
Modified:
5 years, 8 months ago
Reviewers:
Cutch, srdjan, Ivan Posva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Add support for debug break in Dart source. The new flag --enable-debug-break turns the otherwise illegal Dart statement break "message"; into a break instruction preceded with a debug message, the equivalent of emitting an Assembler::Stop("message"). Add a language test expecting a syntax error without the flag. Change expected break instruction in arm64 simulator. Remove constants related to now deleted simulator tracing on mips and arm64. R=johnmccutchan@google.com, srdjan@google.com Committed: https://code.google.com/p/dart/source/detail?r=45218

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+153 lines, -12 lines) Patch
M runtime/vm/ast.h View 2 chunks +22 lines, -0 lines 0 comments Download
M runtime/vm/ast_printer.cc View 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/ast_transformer.cc View 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/constant_propagator.cc View 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/constants_arm64.h View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M runtime/vm/constants_mips.h View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M runtime/vm/flow_graph_builder.cc View 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language.h View 1 2 chunks +27 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language_arm.cc View 1 chunk +11 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language_arm64.cc View 1 chunk +11 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language_ia32.cc View 1 chunk +11 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language_mips.cc View 1 chunk +11 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language_x64.cc View 1 chunk +11 lines, -0 lines 0 comments Download
M runtime/vm/parser.cc View 1 2 3 chunks +8 lines, -1 line 3 comments Download
M runtime/vm/simulator_arm64.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/simulator_mips.cc View 1 2 1 chunk +0 lines, -6 lines 0 comments Download
A tests/language/vm/debug_break_vm_test.dart View 1 2 1 chunk +22 lines, -0 lines 2 comments Download

Messages

Total messages: 10 (1 generated)
regis
This is the next attempt. Srdjan, can you please check that my new StopInstr class ...
5 years, 8 months ago (2015-04-15 23:35:22 UTC) #2
Cutch
LGTM with a test that fails to compile without the flag.
5 years, 8 months ago (2015-04-16 00:17:00 UTC) #3
regis
On 2015/04/16 00:17:00, Cutch wrote: > LGTM with a test that fails to compile without ...
5 years, 8 months ago (2015-04-16 18:14:31 UTC) #4
srdjan
lgtm
5 years, 8 months ago (2015-04-16 18:23:02 UTC) #5
regis
Committed patchset #3 (id:40001) manually as r45218 (presubmit successful).
5 years, 8 months ago (2015-04-16 19:33:04 UTC) #6
Ivan Posva
Thanks for changing this around so much! Small comments added... -Ivan https://codereview.chromium.org/1087383002/diff/40001/runtime/vm/parser.cc File runtime/vm/parser.cc (right): ...
5 years, 8 months ago (2015-04-16 21:44:51 UTC) #7
Ivan Posva
https://codereview.chromium.org/1087383002/diff/40001/runtime/vm/parser.cc File runtime/vm/parser.cc (right): https://codereview.chromium.org/1087383002/diff/40001/runtime/vm/parser.cc#newcode9569 runtime/vm/parser.cc:9569: const char* message = strdup(CurrentLiteral()->ToCString()); On 2015/04/16 21:44:51, Ivan ...
5 years, 8 months ago (2015-04-16 21:47:05 UTC) #8
regis
> Thanks for changing this around so much! You are welcome. https://codereview.chromium.org/1087383002/diff/40001/runtime/vm/parser.cc File runtime/vm/parser.cc (right): ...
5 years, 8 months ago (2015-04-16 22:17:04 UTC) #9
regis
5 years, 8 months ago (2015-04-16 22:37:21 UTC) #10
Message was sent while issue was closed.
On 2015/04/16 22:17:04, regis wrote:
> > Thanks for changing this around so much!
> 
> You are welcome.
> 
> https://codereview.chromium.org/1087383002/diff/40001/runtime/vm/parser.cc
> File runtime/vm/parser.cc (right):
> 
>
https://codereview.chromium.org/1087383002/diff/40001/runtime/vm/parser.cc#ne...
> runtime/vm/parser.cc:9569: const char* message =
> strdup(CurrentLiteral()->ToCString());
> On 2015/04/16 21:47:05, Ivan Posva wrote:
> > On 2015/04/16 21:44:51, Ivan Posva wrote:
> > > Who is responsible for freeing this memory?
> > 
> > Got the answer for this one: Stop does not do a strdup. It is the related
> > Unimplemented and similar which do allocate the final string.
> 
> Yes, the strdup is necessary, since the literal string gets freed before
> execution. We have many other places allocating error strings with malloc.
> 
>
https://codereview.chromium.org/1087383002/diff/40001/tests/language/vm/debug...
> File tests/language/vm/debug_break_vm_test.dart (right):
> 
>
https://codereview.chromium.org/1087383002/diff/40001/tests/language/vm/debug...
> tests/language/vm/debug_break_vm_test.dart:4: //
> VMOptions=--optimization-counter-threshold=5
> On 2015/04/16 21:44:51, Ivan Posva wrote:
> > Is there any particular reason for using a special optimization count
> threshold
> > in this test? Is so (optimized code?) then please add a comment.
> 
> Yes and no.
> Ideally, I would like to test two different flag configurations, which I could
> specify with 2 lines:
> // VMOptions=--optimization-counter-threshold=5
> // VMOptions=--optimization-counter-threshold=5 --enable-debug-break
> 
> However, I cannot specify different expected results for the second line. In
> that case, I do not expect a compile-time error, but I want to hit the debug
> break at runtime. I also do not want to crash at compile time while optimizing
> the new StopInstr. This actually happened with patch #1, because I wrongly
> assumed that the optimizer would not see this instruction (see
> intermediate_language.h in patch #1).
> 
> In short, the optimization count threshold is only useful when running this
test
> by hand and adding the --enable-debug-break flag. I allowed me to test and fix
> patch #1.
> 
> I will add a comment.

One more detail: Instead of adding a different VMOptions= line in the same test
(not possible because a different outcome cannot be specified), I could have
added a copy of the test with both --optimization-counter-threshold=5 and
--enable-debug-break, but I was not sure how to make the difference between an
optimizer crash or hitting the breakpoint at runtime, which is also a crash.

Now that I think of it, the second test could actually be written so that the
breakpoint is only compiled but never hit, so no crash. That would only test the
optimizer, not the actual debug break functionality.

Let me try that.

Powered by Google App Engine
This is Rietveld 408576698