GDB on CentOS ignores gdbinit file - c++

When I run program in GDB/CentOS, I see following message in console:
warning: File "/usr/lib64/libstdc++.so.6.0.18-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
I do exactly what this warning says. I create file /home/user/.gdbinit with the only line add-auto-load-safe-path /usr/lib64/libstdc++.so.6.0.18-gdb.py. Nothing changed. I see the same error message even after restart.
Are there any ideas what is problem?

From the gdb docs:
set auto-load safe-path [directories]
Set the list of directories (and their subdirectories) trusted for automatic loading and execution of scripts.
This is to specifiy directories, but you specify a file:
add-auto-load-safe-path /usr/lib64/libstdc++.so.6.0.18-gdb.py
You might want to do:
add-auto-load-safe-path /usr/lib64/

Related

debuginfod doesn't provide debug info of glibc malloc/arena.c

I use debuginfod service to view glibc source code. It successfully download debug info of malloc/malloc.c. However, when I step into the function ptmalloc_init() which is defined in malloc/arena.c, the debuginfod says:
315 /usr/src/debug/glibc/malloc/arena.c: Directory not empty.
and gdb's list command cannot show source code of ptmalloc_init(). I check the files in ~/.cache/debuginfod_client, and find out <BUILDID>/source##usr##src##debug##glibc##malloc##malloc.c has content while <BUILDID>/source##usr##src##debug##glibc##malloc##arena.c is a empty file.
How can I debug with malloc/arena.c source code?

Tizen Studio Debugger Message: Cannot launch application with GDBClient

I am working on a Hybrid App (Web UI with Native Service) of API version 4.0 for my Gear S3 Frontier. After successful compilation of the App, In order to track the cause of application crash, when I launch it on emulator W-4.0-circle-x86-preview in debug mode, it gives an error message.
Error Message:
Cannot launch application with GDBClient.
Error in final launch sequence
Failed to execute MI command:
source G:\Computer Science\App Development\MyApp\GalaxyWatchApp\MyApp\Native Service\Debug\.gdbcommand
Error message from debugger back end:
G:\Computer Science\App Development\MyApp\GalaxyWatchApp\MyApp\Native Service\Debug\.gdbcommand:5: Error in sourced command file:\nG:Computer ScienceApp DevelopmentMyAppGalaxyWatchAppMyAppNative ServiceDebugMyAppservice: No such file or directory.
G:\Computer Science\App Development\MyApp\GalaxyWatchApp\MyApp\Native Service\Debug\.gdbcommand:5: Error in sourced command file:\nG:Computer ScienceApp DevelopmentMyAppGalaxyWatchAppMyAppNative ServiceDebugMyAppservice: No such file or directory.
GDBCommand File Contents:
set sysroot C:\Tizen\TizenStudio\tizen-studio\platforms\tizen-4.0\wearable\rootstraps\wearable-4.0-emulator.core
set debug-file-directory C:\Tizen\TizenStudio\tizen-studio\platforms\tizen-4.0\wearable\rootstraps\wearable-4.0-emulator.core\usr\lib\debug
set solib-search-path G:\Computer Science\App Development\MyApp\GalaxyWatchApp\MyApp\Native Service\Debug
dir C:\Tizen\TizenStudio\tizen-studio\platforms\tizen-4.0\wearable\rootstraps\wearable-4.0-emulator.core\usr\src\debug
file "G:\Computer Science\App Development\MyApp\GalaxyWatchApp\MyApp\Native Service\Debug\MyAppservice"
sharedlibrary
During the web search I found some of the GDBClient errors but couldn't find the solution to this one.
I've also tried setting the path of GDB Debugger to i386-linux-gnueabi-gdb-7.8 and GDB Command File to the absolute path of .gdbcommand which should be run.
It seems like the problem lies with this line:
file "G:\Computer Science\App Development\MyApp\GalaxyWatchApp\MyApp\Native Service\Debug\MyAppservice"
Try to remove spaces from the directory name. Change Computer Science to something like Computer_Science and App_Development to App_Development. Then right-click on your project and go to Debug As -> Debug Configurations..., then delete the active debug configuration and again create new one.
You may also try by removing the whole line file "G:\Computer Science\App Development\MyApp\GalaxyWatchApp\MyApp\Native Service\Debug\MyAppservice" from the .gdbcommand file manually and check if it fixes the issue.

How can I activate ceedling trace?

I am using ceedling for unit testing in a firmware I am working on.
I would like to see all command line option ceedling uses when invoking the compiler.
I tried to use the option --trace, but so for I have not found any difference.
ceedling test:all --trace
try:
ceedling verbosity[4] test:all
If you are on a Windows machine, the command line args can be intercepted like this:
Create a little command line tool ShowArgs.exe that displays the given command line args in a message box.
Create a registry key in SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Foo.exe whereas Foo.exe is the name of the compiler without the path.
Add a value with name debugger and value "" including the quotation marks, e.g.
SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Foo.exe\debugger="C:\Temp\ShowArgs.exe"
Now ShowArgs.exe acts as the debugger for Foo.exe and is called instead. The first argument is the path to Foo.exe, all other arguments are the ones you are interested in.

Can't set breakpoint in GDB with Golang due to error "no source file named model/page.go"

I am trying to debug a Go-program using gdb and setting breakpoints works normally in all packages, except for one. In my src-folder I have 3 subfolders that each contain packages:
crawler/
crawler.go
model/
page.go
urlutils/
urlutils.go
I cannot set a breakpoint in page.go on any line as it gives me the following error:
(gdb) break model/page.go:14
No source file named model/page.go.
Make breakpoint pending on future shared library load? (y or [n])
I do not understand why this is happening with only this one package. "model/page" is also an import in the file that contains the main function and is used when the program runs, so it must be in the executable. Does anyone have an idea?
I found a solution:
I needed to add a flag to my go build command:
go build -gcflags "-N -l" launch.go
This disables the code optimization performed by the go compiler which lead to my breakpoint working. The paths were correct and also the absolute path didn't work.
Nevertheless, thank you tomwilde for pointing me into a direction.

GDB logging file location

Hi I am new to GDB. I used the "set logging on" command. It creates a default file "gdb.txt" to store the output. However, I am unable to locate the file and see the data. Can you please tell me where the file is located?
In the current working directory. Try pwd command at the (gdb) prompt.
the gdb.txt file will not be created in pwd always.
It has to be explicitly specified by executing command 'set logging on' in gdb terminal.