]> git.ipfire.org Git - people/arne_f/ipfire-3.x.git/blame - python3/patches/00156-gdb-autoload-safepath.patch
perl: Rebuild against libdb
[people/arne_f/ipfire-3.x.git] / python3 / patches / 00156-gdb-autoload-safepath.patch
CommitLineData
bf250edf
MT
1diff -up Python-3.2.3/Lib/test/test_gdb.py.gdb-autoload-safepath Python-3.2.3/Lib/test/test_gdb.py
2--- Python-3.2.3/Lib/test/test_gdb.py.gdb-autoload-safepath 2012-04-30 17:16:24.092706954 -0400
3+++ Python-3.2.3/Lib/test/test_gdb.py 2012-04-30 17:17:13.275703592 -0400
4@@ -46,6 +46,19 @@ def gdb_has_frame_select():
5
6 HAS_PYUP_PYDOWN = gdb_has_frame_select()
7
8+def gdb_has_autoload_safepath():
9+ # Recent GDBs will only auto-load scripts from certain safe
10+ # locations, so we will need to turn off this protection.
11+ # However, if the GDB doesn't have it, then the following
12+ # command will generate noise on stderr (rhbz#817072):
13+ cmd = "--eval-command=set auto-load safe-path /"
14+ p = subprocess.Popen(["gdb", "--batch", cmd],
15+ stderr=subprocess.PIPE)
16+ _, stderr = p.communicate()
17+ return b'"on" or "off" expected.' not in stderr
18+
19+HAS_AUTOLOAD_SAFEPATH = gdb_has_autoload_safepath()
20+
21 BREAKPOINT_FN='builtin_id'
22
23 class DebuggerTests(unittest.TestCase):
24@@ -106,15 +119,28 @@ class DebuggerTests(unittest.TestCase):
25 'set print entry-values no',
26
27 'run']
28+
29+ if HAS_AUTOLOAD_SAFEPATH:
30+ # Recent GDBs will only auto-load scripts from certain safe
31+ # locations.
32+ # Where necessary, turn off this protection to ensure that
33+ # our -gdb.py script can be loaded - but not on earlier gdb builds
34+ # as this would generate noise on stderr (rhbz#817072):
35+ init_commands = ['set auto-load safe-path /']
36+ else:
37+ init_commands = []
38+
39 if cmds_after_breakpoint:
40 commands += cmds_after_breakpoint
41 else:
42 commands += ['backtrace']
43
44+ # print init_commands
45 # print commands
46
47 # Use "commands" to generate the arguments with which to invoke "gdb":
48 args = ["gdb", "--batch"]
49+ args += ['--init-eval-command=%s' % cmd for cmd in init_commands]
50 args += ['--eval-command=%s' % cmd for cmd in commands]
51 args += ["--args",
52 sys.executable]