ATLAS Offline Software
Loading...
Searching...
No Matches
btload.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2#
3# File: GdbUtils/python/btload.py
4# Created: A while ago, sss
5# Purpose: Load shared libraries for the current backtrace.
6#
7
8
9import gdb
10from findlib import findlib
11
12
13def btload (limit = 100):
14 retry = True
15 last_iframe = -1
16 while retry:
17 frame = gdb.newest_frame()
18 iframe = 0
19 retry = False
20 while frame and frame.is_valid() and iframe < limit:
21 if frame.name() is None:
22 lib = findlib (frame.pc())
23 if lib and lib != 'libubsan.so' and lib != 'libasan.so':
24 retry = True
25 break
26 if frame.name() == 'ApplicationMgr::executeRun':
27 break
28 if frame.name() == '_Py_UnixMain':
29 break
30 frame = frame.older()
31 iframe = iframe + 1
32 if iframe <= last_iframe: break
33 last_iframe = iframe
34 return
35
36
37class BTLoad (gdb.Command):
38 """Load shared libraries from the current backtrace."""
39
40 def __init__ (self):
41 super (BTLoad, self).__init__ ("btload", gdb.COMMAND_FILES)
42 return
43
44 def invoke (self, arg, from_tty):
45 limit = 100
46 args = arg.split()
47 if len(args) > 0:
48 limit = int(args[0])
49 btload (limit)
50 return
51
52BTLoad()
invoke(self, arg, from_tty)
Definition btload.py:44