I have another question, if you guys don't mind :) It's related to what I'm
doing above, but if you think it'd be better for me to post this in a
separate thread, pls let me know.
So far, I'm able to print to a file and retrieve the stack trace. Also, for
the most part, I'm able to access DOM properties using the following code,
which I included in around the same location as above (i.e.,
ReportPendingMessages() in isolate.cc):
void Isolate::ReportPendingMessages() {
...
if (!message_obj->IsTheHole() && should_report_exception) {
...
/*NEW CODE STARTS HERE*/
...
//Create the code string
Local<v8::String> code = v8::String::NewFromUtf8(v8::Isolate::
GetCurrent(), "document.getElementById('the-header').tagName");
//Compile and run the code
Local<v8::Value> jsResult = v8::Script::Compile(code)->Run();
//Store the result in a buffer (in my case it's expected to be "H1",
so for now, I just hardcoded the buffer to
//have size 3, including the '\0' character)
if (jsResult->IsString()) {
Local<v8::String> jsResultStr = jsResult->ToString();
char buf[3];
jsResultStr->WriteUtf8(buf, 2);
buf[2] = '\0';
}
/*NEW CODE ENDS HERE*/
}
}
I ran the above code with Chrome Dev Tools open in Chrome (which, it turns
out, I needed to do in order to be able to retrieve the stack trace
easily), and with the Chrome process attached to the MS Visual Studio
debugger. The JS execution succeeds, with buf eventually being set to "H1",
as expected. However, V8 eventually crashes, with V8_Fatal() from
logging.cc outputting the following:
#
# Fatal error in c:\workspace\chromium\src\v8\src\isolate.cc, line 1650
# Check failed: has_pending_exception()
#
Note that line 1650 pertains to the first line of function
Isolate::OptionalRescheduleException(), which performs a DCHECK() on
has_pending_exception(). Also, the Visual Studio debugger breaks with the
following message:
Unhandled exception at 0x0000000000000000 in chrome.exe: 0xC00000005
Access violation executing location 0x0000000000000000
I looked up 0xC00000005, and it seems to correspond to a race condition.
What do you think might be happening here, and how do you think I can
prevent V8 from crashing? FWIW, the function V8_Fatal() supposedly
"contains protection against recursive calls (faults while handling
faults)".
Thanks again in advance! (Hopefully, it won't be as difficult finding the
JIT code address range and the local variables...)
Frolin
On Tuesday, January 12, 2016 at 2:49:53 AM UTC-8, Jakob Kummerow wrote:
>
> Try running Chrome with --no-sandbox (but note that this disables an
> important security mechanism and shouldn't be used to browse the open web).
>
>
> On Tue, Jan 12, 2016 at 2:35 AM, Frolin Ocariza <[email protected]
> <javascript:>> wrote:
>
>> Hi,
>>
>> I'm currently doing a research project that involves modifying the V8
>> code to gather some information about the JS execution (e.g., stack traces,
>> JIT code address info, DOM element modifications, etc.). FYI, I'm running
>> Chrome on my Surface 3, which is running Windows 10 Home (64-bit). I'm
>> using Microsoft Visual Studio 12.0 to build (and debug) Chrome.
>>
>> Right now, I'm simply trying to see how I can output the stack trace to a
>> file right before an error message is shown. To do so, I modified the
>> Isolate::ReportPendingMessages() function in isolate.cc to include the
>> following code:
>>
>> void Isolate::ReportPendingMessages() {
>> ...
>> if (!message_obj->IsTheHole() && should_report_exception) {
>> /*NEW CODE STARTS HERE*/
>> //First, get the stack trace string
>> Handle<String> st = StackTraceString();
>>
>> //Next, set up the output file using fopen
>> FILE * pFile;
>> pFile = fopen("C:\\sample_outputs\\jsbt_outputs_stack.txt", "w");
>> if (pFile != NULL) {
>> st->PrintOn(pFile);
>> }
>> else {
>> int a = errno;
>> ...
>> }
>> /*NEW CODE ENDS HERE*/
>> ...
>> }
>> }
>>
>> The problem is, when I run this code, fopen() always returns NULL, with
>> an errno of 13 (which means "Permission denied"). I've tried various
>> combinations of several things, including running my Chrome exe in admin
>> mode and changing the permissions for the output folder, but the same thing
>> happens (i.e., errno set to 13).
>>
>> Your help is much appreciated. Thanks in advance!
>>
>> Frolin
>>
>> --
>> --
>> v8-dev mailing list
>> [email protected] <javascript:>
>> http://groups.google.com/group/v8-dev
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "v8-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.