OLD | NEW |
1 # Copyright (C) 2010, Google Inc. All rights reserved. | 1 # Copyright (C) 2010, Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 return 0 | 149 return 0 |
150 return WTFStringImplPrinter(self.stringimpl_ptr().dereference()).get_len
gth() | 150 return WTFStringImplPrinter(self.stringimpl_ptr().dereference()).get_len
gth() |
151 | 151 |
152 def to_string(self): | 152 def to_string(self): |
153 if not self.stringimpl_ptr(): | 153 if not self.stringimpl_ptr(): |
154 return '(null)' | 154 return '(null)' |
155 return self.stringimpl_ptr().dereference() | 155 return self.stringimpl_ptr().dereference() |
156 | 156 |
157 | 157 |
158 | 158 |
159 class JSCIdentifierPrinter(StringPrinter): | |
160 "Print a JSC::Identifier" | |
161 def to_string(self): | |
162 return WTFStringImplPrinter(self.val['m_string']).to_string() | |
163 | |
164 | |
165 class JSCJSStringPrinter(StringPrinter): | |
166 "Print a JSC::JSString" | |
167 def to_string(self): | |
168 if self.val['m_length'] == 0: | |
169 return '' | |
170 | |
171 return WTFStringImplPrinter(self.val['m_value']).to_string() | |
172 | |
173 | |
174 class blinkKURLPrinter(StringPrinter): | 159 class blinkKURLPrinter(StringPrinter): |
175 "Print a blink::KURL" | 160 "Print a blink::KURL" |
176 def to_string(self): | 161 def to_string(self): |
177 return WTFStringPrinter(self.val['m_string']).to_string() | 162 return WTFStringPrinter(self.val['m_string']).to_string() |
178 | 163 |
179 | 164 |
180 class blinkLayoutUnitPrinter: | 165 class blinkLayoutUnitPrinter: |
181 "Print a blink::LayoutUnit" | 166 "Print a blink::LayoutUnit" |
182 def __init__(self, val): | 167 def __init__(self, val): |
183 self.val = val | 168 self.val = val |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 (re.compile("^WTF::Vector<.*>$"), WTFVectorPrinter), | 292 (re.compile("^WTF::Vector<.*>$"), WTFVectorPrinter), |
308 (re.compile("^WTF::AtomicString$"), WTFAtomicStringPrinter), | 293 (re.compile("^WTF::AtomicString$"), WTFAtomicStringPrinter), |
309 (re.compile("^WTF::CString$"), WTFCStringPrinter), | 294 (re.compile("^WTF::CString$"), WTFCStringPrinter), |
310 (re.compile("^WTF::String$"), WTFStringPrinter), | 295 (re.compile("^WTF::String$"), WTFStringPrinter), |
311 (re.compile("^WTF::StringImpl$"), WTFStringImplPrinter), | 296 (re.compile("^WTF::StringImpl$"), WTFStringImplPrinter), |
312 (re.compile("^blink::KURL$"), blinkKURLPrinter), | 297 (re.compile("^blink::KURL$"), blinkKURLPrinter), |
313 (re.compile("^blink::LayoutUnit$"), blinkLayoutUnitPrinter), | 298 (re.compile("^blink::LayoutUnit$"), blinkLayoutUnitPrinter), |
314 (re.compile("^blink::LayoutPoint$"), blinkLayoutPointPrinter), | 299 (re.compile("^blink::LayoutPoint$"), blinkLayoutPointPrinter), |
315 (re.compile("^blink::LayoutSize$"), blinkLayoutSizePrinter), | 300 (re.compile("^blink::LayoutSize$"), blinkLayoutSizePrinter), |
316 (re.compile("^blink::QualifiedName$"), blinkQualifiedNamePrinter), | 301 (re.compile("^blink::QualifiedName$"), blinkQualifiedNamePrinter), |
317 (re.compile("^JSC::Identifier$"), JSCIdentifierPrinter), | |
318 (re.compile("^JSC::JSString$"), JSCJSStringPrinter), | |
319 ) | 302 ) |
320 | 303 |
321 def lookup_function(val): | 304 def lookup_function(val): |
322 """Function used to load pretty printers; will be passed to GDB.""" | 305 """Function used to load pretty printers; will be passed to GDB.""" |
323 type = val.type | 306 type = val.type |
324 if type.code == gdb.TYPE_CODE_REF: | 307 if type.code == gdb.TYPE_CODE_REF: |
325 type = type.target() | 308 type = type.target() |
326 type = type.unqualified().strip_typedefs() | 309 type = type.unqualified().strip_typedefs() |
327 tag = type.tag | 310 tag = type.tag |
328 if tag: | 311 if tag: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 padding = '' | 358 padding = '' |
376 while len(stack) > 0: | 359 while len(stack) > 0: |
377 pair = stack.pop() | 360 pair = stack.pop() |
378 print(padding, pair[1], pair[0]) | 361 print(padding, pair[1], pair[0]) |
379 padding = padding + ' ' | 362 padding = padding + ' ' |
380 else: | 363 else: |
381 print('Sorry: I don\'t know how to deal with %s yet.' % target_type) | 364 print('Sorry: I don\'t know how to deal with %s yet.' % target_type) |
382 | 365 |
383 | 366 |
384 PrintPathToRootCommand() | 367 PrintPathToRootCommand() |
OLD | NEW |