summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_gdb.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-08-16 12:38:02 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-08-16 12:38:02 (GMT)
commit7869a4e03aa8624bdb7636120819a06c84503e60 (patch)
tree4e9a11aa34fd2c6b78eb3d22ea39b99cadff3b45 /Lib/test/test_gdb.py
parent8e7966b00e4cb51b19c5c8eae33c706c22c185b3 (diff)
downloadcpython-7869a4e03aa8624bdb7636120819a06c84503e60.zip
cpython-7869a4e03aa8624bdb7636120819a06c84503e60.tar.gz
cpython-7869a4e03aa8624bdb7636120819a06c84503e60.tar.bz2
Closes #22188: test_gdb now runs gdb with -nx: "Do not execute commands from
any .gdbinit initialization files".
Diffstat (limited to 'Lib/test/test_gdb.py')
-rw-r--r--Lib/test/test_gdb.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py
index 0e254a2..4fba3c3 100644
--- a/Lib/test/test_gdb.py
+++ b/Lib/test/test_gdb.py
@@ -22,7 +22,7 @@ from test import support
from test.support import run_unittest, findfile, python_is_optimized
try:
- gdb_version, _ = subprocess.Popen(["gdb", "--version"],
+ gdb_version, _ = subprocess.Popen(["gdb", "-nx", "--version"],
stdout=subprocess.PIPE).communicate()
except OSError:
# This is what "no gdb" looks like. There may, however, be other
@@ -54,7 +54,9 @@ def run_gdb(*args, **env_vars):
env.update(env_vars)
else:
env = None
- base_cmd = ('gdb', '--batch')
+ # -nx: Do not execute commands from any .gdbinit initialization files
+ # (issue #22188)
+ base_cmd = ('gdb', '--batch', '-nx')
if (gdb_major_version, gdb_minor_version) >= (7, 4):
base_cmd += ('-iex', 'add-auto-load-safe-path ' + checkout_hook_path)
out, err = subprocess.Popen(base_cmd + args,
@@ -130,7 +132,7 @@ class DebuggerTests(unittest.TestCase):
# print commands
# Use "commands" to generate the arguments with which to invoke "gdb":
- args = ["gdb", "--batch"]
+ args = ["gdb", "--batch", "-nx"]
args += ['--eval-command=%s' % cmd for cmd in commands]
args += ["--args",
sys.executable]