I have installed the latest version of the CUDA drivers available from NVIDIA
mmiller#host:~/NVIDIA_CUDA-7.5_Samples$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17
But when I debug a program I get an error message about python.
mmiller#csit-crackin:~$ cuda-gdb hello.out
NVIDIA (R) CUDA Debugger
7.5 release
Portions Copyright (C) 2007-2015 NVIDIA Corporation
GNU gdb (GDB) 7.6.2
Copyright (C) 2013 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. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/mmiller/hello.out...done.
(cuda-gdb) b main
Breakpoint 1 at 0x402546: file hello.cu, line 3.
(cuda-gdb) r
Starting program: /home/mmiller/hello.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, main () at hello.cu:3
3 foo: int x = 1;
(cuda-gdb) s
4 int y = x+1;
(cuda-gdb) p x
Python Exception <type 'exceptions.AttributeError'> 'gdb.Type' object has no attribute 'name':
Python Exception <type 'exceptions.AttributeError'> 'gdb.Type' object has no attribute 'name':
$1 = 1
(cuda-gdb)
I the program is a very simple program and I read that it may be an error dealing with python and gdb, but I am unsure of how to fix the error using the latest software from Ubuntu and Nvidia. Any suggestions as to how to fix this?
It appears that Ubuntu will not update the path to include the latest version of nvcc and cuda-gdb. You have to update the path (or change the symlinks) manually for your to reference the correct versions of these libraries.
Related
Long story short - LLDB doesn't debug my program properly, so I need to use GDB on my Mac to debug a c++ project. Steps I've taken:
Install GDB 8.0.1 and 8.1 via brew/macports (ie try all options)
Codesign the binary properly.
Start the mac in restart mode and typing csrutil enable --without debug
Choose the custom GDB executable in Clion.
Write in the .gdbinit file located in the home directory set startup-with-shell off
When I go to debug in Clion, in the debugger window it reads:
GNU gdb (GDB) 8.0.1
Copyright (C) 2017 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. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin17.2.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
[New Thread 0x2203 of process 1208]
warning: unhandled dyld version (15)
In the console window it just prints the path of the executable and then hangs there until eventually it says 'command timed out'.
Any ideas would be massively appreciated.
my.cpp:
#include<stdio.h>
int main()
{
printf("hello main");
return 0;
}
build with gcc and then
i use gdb to run the program, error occurred.
gdb: unknown target exception 0x406d1388 at 0x75fca6f2
Program received signal ?, Unknown signal.
0x75fca6f2 in RaiseException ()
from /cygdrive/c/WINDOWS/System32/KERNELBASE.dll
gcc info:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-cygwin/5.4.0/lto-wrapper.exe
Target: i686-pc-cygwin
Thread model: posix
gcc version 5.4.0 (GCC)
gdb info:
GNU gdb (GDB) (Cygwin 7.10.1-1) 7.10.1
Copyright (C) 2015 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. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
It is a known bug for this version of GDB. This link may help you.
When I changed my cygwin to 64 version, the problem is suprisely solved.
I think this may be another a bug which differ from the "well-known" GDB bug.
I want to debug my application written in C++ in Eclipse via network. I followed this tutorial http://janaxelson.com/eclipse5.htm but when debugging starts it gives me strange segmentation fault. Full log:
GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9
Copyright (C) 2015 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. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
0xb7fdf0d0 in print_statistics (rtld_total_timep=<optimized out>) at rtld.c:2594
2594 rtld.c: No such file or directory.
Program received signal SIGSEGV, Segmentation fault.
0xb7fe129f in dl_main (phdr=0x8048034, phnum=9, user_entry=0xbffff6ec, auxv=0xbffff7e0) at rtld.c:2182
2182 in rtld.c
I can't figure out what's wrong.
My setup is
Ubuntu 15.04, gcc version 4.9.2, gdb 7.9, Eclipse Mars
Target machine:
Ubuntu 14.04.2 LTS, gdb 7.7.1, gdbserver 7.7.1
I have just used macports to install on my Mac the newest gdb by using sudo port install gdb. The problem is when I type gdb in the command line it still shows the old version. How can I switch to the new one I just installed?
Thanks.
Type :
port contents gdb
It gives you where is located the port
/opt/local/bin/ggdb
/opt/local/include/ansidecl.h
/opt/local/include/bfd.h
/opt/local/include/bfdlink.h
/opt/local/include/dis-asm.h
/opt/local/include/gdb/jit-reader.h
/opt/local/include/symcat.h
/opt/local/lib/libbfd.a
/opt/local/lib/libbfd.la
/opt/local/lib/libopcodes.a
/opt/local/lib/libopcodes.la
...
As you can see below it is named ggdb, not gdb when you have installed it with MacPorts
ggdb
GNU gdb (GDB) 7.6
Copyright (C) 2013 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. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin11.4.2".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb)
Can 32bit gdb debug 64bit binary?
The answer above is incorrect. You need a 64-bit debugger to debug a 64-bit process. That's precisely the reason why gdb forks a 64-bit copy of itself behind the scenes.
Yes. A 32 bit gdb debugs 64 bit binaries fine on Solaris, at least on the latest release.
$ cat /etc/release
Oracle Solaris 11 Express snv_151a X86
Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
Assembled 04 November 2010
$ file /usr/bin/gdb
/usr/bin/gdb: ELF 32-bit LSB executable 80386 Version 1 [FPU], dynamically linked, not stripped, no debugging information available
$ file a
a: ELF 64-bit LSB executable AMD64 Version 1, dynamically linked, not stripped
$ gdb a
GNU gdb 6.8
Copyright (C) 2008 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. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-pc-solaris2.11"...
(gdb) b main
Breakpoint 1 at 0x400e9c: file a.c, line 3.
(gdb) run
Starting program: /tmp/a
Breakpoint 1, main () at a.c:3
3 printf("hello world !");
(gdb) quit
The program is running. Exit anyway? (y or n) y
$
However, if you look closer, this 32 gdb is launching a 64 bit gdb under the hood:
$ truss -f -t execve /usr/bin/gdb a
1793: execve("/usr/bin/gdb", 0x0804755C, 0x08047568) argc = 2
1793: execve("/usr/bin/amd64/gdb", 0x0804755C, 0x08047568) argc = 2
GNU gdb 6.8
Copyright (C) 2008 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. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-pc-solaris2.11"...
(gdb)
It does it regardless of whether the binary debugged is 32 or 64 bit.
I still think the way a debugger interact with a process under Solaris is size independent so technically, a 32 bit only binary debugger should be able to debug a 64 bit program.
A 64 bit gdb is able to debug both 32 bit and 64 bit binaries but a 32 bit gdb cannot debug 64 bit ones. This is what you are experiencing.