Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: tools/gdb-v8-support.py

Issue 1157683007: gdb-v8-support.py: add FindAnywhere helper. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gdb-v8-support.py
diff --git a/tools/gdb-v8-support.py b/tools/gdb-v8-support.py
index 9cc046c7a50c457d25ddda154237d122acd99bf1..5b2b532cabc0e3fbbfb378b0cbbc3bed2724dce5 100644
--- a/tools/gdb-v8-support.py
+++ b/tools/gdb-v8-support.py
@@ -152,3 +152,26 @@ class V8PrintObject (gdb.Command):
v = v8_get_value(arg)
gdb.execute('call __gdb_print_v8_object(%d)' % v)
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()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698