Skip to content

Commit 6c5455c

Browse files
committed
Get gcc and gdb path from environment.
If the environment variables aren't set, then use the same defaults as previously. My current set of tools use riscv64-elf-gcc and riscv64-elf-gdb, and this makes it trivial to use them.
1 parent af24229 commit 6c5455c

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

debug/testlib.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ def __init__(self, stdout, stderr):
3939

4040
gcc_cmd = None
4141
def compile(args): # pylint: disable=redefined-builtin
42-
if gcc_cmd:
43-
cmd = [gcc_cmd]
44-
else:
45-
cmd = ["riscv64-unknown-elf-gcc"]
42+
cmd = [gcc_cmd]
4643
cmd.append("-g")
4744
for arg in args:
4845
found = find_file(arg)
@@ -607,7 +604,7 @@ def __init__(self, target, ports, cmd=None, timeout=60, binaries=None):
607604

608605
self.target = target
609606
self.ports = ports
610-
self.cmd = cmd or "riscv64-unknown-elf-gdb"
607+
self.cmd = cmd
611608
self.timeout = timeout
612609
self.binaries = binaries or [None] * len(ports)
613610

@@ -1059,9 +1056,15 @@ def add_test_run_options(parser):
10591056
parser.add_argument("test", nargs='*',
10601057
help="Run only tests that are named here.")
10611058
parser.add_argument("--gcc",
1062-
help="The command to use to start gcc.")
1059+
help="The command to use to start gcc. Defaults to the contents of "
1060+
"RISCV_TESTS_DEBUG_GCC, or riscv64-unknown-elf-gcc.",
1061+
default=os.environ.get("RISCV_TESTS_DEBUG_GCC",
1062+
"riscv64-unknown-elf-gcc"))
10631063
parser.add_argument("--gdb",
1064-
help="The command to use to start gdb.")
1064+
help="The command to use to start gdb. Defaults to the contents of "
1065+
"RISCV_TESTS_DEBUG_GDB, or riscv64-unknown-elf-gdb.",
1066+
default=os.environ.get("RISCV_TESTS_DEBUG_GDB",
1067+
"riscv64-unknown-elf-gdb"))
10651068
parser.add_argument("--misaval",
10661069
help="Don't run ExamineTarget, just assume the misa value which is "
10671070
"specified.")

0 commit comments

Comments
 (0)