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

Issue 9240014: Set breakpoint at url, line number (Closed)

Created:
8 years, 11 months ago by hausner
Modified:
8 years, 11 months ago
Reviewers:
siva
CC:
reviews_dartlang.org, Anton Muhin, podivilov1
Visibility:
Public.

Description

Set breakpoint at url, line number Add debugger functionality to set breakpoint at given url and line number. Committed: https://code.google.com/p/dart/source/detail?r=3420

Patch Set 1 #

Total comments: 26

Patch Set 2 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+375 lines, -33 lines) Patch
M runtime/bin/main.cc View 1 2 chunks +36 lines, -16 lines 0 comments Download
M runtime/include/dart_debugger_api.h View 1 2 chunks +19 lines, -0 lines 0 comments Download
M runtime/vm/debugger.h View 1 2 chunks +4 lines, -0 lines 0 comments Download
M runtime/vm/debugger.cc View 1 4 chunks +54 lines, -6 lines 0 comments Download
M runtime/vm/debugger_api_impl.cc View 1 1 chunk +46 lines, -0 lines 0 comments Download
M runtime/vm/object.h View 1 8 chunks +18 lines, -2 lines 0 comments Download
M runtime/vm/object.cc View 1 4 chunks +115 lines, -0 lines 0 comments Download
M runtime/vm/parser.cc View 1 5 chunks +7 lines, -0 lines 0 comments Download
M runtime/vm/raw_object.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/raw_object_snapshot.cc View 1 2 chunks +2 lines, -0 lines 0 comments Download
M runtime/vm/scanner.h View 1 3 chunks +8 lines, -0 lines 0 comments Download
M runtime/vm/scanner.cc View 1 3 chunks +47 lines, -9 lines 0 comments Download
M runtime/vm/scanner_test.cc View 1 2 chunks +18 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
hausner
8 years, 11 months ago (2012-01-17 19:28:47 UTC) #1
hausner
Adding Anton and Pavel to cc list.
8 years, 11 months ago (2012-01-17 22:58:46 UTC) #2
siva
LGTM with some comments. http://codereview.chromium.org/9240014/diff/1/runtime/bin/main.cc File runtime/bin/main.cc (right): http://codereview.chromium.org/9240014/diff/1/runtime/bin/main.cc#newcode363 runtime/bin/main.cc:363: Dart_Handle library) { indentation? http://codereview.chromium.org/9240014/diff/1/runtime/bin/main.cc#newcode372 ...
8 years, 11 months ago (2012-01-18 01:32:03 UTC) #3
hausner
8 years, 11 months ago (2012-01-18 23:26:38 UTC) #4
Thanks for the review. Additional unit tests will follow in subsequent checkins.

http://codereview.chromium.org/9240014/diff/1/runtime/bin/main.cc
File runtime/bin/main.cc (right):

http://codereview.chromium.org/9240014/diff/1/runtime/bin/main.cc#newcode363
runtime/bin/main.cc:363: Dart_Handle library) {
On 2012/01/18 01:32:03, asiva wrote:
> indentation?

Done.

http://codereview.chromium.org/9240014/diff/1/runtime/bin/main.cc#newcode372
runtime/bin/main.cc:372: url = Dart_NewString(bpt_line);
On 2012/01/18 01:32:03, asiva wrote:
> Dart_Handle url = ....;

Done.

http://codereview.chromium.org/9240014/diff/1/runtime/bin/main.cc#newcode373
runtime/bin/main.cc:373: line_number = Dart_NewInteger(atoi(colon + 1));
On 2012/01/18 01:32:03, asiva wrote:
> Dart_Handle line_number = ...;
> 
> Also we may want to protect against input strings of the form "myurl:"

This is really just a make-shift UI for me to test the debugger functions, so I
don't think i need all the error handling of an end-user feature. Agree?

http://codereview.chromium.org/9240014/diff/1/runtime/bin/main.cc#newcode388
runtime/bin/main.cc:388: function_name = Dart_NewString(dot + 1);
On 2012/01/18 01:32:03, asiva wrote:
> We may want to protect against input strings of the form "myclass."

Ditto

http://codereview.chromium.org/9240014/diff/1/runtime/include/dart_debugger_a...
File runtime/include/dart_debugger_api.h (right):

http://codereview.chromium.org/9240014/diff/1/runtime/include/dart_debugger_a...
runtime/include/dart_debugger_api.h:29: *
On 2012/01/18 01:32:03, asiva wrote:
> Will it point to the existing breakpoint if a breakpoint already exists at the
> specified script_url and line number?

Good question. So far, there are no such checks but I'll have to add them.

http://codereview.chromium.org/9240014/diff/1/runtime/include/dart_debugger_a...
runtime/include/dart_debugger_api.h:46: *   if a breakpoint was successfully
created.
On 2012/01/18 01:32:03, asiva wrote:
> Ditto comment regarding breakpoint already existing?
Ditto answer.

http://codereview.chromium.org/9240014/diff/1/runtime/vm/debugger.cc
File runtime/vm/debugger.cc (right):

http://codereview.chromium.org/9240014/diff/1/runtime/vm/debugger.cc#newcode283
runtime/vm/debugger.cc:283: }
On 2012/01/18 01:32:03, asiva wrote:
> Shouldn't we check in the breakpoint list that you have to see if a breakpoint
> already exists at this function/token_index?
> 
> Maybe a TODO here if you want to do this in another CL.

