public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Jeffrey Walton <noloader@gmail.com>
To: Mahmood Naderan <nt_mahmood@yahoo.com>
Cc: Mahmood Naderan via Gdb <gdb@sourceware.org>
Subject: Re: Error "No source file named"
Date: Sun, 8 Aug 2021 18:25:24 -0400	[thread overview]
Message-ID: <CAH8yC8=dHr7pn5hr97ct9ajdOYXPxfK-mNLCsXNv72J66pAwCQ@mail.gmail.com> (raw)
In-Reply-To: <1031092808.203448.1628442915048@mail.yahoo.com>

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

  reply	other threads:[~2021-08-08 22:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <767694398.211875.1628429913388.ref@mail.yahoo.com>
2021-08-08 13:38 ` Mahmood Naderan
2021-08-08 14:35   ` Eli Zaretskii
2021-08-08 15:06     ` Mahmood Naderan
2021-08-08 15:31       ` Andreas Schwab
2021-08-08 16:01         ` Mahmood Naderan
2021-08-08 16:12           ` Jonah Graham
2021-08-08 16:35             ` Mahmood Naderan
2021-08-08 16:45               ` Jeffrey Walton
2021-08-08 17:15                 ` Mahmood Naderan
2021-08-08 22:25                   ` Jeffrey Walton [this message]
2021-08-09  8:36                     ` Mahmood Naderan
2021-08-08 20:51   ` Jonah Graham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH8yC8=dHr7pn5hr97ct9ajdOYXPxfK-mNLCsXNv72J66pAwCQ@mail.gmail.com' \
    --to=noloader@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=nt_mahmood@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).