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

Issue 9288071: Add debugger functions to inspect objects and classes (Closed)

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

Description

Add debugger functions to inspect objects and classes. Next steps: inspect global variables, better support for inspecting local variables on stack. Committed: https://code.google.com/p/dart/source/detail?r=3634

Patch Set 1 #

Total comments: 10

Patch Set 2 : Add debugger functions to inspect objects and classes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+336 lines, -14 lines) Patch
M runtime/include/dart_debugger_api.h View 1 1 chunk +50 lines, -0 lines 0 comments Download
M runtime/vm/debugger.h View 1 2 chunks +10 lines, -0 lines 0 comments Download
M runtime/vm/debugger.cc View 1 5 chunks +107 lines, -4 lines 0 comments Download
M runtime/vm/debugger_api_impl.cc View 1 1 chunk +42 lines, -0 lines 0 comments Download
M runtime/vm/debugger_api_impl_test.cc View 1 3 chunks +127 lines, -10 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
hausner
8 years, 11 months ago (2012-01-26 18:49:08 UTC) #1
siva
LGTM http://codereview.chromium.org/9288071/diff/1/runtime/include/dart_debugger_api.h File runtime/include/dart_debugger_api.h (right): http://codereview.chromium.org/9288071/diff/1/runtime/include/dart_debugger_api.h#newcode178 runtime/include/dart_debugger_api.h:178: DART_EXPORT Dart_Handle Dart_GetSuperclass(Dart_Handle cls); Where do you intend ...
8 years, 11 months ago (2012-01-26 21:34:08 UTC) #2
hausner
8 years, 11 months ago (2012-01-27 17:19:30 UTC) #3
Thanks Siva.

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

http://codereview.chromium.org/9288071/diff/1/runtime/include/dart_debugger_a...
runtime/include/dart_debugger_api.h:178: DART_EXPORT Dart_Handle
Dart_GetSuperclass(Dart_Handle cls);
On 2012/01/26 21:34:08, asiva wrote:
> Where do you intend to use these two class methods?
> 
> Is it to get a dump of the class definition?

I'm pretty sure a debugger would like to know what the class of an object is, so
it can annotate the variable or field with the type if it wants to. Walking the
superclass chain will be handy in the same way.

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

http://codereview.chromium.org/9288071/diff/1/runtime/vm/debugger.cc#newcode431
runtime/vm/debugger.cc:431: noArguments, noArgumentNames);
On 2012/01/26 21:34:08, asiva wrote:
> Until Todd implements his change of capturing all errors and propagating them
> without the need for setjmp/longjmp wouldn't we need a setjmp/longjmp around
> this (in case the getter method was never executed and hence never compiled)
Good point. The compilation part is taken care of in DartEntry, but there could
be compile or runtime errors to catch.

I initially thought of using the Dart_InvokeXXX functions but didn't want to
deal with the Dart_Handle stuff.

Fixed by allowing the result array of field names and values to contain Error
objects. This way, the debugger can display the error object instead of the
value for that particular field.

http://codereview.chromium.org/9288071/diff/1/runtime/vm/debugger.cc#newcode442
runtime/vm/debugger.cc:442: return DartEntry::InvokeStatic(getter_func,
noArguments, noArgumentNames);
On 2012/01/26 21:34:08, asiva wrote:
> Ditto comment about setjmp/longjmp.

Done.

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

http://codereview.chromium.org/9288071/diff/1/runtime/vm/debugger.h#newcode147
runtime/vm/debugger.h:147: RawArray* GetInstanceFields(const Instance& obj);
On 2012/01/26 21:34:08, asiva wrote:
> I am wondering whether it would make sense to just have
> 
> RawArray* GetFields(const Instance& obj);
> 
> Which lists all the fields and tags the static fields with a static qualifier.
> 
> Also do you think we need to dump the native fields of an object if present?

I was envisioning that the static fields of a class would be displayed at a
different place in the debugger, so separating them made sense. Also, how would
you qualify static fields? Adding a third array element per field seems totally
overkill for that.

http://codereview.chromium.org/9288071/diff/1/runtime/vm/debugger.h#newcode157
runtime/vm/debugger.h:157: const String& field_name);
On 2012/01/26 21:34:08, asiva wrote:
> There is a certain amount of overlap between these functions and the ones in
> dart_api_impl.cc
> Dart_GetInstanceField
> Dart_GetStaticField
> Maybe we should move your implementation to dart_entry.h and use it both from
> here and the dart_api functions.

I looked at that code when I implemented this. The difference is that the code
in dart_api_impl does a lookup whether the field actually exists, whereas these
functions require that the field exists (the lookup is done by the caller).
Also, I didn't want to deal with setters.

I did see that the dart_api_impl code is out of date (does not use some of the
getter lookup code you recently added) so I'll add a todo that long-term we
should refactor this code.

Powered by Google App Engine
This is Rietveld 408576698