Error "No source file named"
Jeffrey Walton
noloader@gmail.com
Sun Aug 8 22:25:24 GMT 2021
On Sun, Aug 8, 2021 at 1:15 PM Mahmood Naderan <nt_mahmood@yahoo.com> wrote:
>
> >You might also find -fdebug-prefix-map useful. It allows you to tell
> >the debugger where to locate source files for object files if the
> >source files have been relocated to a directory like /lib/src. It may
> >help here, too.
>
> That gcc switch needs two paths (old and new).
> I don't know what is old and new then.
I use a script like the one shown below.
I assume you are installing your warez into $HOME. You would use
--prefix=$HOME when configuring. So binaries are in $HOME/bin,
libraries are in $HOME/lib, etc.
Use -fdebug-prefix-map as an option to CFLAGS and CXXFLAGS like so:
-fdebug-prefix-map=${PWD}="${HOME}/src/gpu-simulator"
Then, after configure, make and make install, execute the script:
# run from the gpu-simulator directory, where you configure
bash copy-sources.sh "${PWD}" "${HOME}/src/gpu-simulator"
Here's the copy-sources.sh script:
$ cat copy-sources.sh
#!/usr/bin/env bash
src_dir="$1"
dest_dir="$2"
if [[ -z "${src_dir}" ]]; then
echo "Please specify a source directory"
exit 1
fi
if [[ ! -d "${src_dir}" ]]; then
echo "Source directory is not valid"
exit 1
fi
if [[ -z "${dest_dir}" ]]; then
echo "Please specify a destination directory"
exit 1
fi
cd "${src_dir}" || exit 1
rm -rf "${dest_dir}"
mkdir -p "${dest_dir}"
IFS= find "./" \( -name '*.h' -o -name '*.hpp' -o -name '*.hxx' -o \
-name '*.c' -o -name '*.cc' -o \
-name '*.cpp' -o -name '*.cxx' -o -name '*.CC' -o \
-name '*.s' -o -name '*.S' \) -print | while read -r file
do
# This trims the leading "./" in "./foo.c".
file=$(echo -n "${file}" | tr -s '/' | cut -c 3-);
cp --parents --preserve=timestamps "${file}" "${dest_dir}"
done
exit 0
Jeff
More information about the Gdb
mailing list