public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Error "No source file named"
       [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 20:51   ` Jonah Graham
  0 siblings, 2 replies; 12+ messages in thread
From: Mahmood Naderan @ 2021-08-08 13:38 UTC (permalink / raw)
  To: gdb

Hi

When I want to set a breakpoint at a specific line number, I get the following error:

(gdb) break /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/src/gpgpu-sim/shader.cc:1656
No source file named /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/src/gpgpu-sim/shader.cc.
Make breakpoint pending on future shared library load? (y or [n])


However, that line exists.

$ sed -n 1656p /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/src/gpgpu-sim/shader.cc
    printf("[Mahmood:shader.cc:1655] %" PRIu64 "\n", localaddr);



Any idea about that?

Regards,
Mahmood

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Error "No source file named"
  2021-08-08 13:38 ` Error "No source file named" Mahmood Naderan
@ 2021-08-08 14:35   ` Eli Zaretskii
  2021-08-08 15:06     ` Mahmood Naderan
  2021-08-08 20:51   ` Jonah Graham
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2021-08-08 14:35 UTC (permalink / raw)
  To: Mahmood Naderan; +Cc: gdb

> Date: Sun, 8 Aug 2021 13:38:33 +0000 (UTC)
> From: Mahmood Naderan via Gdb <gdb@sourceware.org>
> 
> When I want to set a breakpoint at a specific line number, I get the following error:
> 
> (gdb) break /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/src/gpgpu-sim/shader.cc:1656
> No source file named /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/src/gpgpu-sim/shader.cc.
> Make breakpoint pending on future shared library load? (y or [n])
> 
> 
> However, that line exists.
> 
> $ sed -n 1656p /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/src/gpgpu-sim/shader.cc
>     printf("[Mahmood:shader.cc:1655] %" PRIu64 "\n", localaddr);

Try using the command "info sources" to see what GDB knows about
source file names of your program.  And why don't you use just the
base name of the file, i.e. just "shader.cc"?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Error "No source file named"
  2021-08-08 14:35   ` Eli Zaretskii
@ 2021-08-08 15:06     ` Mahmood Naderan
  2021-08-08 15:31       ` Andreas Schwab
  0 siblings, 1 reply; 12+ messages in thread
From: Mahmood Naderan @ 2021-08-08 15:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb

>Try using the command "info sources" to see what GDB knows about
>source file names of your program.  And why don't you use just the
>base name of the file, i.e. just "shader.cc"?

OK I did that and see shader.h, so I wonder what does that mean? 
Why .cc is not included? How can I dig more?


Regards,
Mahmood



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Error "No source file named"
  2021-08-08 15:06     ` Mahmood Naderan
@ 2021-08-08 15:31       ` Andreas Schwab
  2021-08-08 16:01         ` Mahmood Naderan
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2021-08-08 15:31 UTC (permalink / raw)
  To: Mahmood Naderan via Gdb

On Aug 08 2021, Mahmood Naderan via Gdb wrote:

> Why .cc is not included?

Most likely it wasn't compiled with debug info.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Error "No source file named"
  2021-08-08 15:31       ` Andreas Schwab
@ 2021-08-08 16:01         ` Mahmood Naderan
  2021-08-08 16:12           ` Jonah Graham
  0 siblings, 1 reply; 12+ messages in thread
From: Mahmood Naderan @ 2021-08-08 16:01 UTC (permalink / raw)
  To: Mahmood Naderan via Gdb, Andreas Schwab


>Most likely it wasn't compiled with debug info.

Andreas, I checked the build command:

g++  -g3 -fPIC -DCUDART_VERSION=11020 -Wall -DDEBUG -DTRACING_ON=1 -std=c++0x -ggdb -I/usr/local/cuda-11.2/include -I/home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/src/gpuwattch/ -DGPGPUSIM_POWER_MODEL -o /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/build/gcc-9.3.0/cuda-11020/debug/gpgpu-sim/shader.o -c shader.cc

...

g++ -std=c++0x -o ./bin/debug/accel-sim.out  -L/home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/lib/gcc-9.3.0/cuda-11020/debug/ -lcudart -lm -lz -lGL -pthread ./build/debug/*.o




Again, I run gdb with "info sources" and only see shader.h.
How that is possible that .h is in there but not .cc? I ask that because then it wants to compile the .cc file, it uses the .h file for headers.


Regards,
Mahmood


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Error "No source file named"
  2021-08-08 16:01         ` Mahmood Naderan
@ 2021-08-08 16:12           ` Jonah Graham
  2021-08-08 16:35             ` Mahmood Naderan
  0 siblings, 1 reply; 12+ messages in thread
From: Jonah Graham @ 2021-08-08 16:12 UTC (permalink / raw)
  To: Mahmood Naderan; +Cc: Mahmood Naderan via Gdb, Andreas Schwab

Hi Mahmood,

I hope this is useful and not unrelated....



On Sun, 8 Aug 2021 at 12:02, Mahmood Naderan via Gdb <gdb@sourceware.org>
wrote:

>
> >Most likely it wasn't compiled with debug info.
>
> Andreas, I checked the build command:
>
> g++  -g3 -fPIC -DCUDART_VERSION=11020 -Wall -DDEBUG -DTRACING_ON=1
> -std=c++0x -ggdb -I/usr/local/cuda-11.2/include
> -I/home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/src/gpuwattch/
> -DGPGPUSIM_POWER_MODEL -o
> /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/build/gcc-9.3.0/cuda-11020/debug/gpgpu-sim/shader.o
> -c shader.cc
>
>
In your build command the .o is output to debug/gpgpu-sim/shader.o



> ...
>
> g++ -std=c++0x -o ./bin/debug/accel-sim.out
> -L/home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/lib/gcc-9.3.0/cuda-11020/debug/
> -lcudart -lm -lz -lGL -pthread ./build/debug/*.o
>
>
But here it is pulling debug/*.o

Could you have two copies of shader.o hanging about?

HTH
Jonah

>
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Error "No source file named"
  2021-08-08 16:12           ` Jonah Graham
@ 2021-08-08 16:35             ` Mahmood Naderan
  2021-08-08 16:45               ` Jeffrey Walton
  0 siblings, 1 reply; 12+ messages in thread
From: Mahmood Naderan @ 2021-08-08 16:35 UTC (permalink / raw)
  To: Jonah Graham; +Cc: Mahmood Naderan via Gdb, Andreas Schwab

>Could you have two copies of shader.o hanging about?

Jonah, Thanks for the tip. I checked more and see


g++  -g3 -fPIC -DCUDART_VERSION=11020 -Wall -DDEBUG -DTRACING_ON=1 -std=c++0x -ggdb \
     -I/usr/local/cuda-11.2/include -I/home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/src/gpuwattch/ \
     -DGPGPUSIM_POWER_MODEL -o /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/build/gcc-9.3.0/cuda-11020/debug/gpgpu-sim/shader.o \
     -c shader.cc


ar rcs  /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/build/gcc-9.3.0/cuda-11020/debug/gpgpu-sim/libgpu_uarch_sim.a \
        /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/build/gcc-9.3.0/cuda-11020/debug/gpgpu-sim/shader.o \
        ...


g++ -shared -Wl,-soname,libcudart.so -Wl,--version-script=linux-so-version.txt \
        ...
        /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/build/gcc-9.3.0/cuda-11020/debug/gpgpu-sim/*.o \
        -o lib/gcc-9.3.0/cuda-11020/debug/libcudart.so





And the final binary depends on the libcudart.so

$ ldd gpu-simulator/bin/debug/accel-sim.out
        linux-vdso.so.1 (0x00007fffc01c3000)
        libcudart.so => /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/lib/gcc-9.3.0/cuda-11020/debug/libcudart.so (0x00007f7c3e8f4000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f7c3e6f0000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7c3e6d5000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7c3e6b2000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7c3e4c0000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f7c3e4a2000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7c3e353000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f7c3f2dc000)



Do you also confirm that shader.cc symbols must be in the final binary?



Regards,
Mahmood


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Error "No source file named"
  2021-08-08 16:35             ` Mahmood Naderan
@ 2021-08-08 16:45               ` Jeffrey Walton
  2021-08-08 17:15                 ` Mahmood Naderan
  0 siblings, 1 reply; 12+ messages in thread
From: Jeffrey Walton @ 2021-08-08 16:45 UTC (permalink / raw)
  To: Mahmood Naderan; +Cc: Jonah Graham, Mahmood Naderan via Gdb, Andreas Schwab

On Sun, Aug 8, 2021 at 12:35 PM Mahmood Naderan via Gdb
<gdb@sourceware.org> wrote:
>
> >Could you have two copies of shader.o hanging about?
>
> Jonah, Thanks for the tip. I checked more and see
>
>
> g++  -g3 -fPIC -DCUDART_VERSION=11020 -Wall -DDEBUG -DTRACING_ON=1 -std=c++0x -ggdb \
>      -I/usr/local/cuda-11.2/include -I/home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/src/gpuwattch/ \
>      -DGPGPUSIM_POWER_MODEL -o /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/build/gcc-9.3.0/cuda-11020/debug/gpgpu-sim/shader.o \
>      -c shader.cc
>
>
> ar rcs  /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/build/gcc-9.3.0/cuda-11020/debug/gpgpu-sim/libgpu_uarch_sim.a \
>         /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/build/gcc-9.3.0/cuda-11020/debug/gpgpu-sim/shader.o \
>         ...
>
>
> g++ -shared -Wl,-soname,libcudart.so -Wl,--version-script=linux-so-version.txt \
>         ...
>         /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/build/gcc-9.3.0/cuda-11020/debug/gpgpu-sim/*.o \
>         -o lib/gcc-9.3.0/cuda-11020/debug/libcudart.so
>
>
>
>
>
> And the final binary depends on the libcudart.so
>
> $ ldd gpu-simulator/bin/debug/accel-sim.out
>         linux-vdso.so.1 (0x00007fffc01c3000)
>         libcudart.so => /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/lib/gcc-9.3.0/cuda-11020/debug/libcudart.so (0x00007f7c3e8f4000)
>         libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f7c3e6f0000)
>         libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7c3e6d5000)
>         libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7c3e6b2000)
>         libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7c3e4c0000)
>         libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f7c3e4a2000)
>         libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7c3e353000)
>         /lib64/ld-linux-x86-64.so.2 (0x00007f7c3f2dc000)
>
> Do you also confirm that shader.cc symbols must be in the final binary?

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.

Jeff

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Error "No source file named"
  2021-08-08 16:45               ` Jeffrey Walton
@ 2021-08-08 17:15                 ` Mahmood Naderan
  2021-08-08 22:25                   ` Jeffrey Walton
  0 siblings, 1 reply; 12+ messages in thread
From: Mahmood Naderan @ 2021-08-08 17:15 UTC (permalink / raw)
  To: Jeffrey Walton; +Cc: Jonah Graham, Mahmood Naderan via Gdb, Andreas Schwab


>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.

Jeffrey,
That gcc switch needs two paths (old and new).
I don't know what is old and new then.


Regards,
Mahmood




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Error "No source file named"
  2021-08-08 13:38 ` Error "No source file named" Mahmood Naderan
  2021-08-08 14:35   ` Eli Zaretskii
@ 2021-08-08 20:51   ` Jonah Graham
  1 sibling, 0 replies; 12+ messages in thread
From: Jonah Graham @ 2021-08-08 20:51 UTC (permalink / raw)
  To: Mahmood Naderan; +Cc: GDB Development

(sorry for top post, my phone's email client isn't working well)

Hi Mahmood,

Until the so loads info sources won't show info about it. Did you say "yes"
to the make breakpoint pending and then run until the so was loaded. You
should get a message during your run when the so is loaded.

HTH,
Jonah

On Sun., Aug. 8, 2021, 09:47 Mahmood Naderan via Gdb, <gdb@sourceware.org>
wrote:

> Hi
>
> When I want to set a breakpoint at a specific line number, I get the
> following error:
>
> (gdb) break
> /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/src/gpgpu-sim/shader.cc:1656
> No source file named
> /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/src/gpgpu-sim/shader.cc.
> Make breakpoint pending on future shared library load? (y or [n])
>
>
>
> However, that line exists.
>
> $ sed -n 1656p
> /home/mahmood/accel-sim-framework/gpu-simulator/gpgpu-sim/src/gpgpu-sim/shader.cc
>     printf("[Mahmood:shader.cc:1655] %" PRIu64 "\n", localaddr);
>
>
>
> Any idea about that?
>
> Regards,
> Mahmood
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Error "No source file named"
  2021-08-08 17:15                 ` Mahmood Naderan
@ 2021-08-08 22:25                   ` Jeffrey Walton
  2021-08-09  8:36                     ` Mahmood Naderan
  0 siblings, 1 reply; 12+ messages in thread
From: Jeffrey Walton @ 2021-08-08 22:25 UTC (permalink / raw)
  To: Mahmood Naderan; +Cc: Mahmood Naderan via Gdb

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Error "No source file named"
  2021-08-08 22:25                   ` Jeffrey Walton
@ 2021-08-09  8:36                     ` Mahmood Naderan
  0 siblings, 0 replies; 12+ messages in thread
From: Mahmood Naderan @ 2021-08-09  8:36 UTC (permalink / raw)
  To: Jeffrey Walton, gdb; +Cc: Mahmood Naderan via Gdb, noloader

>Did you say "yes" to the make breakpoint pending and then run until the so was loaded.

Interesting.... You are correct Jonah. 
It seems that at the first point, it hasn't loaded the .so file. 
Later when I run "info sources" I see tons of source files.

Thanks for pointing out that.





Regards,
Mahmood



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-08-09  8:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <767694398.211875.1628429913388.ref@mail.yahoo.com>
2021-08-08 13:38 ` Error "No source file named" 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
2021-08-09  8:36                     ` Mahmood Naderan
2021-08-08 20:51   ` Jonah Graham

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).