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

Side by Side Diff: tools/valgrind/gdb_helper.py

Issue 8678023: Fix python scripts in src/tools/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/valgrind/drmemory_analyze.py ('k') | tools/valgrind/memcheck/PRESUBMIT.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 3 # found in the LICENSE file.
5 4
6 # gdb_helper.py
7
8 ''' A bunch of helper functions for querying gdb.''' 5 ''' A bunch of helper functions for querying gdb.'''
9 6
10 import logging 7 import logging
11 import os 8 import os
12 import re 9 import re
13 import tempfile 10 import tempfile
14 11
15 GDB_LINE_RE = re.compile(r'Line ([0-9]*) of "([^"]*)".*') 12 GDB_LINE_RE = re.compile(r'Line ([0-9]*) of "([^"]*)".*')
16 13
17 def _GdbOutputToFileLine(output_line): 14 def _GdbOutputToFileLine(output_line):
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 else: 64 else:
68 self._binaries[binary] = [address] 65 self._binaries[binary] = [address]
69 self._all_resolved = False 66 self._all_resolved = False
70 67
71 def ResolveAll(self): 68 def ResolveAll(self):
72 ''' Carry out all lookup requests. ''' 69 ''' Carry out all lookup requests. '''
73 self._translation = {} 70 self._translation = {}
74 for binary in self._binaries.keys(): 71 for binary in self._binaries.keys():
75 if binary != '' and binary in self._load_addresses: 72 if binary != '' and binary in self._load_addresses:
76 load_address = self._load_addresses[binary] 73 load_address = self._load_addresses[binary]
77 addr = ResolveAddressesWithinABinary(binary, load_address, self._binarie s[binary]) 74 addr = ResolveAddressesWithinABinary(
75 binary, load_address, self._binaries[binary])
78 self._translation[binary] = addr 76 self._translation[binary] = addr
79 self._all_resolved = True 77 self._all_resolved = True
80 78
81 def GetFileLine(self, binary, addr): 79 def GetFileLine(self, binary, addr):
82 ''' Get the (filename, linenum) result of a previously-registered lookup req uest. ''' 80 ''' Get the (filename, linenum) result of a previously-registered lookup
81 request.
82 '''
83 if self._all_resolved: 83 if self._all_resolved:
84 if binary in self._translation: 84 if binary in self._translation:
85 if addr in self._translation[binary]: 85 if addr in self._translation[binary]:
86 return self._translation[binary][addr] 86 return self._translation[binary][addr]
87 return (None, None) 87 return (None, None)
OLDNEW
« no previous file with comments | « tools/valgrind/drmemory_analyze.py ('k') | tools/valgrind/memcheck/PRESUBMIT.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698