Commit e85f979e authored by vegorov's avatar vegorov Committed by Commit bot

gdb-v8-support.py: add FindAnywhere helper.

R=jkummerow@chromium.org
NOTRY=true

Review URL: https://codereview.chromium.org/1157683007

Cr-Commit-Position: refs/heads/master@{#28653}
parent d8a82ed7
...@@ -152,3 +152,26 @@ class V8PrintObject (gdb.Command): ...@@ -152,3 +152,26 @@ class V8PrintObject (gdb.Command):
v = v8_get_value(arg) v = v8_get_value(arg)
gdb.execute('call __gdb_print_v8_object(%d)' % v) gdb.execute('call __gdb_print_v8_object(%d)' % v)
V8PrintObject() V8PrintObject()
class FindAnywhere (gdb.Command):
"""Search memory for the given pattern."""
MAPPING_RE = re.compile(r"^\s*\[\d+\]\s+0x([0-9A-Fa-f]+)->0x([0-9A-Fa-f]+)")
def __init__ (self):
super (FindAnywhere, self).__init__ ("find-anywhere", gdb.COMMAND_DATA)
def invoke (self, value, from_tty):
for l in gdb.execute("maint info sections", to_string = True).split('\n'):
m = FindAnywhere.MAPPING_RE.match(l)
if m is None:
continue
startAddr = m.group(1)
endAddr = m.group(2)
try:
result = gdb.execute(
"find 0x%s, 0x%s, %s" % (startAddr, endAddr, value),
to_string = True)
if result.find("not found") == -1:
print result
except:
pass
FindAnywhere()
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