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

Side by Side Diff: tools/cr/cr/actions/gdb.py

Issue 142933004: [cr tool] Make context implicit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 9 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 unified diff | Download patch
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # 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
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import os 5 import os
6 6
7 import cr 7 import cr
8 8
9 9
10 class GdbDebugger(cr.Debugger): 10 class GdbDebugger(cr.Debugger):
11 """An implementation of cr.Debugger that launches gdb.""" 11 """An implementation of cr.Debugger that launches gdb."""
12 12
13 DETECTED = cr.Config('DETECTED') 13 DETECTED = cr.Config('DETECTED')
14 14
15 @property 15 @property
16 def enabled(self): 16 def enabled(self):
17 return (cr.LinuxPlatform.GetInstance().is_active and 17 return (cr.LinuxPlatform.GetInstance().is_active and
18 self.DETECTED.Find('CR_GDB')) 18 self.DETECTED.Find('CR_GDB'))
19 19
20 def Invoke(self, context, targets, arguments): 20 def Invoke(self, targets, arguments):
21 for target in targets: 21 for target in targets:
22 cr.Host.Execute( 22 cr.Host.Execute(
23 target, 23 target,
24 '{CR_GDB}', '--eval-command=run', '--args', 24 '{CR_GDB}', '--eval-command=run', '--args',
25 '{CR_BINARY}', 25 '{CR_BINARY}',
26 '{CR_RUN_ARGUMENTS}', 26 '{CR_RUN_ARGUMENTS}',
27 *arguments 27 *arguments
28 ) 28 )
29 29
30 def Attach(self, context, targets, arguments): 30 def Attach(self, targets, arguments):
31 raise NotImplementedError('Attach not currently supported for gdb.') 31 raise NotImplementedError('Attach not currently supported for gdb.')
32 32
33 @classmethod 33 @classmethod
34 def ClassInit(cls): 34 def ClassInit(cls):
35 # Attempt to find a valid gdb on the path. 35 # Attempt to find a valid gdb on the path.
36 gdb_binaries = cr.Host.SearchPath('gdb') 36 gdb_binaries = cr.Host.SearchPath('gdb')
37 if gdb_binaries: 37 if gdb_binaries:
38 cls.DETECTED.Set(CR_GDB=gdb_binaries[0]) 38 cls.DETECTED.Set(CR_GDB=gdb_binaries[0])
39 39
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698