JSON_JSONStream_DartObject used to elide a JSON string longer
than 1024 into a buffer of 1024 bytes, which was causing memory
issues, including tripping ASAN.
This is fixed by doubling the buffer.
This CL also adds ASSERTs to ensure all buffers used with
`ElideJSONSubstring(..)` are big enough.
TEST=Existing, updated tests.
Bug: https://github.com/dart-lang/sdk/issues/46246
Change-Id: I7ce86429efecd91e768be413fd86f7d3c53c5d52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202244
Auto-Submit: Clement Skau <cskau@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Token position and script reference information are cheap to provide and
make it possible to tie objects to scripts without requiring additional
requests for full objects.
TEST=Existing
Change-Id: I917714149a72a53081fee5626ccad858e86f5313
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201864
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Generally, methods that take a *TextBuffer pointer do not care how the
internal buffer is allocated, and so they could be used for either if
both were subclasses of a base class that contained the printing
methods. This CL makes that base class, and now TextBuffer and
ZoneTextBuffer now share the exact same set of methods for printing to
the internal buffer.
Since the base class is in platform, this does mean dropping the
overload of AddString for Dart String objects that was part of
ZoneTextBuffer. Instead, this CL just adds an intermediate call to
ToCString() for the small number of callers that used the overload,
keeping the printing interface the same for both.
In addition, one use of TextBuffer that then re-allocated the buffer
contents into the zone manually has been replaced with a ZoneTextBuffer
instead.
Change-Id: I438a085e7e20d55d93987fd7f36afd636f95955f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157741
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
For example setting return value unwraps handles and stores
raw pointer values to the stack which might race with GC
in another thread.
This CL adds assertions in helper methods from Api class which
unwrap API handles and fixes all places that were revealed by
those assertions.
Caveat: we still permit to check whether handle contains
Smi or not without entering VM state - because GC does not
change this property.
Bug: b/127482366
Change-Id: I59f08c2a91935995514fb70607c2777aa2844d94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95654
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Threads in the native or blocked states don't prevent safepoints, so they may run concurrently with a safepoint operation like GC. It is not safe for handles to be allocated while the GC is visiting them, so these threads must not allocate handles. Assert only threads in the VM or generated states, which prevent safepoints until they check in, may allocate handles. (Generated code does not allocate handles, but leaf runtime entries remain in the generated state.)
Bug: https://github.com/dart-lang/sdk/issues/34883
Change-Id: I1a211778f7ef96b53a2405f0ee9dde7871b122b6
Reviewed-on: https://dart-review.googlesource.com/c/81540
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Avoids string copies in C++ and map copies in Dart.
Also remove some vestiages of removed feature that allowed an embedder to add pre-encoded events to the timeline.
Change-Id: I962a67093ba461c991d9169b0391c44af1d489db
Bug: https://github.com/dart-lang/sdk/issues/30787
Reviewed-on: https://dart-review.googlesource.com/6762
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Service
- Remove support for old-style service requests.
- Drop 'arguments' from JsonStream and ServiceRequestHandler.
- Json-rpc inspired renaming: command->method, options->params all over.
- Implement getFlagList, setFlag, getObjectByAddress.
- Add helpers PrintMissingParamError and PrintInvalidParamError
to make our error messages more regular.
- Update tests.
- Service_SetSource removed for now. John will resurrect.
Observatory
- Drop all Deprecated 'get' functions. We now use json rpc for everything.
- Drop 'link' and 'relativeLink' from ServiceObject -- they were
ui-specific and they are no longer meaningful anyways. Use 'id' instead.
- New pages: VMPage, FlagsPage, InspectPage, ErrorPage. All urls
used by Observatory are now 'new school' and have a proper
prefix. ErrorPage is the new catch-all.
- Pages now use a Uri instead of a url String. This lets them
grab query parameters more easily.
- SimplePage replaces IsolateSuffixPage.
- We now use gotoLink() or makeLink() to make our navigation
links. gotoLink gets some optional parameters to make it
easier to construct links to ServiceObjects.
- Rework mouse clicks on the heap map to use getObjectByAddress.
- Remove the breakpoint_list. It wasn't working. I'll add it back later.
- Silence logging of getIsolateMetric/getVMMetric.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//897193002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43514 260f80e4-7a28-3924-810f-c04153c831b5
We now return a "type" property and an optional "_vmType" property for
each response. We use this to "hide" vm implementation specifics in
the VM Service protocol.
For example, before we might have returned an integer reference with type
"@Smi". Now it would have the type "@int" and the _vmType "@Smi".
This also allows us to hide funky vm internal types behind the generic
"Object" type.
Updated the protocol.md file somewhat to describe a notion of "private
properties".
Updated the Observatory and unit tests.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//547703002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40044 260f80e4-7a28-3924-810f-c04153c831b5
The debugger wire handler is implemented similarly to the io event handler.
A dedicated thread monitors the debugger port for incoming connection
requests. When a debugger is connected, the VM sends events messages
over the wire and handles debugger requests.
To start the VM with a debugger connection, use the option
--debug:<portnumber>. The VM pauses at the beginning of main()
and waits for a debugger to connect.
Subsequent changes will implement debugger commands one by one.
With this change, the VM only understands "resume" commands.
Review URL: https://chromiumcodereview.appspot.com//10357003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7330 260f80e4-7a28-3924-810f-c04153c831b5