Make v8dbg_ symbols V8_EXPORT so they can be exposed from Chrome builds

Extend gen-postmortem-metadata.py with selected register values.

This information is not present in DWARF debuginfo. Exposing it
enables detailed analysis of V8 JS execution by observing binary-level
execution:
https://robert.ocallahan.org/2020/05/omniscient-js-debugging-in-pernosco.html

Bug: v8:11106
Change-Id: I3bde7dd07ac5ba6ff00d4a5fa9b635871507a866
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2518957
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71035}
This commit is contained in:
Robert O'Callahan 2020-11-08 00:17:30 +13:00 committed by Commit Bot
parent 27900f17b8
commit f0441fb990
2 changed files with 14 additions and 2 deletions

View File

@ -187,6 +187,7 @@ Rob Wu <rob@robwu.nl>
Robert Meijer <robert.s.meijer@gmail.com>
Robert Mustacchi <rm@fingolfin.org>
Robert Nagy <robert.nagy@gmail.com>
Robert O'Callahan <rocallahan@gmail.com>
Rong Wang <wangrong089@gmail.com>
Ross Kirsling <rkirsling@gmail.com>
Ruben Bridgewater <ruben@bridgewater.de>

View File

@ -101,6 +101,16 @@ consts_misc = [
{ 'name': 'OddballOther', 'value': 'Oddball::kOther' },
{ 'name': 'OddballException', 'value': 'Oddball::kException' },
{ 'name': 'ContextRegister', 'value': 'kContextRegister.code()' },
{ 'name': 'ReturnRegister0', 'value': 'kReturnRegister0.code()' },
{ 'name': 'JSFunctionRegister', 'value': 'kJSFunctionRegister.code()' },
{ 'name': 'InterpreterBytecodeOffsetRegister',
'value': 'kInterpreterBytecodeOffsetRegister.code()' },
{ 'name': 'InterpreterBytecodeArrayRegister',
'value': 'kInterpreterBytecodeArrayRegister.code()' },
{ 'name': 'RuntimeCallFunctionRegister',
'value': 'kRuntimeCallFunctionRegister.code()' },
{ 'name': 'prop_kind_Data',
'value': 'kData' },
{ 'name': 'prop_kind_Accessor',
@ -307,6 +317,7 @@ header = '''
*/
#include "src/init/v8.h"
#include "src/codegen/register-arch.h"
#include "src/execution/frames.h"
#include "src/execution/frames-inl.h" /* for architecture-specific frame constants */
#include "src/objects/contexts.h"
@ -322,7 +333,7 @@ extern "C" {
/* stack frame constants */
#define FRAME_CONST(value, klass) \
int v8dbg_frametype_##klass = StackFrame::value;
V8_EXPORT int v8dbg_frametype_##klass = StackFrame::value;
STACK_FRAME_TYPE_LIST(FRAME_CONST)
@ -675,7 +686,7 @@ def emit_set(out, consts):
for const in consts:
name = ws.sub('', const['name'])
value = ws.sub('', str(const['value'])) # Can be a number.
lines.add('int v8dbg_%s = %s;\n' % (name, value))
lines.add('V8_EXPORT int v8dbg_%s = %s;\n' % (name, value))
for line in lines:
out.write(line);