OLD | NEW |
1 # Copyright 2011 the V8 project authors. All rights reserved. | 1 # Copyright 2011 the V8 project authors. All rights reserved. |
2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
4 # met: | 4 # met: |
5 # | 5 # |
6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 MAPPING_RE = re.compile(r"^\s*\[\d+\]\s+0x([0-9A-Fa-f]+)->0x([0-9A-Fa-f]+)") | 160 MAPPING_RE = re.compile(r"^\s*\[\d+\]\s+0x([0-9A-Fa-f]+)->0x([0-9A-Fa-f]+)") |
161 LIVE_MAPPING_RE = re.compile(r"^\s+0x([0-9A-Fa-f]+)\s+0x([0-9A-Fa-f]+)") | 161 LIVE_MAPPING_RE = re.compile(r"^\s+0x([0-9A-Fa-f]+)\s+0x([0-9A-Fa-f]+)") |
162 def __init__ (self): | 162 def __init__ (self): |
163 super (FindAnywhere, self).__init__ ("find-anywhere", gdb.COMMAND_DATA) | 163 super (FindAnywhere, self).__init__ ("find-anywhere", gdb.COMMAND_DATA) |
164 def find (self, startAddr, endAddr, value): | 164 def find (self, startAddr, endAddr, value): |
165 try: | 165 try: |
166 result = gdb.execute( | 166 result = gdb.execute( |
167 "find 0x%s, 0x%s, %s" % (startAddr, endAddr, value), | 167 "find 0x%s, 0x%s, %s" % (startAddr, endAddr, value), |
168 to_string = True) | 168 to_string = True) |
169 if result.find("not found") == -1: | 169 if result.find("not found") == -1: |
170 print result | 170 print(result) |
171 except: | 171 except: |
172 pass | 172 pass |
173 | 173 |
174 def invoke (self, value, from_tty): | 174 def invoke (self, value, from_tty): |
175 for l in gdb.execute("maint info sections", to_string = True).split('\n'): | 175 for l in gdb.execute("maint info sections", to_string = True).split('\n'): |
176 m = FindAnywhere.MAPPING_RE.match(l) | 176 m = FindAnywhere.MAPPING_RE.match(l) |
177 if m is None: | 177 if m is None: |
178 continue | 178 continue |
179 self.find(m.group(1), m.group(2), value) | 179 self.find(m.group(1), m.group(2), value) |
180 for l in gdb.execute("info proc mappings", to_string = True).split('\n'): | 180 for l in gdb.execute("info proc mappings", to_string = True).split('\n'): |
181 m = FindAnywhere.LIVE_MAPPING_RE.match(l) | 181 m = FindAnywhere.LIVE_MAPPING_RE.match(l) |
182 if m is None: | 182 if m is None: |
183 continue | 183 continue |
184 self.find(m.group(1), m.group(2), value) | 184 self.find(m.group(1), m.group(2), value) |
185 | 185 |
186 FindAnywhere() | 186 FindAnywhere() |
OLD | NEW |