Reviewers: Yang,

Description:
Extend find-anywhere so it also works while debugging a live process

[email protected]
BUG=none
LOG=n

Please review this at https://codereview.chromium.org/1179413006/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+18, -10 lines):
  M tools/gdb-v8-support.py


Index: tools/gdb-v8-support.py
diff --git a/tools/gdb-v8-support.py b/tools/gdb-v8-support.py
index 5b2b532cabc0e3fbbfb378b0cbbc3bed2724dce5..8f5ff5bb5e80fa068f729276f3ec8ac0ff86180c 100644
--- a/tools/gdb-v8-support.py
+++ b/tools/gdb-v8-support.py
@@ -157,21 +157,29 @@ 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]+)")
+  LIVE_MAPPING_RE = re.compile(r"^\s+0x([0-9A-Fa-f]+)\s+0x([0-9A-Fa-f]+)")
   def __init__ (self):
     super (FindAnywhere, self).__init__ ("find-anywhere", gdb.COMMAND_DATA)
+  def find (self, startAddr, endAddr, value):
+    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
+
   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
+      self.find(m.group(1), m.group(2), value)
+ for l in gdb.execute("info proc mappings", to_string = True).split('\n'):
+      m = FindAnywhere.LIVE_MAPPING_RE.match(l)
+      if m is None:
+        continue
+      self.find(m.group(1), m.group(2), value)
+
 FindAnywhere()


--
--
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.

Reply via email to