Commit 66251fba authored by Matheus Marchini's avatar Matheus Marchini Committed by Commit Bot

[postmortem] generate more comprehensive metadata

Improve postmortem metadata generated by gen-postmortem-metadata by also
including weak and synchronous accessors, as well as CHECKED and
CHECKED2 variants of all accessors currently considered by
gen-postmortem-metadata. Also improve type collection by parsing
TORQUE_INSTANCE_CHECKERS_SINGLE_FULLY_DEFINED, as we were missing
several types with the previous heuristic (like StackTraceFrame,
PromiseReaction, and many others). This will include 96 new v8dbg
constants which can be used by debuggers like llnode.

R=hpayer@google.com, verwaest@google.com, victorgomes@google.com

Change-Id: Ia9bea21eec38b92d255c3636c6a284eb27e9ed9b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2056126Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66551}
parent 069970e1
......@@ -380,9 +380,11 @@ def load_objects_from_file(objfilename, checktypes):
objfile = io.open(objfilename, 'r', encoding='utf-8');
in_insttype = False;
in_torque_insttype = False
in_torque_fulldef = False
typestr = '';
torque_typestr = ''
torque_fulldefstr = ''
uncommented_file = ''
#
......@@ -400,6 +402,10 @@ def load_objects_from_file(objfilename, checktypes):
in_torque_insttype = True
continue
if (line.startswith('#define TORQUE_INSTANCE_CHECKERS_SINGLE_FULLY_DEFINED')):
in_torque_fulldef = True
continue
if (in_insttype and line.startswith('};')):
in_insttype = False;
continue;
......@@ -408,6 +414,10 @@ def load_objects_from_file(objfilename, checktypes):
in_torque_insttype = False
continue
if (in_torque_fulldef and (not line or line.isspace())):
in_torque_fulldef = False
continue
line = re.sub('//.*', '', line.strip());
if (in_insttype):
......@@ -418,6 +428,10 @@ def load_objects_from_file(objfilename, checktypes):
torque_typestr += line
continue
if (in_torque_fulldef):
torque_fulldefstr += line
continue
uncommented_file += '\n' + line
for match in re.finditer(r'\nclass(?:\s+V8_EXPORT(?:_PRIVATE)?)?'
......@@ -448,7 +462,18 @@ def load_objects_from_file(objfilename, checktypes):
entries = torque_typestr.split('\\')
for entry in entries:
types[re.sub(r' *V\(|\) *', '', entry)] = True
entries = torque_fulldefstr.split('\\')
for entry in entries:
entry = entry.strip()
if not entry:
continue
idx = entry.find('(');
rest = entry[idx + 1: len(entry) - 1];
args = re.split('\s*,\s*', rest);
typename = args[0]
typeconst = args[1]
types[typeconst] = True
typeclasses[typeconst] = typename
#
# Infer class names for each type based on a systematic transformation.
# For example, "JS_FUNCTION_TYPE" becomes "JSFunction". We find the
......@@ -551,25 +576,24 @@ def parse_field(call):
consts = [];
if (kind == 'ACCESSORS' or kind == 'ACCESSORS2' or
kind == 'ACCESSORS_GCSAFE'):
klass = args[0];
field = args[1];
klass = args[0];
field = args[1];
dtype = None
offset = None
if kind.startswith('WEAK_ACCESSORS'):
dtype = 'weak'
offset = args[2];
elif not (kind.startswith('SMI_ACCESSORS') or kind.startswith('ACCESSORS_TO_SMI')):
dtype = args[2].replace('<', '_').replace('>', '_')
offset = args[3];
else:
offset = args[2];
dtype = 'SMI'
return ({
'name': 'class_%s__%s__%s' % (klass, field, dtype),
'value': '%s::%s' % (klass, offset)
});
assert(kind == 'SMI_ACCESSORS' or kind == 'ACCESSORS_TO_SMI');
klass = args[0];
field = args[1];
offset = args[2];
assert(offset is not None and dtype is not None);
return ({
'name': 'class_%s__%s__%s' % (klass, field, 'SMI'),
'name': 'class_%s__%s__%s' % (klass, field, dtype),
'value': '%s::%s' % (klass, offset)
});
......@@ -596,7 +620,10 @@ def load_fields_from_file(filename):
# call parse_field() to pick apart the invocation.
#
prefixes = [ 'ACCESSORS', 'ACCESSORS2', 'ACCESSORS_GCSAFE',
'SMI_ACCESSORS', 'ACCESSORS_TO_SMI' ];
'SMI_ACCESSORS', 'ACCESSORS_TO_SMI',
'SYNCHRONIZED_ACCESSORS', 'WEAK_ACCESSORS' ];
prefixes += ([ prefix + "_CHECKED" for prefix in prefixes ] +
[ prefix + "_CHECKED2" for prefix in prefixes ])
current = '';
opens = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment