如何指定gdb源码路径

问题描述 投票:0回答:0

我想在gdb中检查reload1.cc(请忽略父目录是/root。我正在使用docker准备环境)。

# cd /root/r8c/newlib-4.1.0/newlib/libc/stdlib
# gdb --args m32c-elf-cc -B/root/r8c/newlib-4.1.0/m32c_build/m32c-elf/newlib/ -isystem /root/r8c/newlib-4.1.0/m32c_build/m32c-elf/newlib/targ-include -isystem /root/r8c/newlib-4.1.0/newlib/libc/include -B/root/r8c/newlib-4.1.0/m32c_build/m32c-elf/libgloss/m32c -L/root/r8c/newlib-4.1.0/m32c_build/m32c-elf/libgloss/libnosys -L/root/r8c/newlib-4.1.0/libgloss/m32c    -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"4.1.0\" -DPACKAGE_STRING=\"newlib\ 4.1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I. -I../../../../../newlib/libc/stdlib -Os -fno-builtin -DPREFER_SIZE_OVER_SPEED -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES -DABORT_PROVIDED -DHAVE_INIT_FINI      -g -O2 -c -o lib_a-ldtoa.o ldtoa.c

(gdb) list reload1.cc:1
No source file named reload1.cc.
(gdb) dir /root/r8c/gcc-12.2.0/gcc
Source directories searched: /root/r8c/gcc-12.2.0/gcc:$cdir:$cwd
(gdb) list reload1.cc:1
No source file named reload1.cc.
(gdb)
quit

# ls /root/r8c/gcc-12.2.0/gcc/reload1.cc
/root/r8c/gcc-12.2.0/gcc/reload1.cc

# gdb --version
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

为什么gdb检测不到reload1.cc?

gdb
© www.soinside.com 2019 - 2024. All rights reserved.