Done

http://codereview.chromium.org/9240014/diff/1/runtime/vm/debugger.cc#newcode293
runtime/vm/debugger.cc:293: }
On 2012/01/18 01:32:03, asiva wrote:
> If 'i' happens to be the last descriptor in this function does it make sense
to
> set a breakpoint at this index as we won't find anymore descriptors and will
end
> up not setting a breakpoint.
We return NULL if there is no possible PC location for a breakpoint after the
requested breakpoint location. If the requested breakpoint location is
(textually) outside the function, we don't even get here in the first place.

http://codereview.chromium.org/9240014/diff/1/runtime/vm/debugger.cc#newcode317
runtime/vm/debugger.cc:317: }
On 2012/01/18 01:32:03, asiva wrote:
> why did you drop "return NULL"; ?
Accident. I need automated test cases sooner than later. Thanks!

http://codereview.chromium.org/9240014/diff/1/runtime/vm/debugger_api_impl.cc
File runtime/vm/debugger_api_impl.cc (right):

http://codereview.chromium.org/9240014/diff/1/runtime/vm/debugger_api_impl.cc...
runtime/vm/debugger_api_impl.cc:138: Debugger* debugger = isolate->debugger();
On 2012/01/18 01:32:03, asiva wrote:
> ASSERT(debugger != NULL);

Done.

http://codereview.chromium.org/9240014/diff/1/runtime/vm/object.cc
File runtime/vm/object.cc (right):

http://codereview.chromium.org/9240014/diff/1/runtime/vm/object.cc#newcode1596
runtime/vm/object.cc:1596: (token_index < func.end_token_index())) {
On 2012/01/18 01:32:03, asiva wrote:
> Maybe function could have a method
> bool containsTokenIndex(intptr_t token_index);
> 
> as the same condition is repeated in LookupFUnctionInScript.

Yes, but I don't think the code becomes more readable if we make too many
one-liner functions. If you feel strongly about it, I can add the function,
otherwise I prefer to leave it out.

http://codereview.chromium.org/9240014/diff/1/runtime/vm/object.cc#newcode4065
runtime/vm/object.cc:4065: }
On 2012/01/18 01:32:03, asiva wrote:
> It might be worthwhile to add an unit test for this function.

Will do in a later change. I gave it a try but ran into asserts because the unit
test code apparently does not set up libraries exactly right. I'll look at that
later.

http://codereview.chromium.org/9240014/diff/1/runtime/vm/raw_object.h
File runtime/vm/raw_object.h (right):

http://codereview.chromium.org/9240014/diff/1/runtime/vm/raw_object.h#newcode494
runtime/vm/raw_object.h:494: intptr_t end_token_index_;
On 2012/01/18 01:32:03, asiva wrote:
> This new field needs to be written out and read in raw_object_snapshot.cc
Good catch. Done.

Powered by Google App Engine
This is Rietveld 408576698