Questions tagged [gdb]

1

votes
2

answer
35

Views

gdb: make a breakpoint on a class function in c++

Assume the following class: class a { public: int getA(int a){ return 5; } int getA(int a, int b){ return 6; } }; int main(){ a cA; std::cout
Joe
0

votes
0

answer
2

Views

Force gdb to use provided thread lib

I have an embedded ARM application which is bundled with all the so-libraries stripped, including the libpthread.so. Sometimes the application gets stuck in some part of code and I want to be able to attach to it with gdb and see what's going on. The problem is that gdb refuses to load the needed th...
Alex Che
1

votes
0

answer
15

Views

How to turn off printing the commands just executed

I am not sure how to call it, basically I have such user defined command: define dump_stack set $i = stackTop while $i >= 0 if stackPtr[1]->bytes == 0 printf '0x%x\n', stackPtr[$i] else printf '0x%x:%s\n', stackPtr[$i], stackPtr[$i]->bytes end set $i = $i - 1 end end When I call this command insi...
my_question
1

votes
1

answer
173

Views

Root cause a segmentation fault

Background I've built qemu-system-x86_64.exe on a Windows machine using MSYS2 (x86_64), and I'm debugging a segmentation fault that happens when I try to run it. Actually I don't think the problem is related to either QEMU or MSYS2, it's a problem of debugging segmentation fault and possibly wrong c...
Amir Gonnen
1

votes
0

answer
173

Views

Unknown Error = -2,147,414,007 when trying to make a certificate to use GDB

When I try to make a certificate to use GDB in Keychain Access on my Mac I get Unknown Error = -2,147,414,007 when I create the certificate.
Sean Brady
1

votes
1

answer
157

Views

Cannot start dbg on my python C extension

Im using python3.6.1 installed in pyenv. I have problem with running gdb on my code. When I run gdb --args python mycode.py it ends with error '/home/vydra/.pyenv/shims/python': not in executable format: File format not recognized
wyDra
1

votes
1

answer
208

Views

Meaning of GDB “info frame” output?

What is the difference between the two Instruction pointers (eip)? What is the goal of each one? Frame info image: There are two different eip?
Marcus
1

votes
1

answer
247

Views

Qt Creator does not show locals while debugging with gdb on Windows

I've recently run into the issue of not being able to use the debug view of Qt Creator. No Local Variables would show up and Expression Evaluators only work to some extent. I've created this tiny C program to demonstrate the issue, though it happened in a standard Qt App as well. #include int main(...
Binary
1

votes
0

answer
62

Views

Confusion about Go debug by GDB

I'm a java programer and I'm learning Go. Now I can use GDB simply and I have a doubt, when I debugging a Go program ,I can't check an object(or variable) what it exactly is. e.g. when I debug a java program,I can check everything in an object(or variable). public void catTest() { Cat cat1=new Cat('...
Ronacaodo
1

votes
1

answer
78

Views

GDB - don't show result of call command

I have at my disposal a pretty elaborate printing function to help me debug. Unfortunately, it prints directly to a specified file stream, rather than returning a string (it returns some irrelevant value instead). call doesn't seem to have any parameters when I call help call in GDB. Is it really no...
t.y
1

votes
0

answer
176

Views

Debugging Clang-generated RTTI code with GDB

I'm using Clang++ together with GDB. I've noticed that for some polymorphic classes GDB does not shows correct dynamic type. After some investigation it turned out that Clang puts different typenames in DWARF and RTTI : I have a template class: template< class T, sc_writer_policy POL> class sc_sign...
random
1

votes
0

answer
179

Views

SIGILL occurs when using remote debbuging on arm target even if handle SIGILL nostop is set

I'm trying to remote debug a c++ app from a windows host to a debian armbian target of cubietruck board (ARM® Cortex™-A7 Dual-Core). However the debbuger breaks while receiving SIGILL. I've searched and found the reason. It is described in this post SSL_library_init cause SIGILL when running unde...
dk13
1

votes
0

answer
667

Views

Get source code for libc for debugging in gdb

I am currently debugging an api from shared library libc6 using gdb getaddrinfo() which is being called from python module: socket.getaddrinfo() I have managed to set a breakpoint at getaddrinfo.c and I wish to navigate the execution in single steps. Source files: ldd --version tells that I have g...
Abhishek Agarwal
1

votes
1

answer
196

Views

KGDB and gdb over serial cable. cannot set breakpoints

Two Virtual machines (let's call them development and test) Ubuntu 17.10. I' ve installed on both kernel 4.15 with the following settings: CONFIG_DEBUG_INFO=y CONFIG_HAVE_ARCH_KGDB=y CONFIG_KGDB=y CONFIG_K...
fremmi
1

votes
0

answer
158

Views

How to add a software watchpoint following a breakpoint on gdb

I am trying to debug a C program which allocates and frees various instances of a particular structure during its lifetime. At some point, one of this instances is getting corrupted. To debug it, I would like to set watchpoints shortly after these structures are allocated and remove the watchpoints...
FelipeFR
1

votes
0

answer
163

Views

How to debug Chrome child process crashes (Aw-Snap pages) in gdb?

I'm using the following command on Linux to debug Chrome: $ gdb -ex 'set follow-fork-mode child' -ex run --args /usr/lib/chromium/chromium -g which gives the following output: Starting program: /usr/lib/chromium/chromium -g [Thread debugging using libthread_db enabled] Using host libthread_db librar...
kenorb
1

votes
0

answer
69

Views

Run gdb batch from shell script through shell_exec in php

Ok, I have a php calling a shell script: shell_exec('sh /home/u-pc/Downloads/coredumps/analyze.sh'); In the shell script (analyze.sh) I have: ...# Other setup code... gzip -d coredump.gz tar xvg symbols.gz gdb -batch -ex 'set logging on' -ex 'bt' myprogram mycoredump -ex 'set logging off' Now php is...
golu
1

votes
0

answer
37

Views

EMacs gdb command returns unknown message

I am new to EMacs and I'm having trouble starting the gdb debugger. With the source file open, I enter M-x gdb (Alt-x gdb). The minibuffer shows: Run gdb like this: gdb -i=mi C_Cygwin.c When I ENTER (RET), the minibuffer shows: Searching for program: No such file or directory, gdb This res...
RTC222
1

votes
1

answer
444

Views

Debugging Assembly (NASM) using gdb

I am trying to debug some Assembly using gdb and I am having some issues. Once I enter gdb, I am unable to add breakpoints, and the file command doesn't seem to work. The exact outputs are at the bottom. I've tried searching for answers but none seem to work. I am running Ubuntu 17.10 main.asm secti...
BElgy
1

votes
0

answer
52

Views

GDB step until function returns error?

I have a function that calls a big chunk of code that isn't mine. I'm trying to debug it, but just stepping until it returns an error has been slow and painful. Is there a way to break when the function is 'about to' return a negative number? I think I can set a breakpoint on the return register, b...
bhlowe
1

votes
0

answer
156

Views

How to use gdb to get ruby backtrace from different thread

I have a ruby program that spawns two threads. Rarely, it appears to be hanging on the main thread, and I'm trying to use gdb to figure out why. Using the blog post here, I have used gdb to attach to to the process, and call rb_backtrace() to get the backtrace. Problem is, the backtrace is always f...
davidgyoung
1

votes
2

answer
252

Views

Specifying GDB start script on QtCreator command line

We're using QtCreator 3.2.1 to analyse core dumps on Linux (Debian Jessie). Currently we load it up manually via the menu and 'Load Core File' dialog, which allows us to specify a GDB startup script which we use to set up the source code search paths. The paths, and hence the startup script, depen...
Jeremy
1

votes
1

answer
65

Views

Syntax error using ampersand (bitwise and) in GDB user defined command

I am attempting to create a GDB user-defined command. def decodecs if $argc == 1 set $lowaddr=(short*)($arg0) x /h $lowaddr # The line below generates the error set $lowaddr=$lowaddr & (short)0xfff8 x /h $lowaddr set $lowaddr=$lowaddr >> (short)3 set $highaddr = (short*)($arg0+2) x /h $highaddr end...
KeithSmith
1

votes
1

answer
41

Views

Why is there is difference in number of instructions executed by a program when it is running under GDB?

I am using ARM PMU counter to count the number of instructions executed between two system calls by a process. Particularly I am using 'INST_RETIRED' event to count the number of instructions executed by a process in user mode. Reference: ARMv7 R/A Reference Manual. The number of instructions is con...
Jina Lee
1

votes
0

answer
113

Views

How to get the cast type of a value after static_cast in gdb python script

I want to write a gdb python script to pasrse a class. but I cannot get the type after c++ static_cast. original type class { ... private: __iter_pointer& __begin_node() _NOEXCEPT {return __begin_node_;} __iter_pointer __begin_node_; ... } In other place, cast a _...
TsanChao
1

votes
0

answer
104

Views

gdb how to continue exec with stdin args with continue command

i am playing ctf and the program is checking if input is proccess pid then get shell now i getpid with gdb-peda by getpid command of gdb-peda how i can continue exec with stdin args that i will input the pid within it ? i have tried gdb> break *main+0 gdb> r break point 1 + 0x0... gdb> getpid gdb>...
mahmoudadel
1

votes
0

answer
215

Views

Debugging kernel using kgdb/gdb on arm target?

I got vmlinux.uimg and vmlinux from my friend. The vmlinux is build with Linux version 4.14.10. I have two machines: target (arm 32 bit architecture) and host (x86 architecture) Both systems are connected with wire, port numbers are /dev/ttySAC3 and /dev/ttyUSB0 respectively. Target boot up by readi...
Aparna Kumari
1

votes
1

answer
232

Views

How does gdb print stl containers

How does GDB pretty print this container? const unordered_map map{{'hello', 1}, {'world', 2}}; (gdb) p map $1 = std::unordered_map with 2 elements = {['world'] = 2, ['hello'] = 1} How can I get this functionality for my custom container?
applewil
1

votes
1

answer
441

Views

arm-none-eabi-gdb: Undefined target command: “sim”

I am trying to learn some about bare metal ARM programming with this tutorial: http://www.valvers.com/open-software/raspberry-pi/step01-bare-metal-programming-in-cpt1/ Luckily I successfully blinked the LED... ... but seems that I have got stuck when trying to use built-in CPU simulator: [email protected]
Zbyszek Kieliszek
1

votes
0

answer
206

Views

Warning: Loadable section “my_section” outside of ELF segments

I have built a axf (elf) file using Arm Compiler v6.9 for Cortex-R4. However when I load this to the target using Arm MCU Eclipse J-link GDB plugins it fails to load the initialisation data for my segments. If I load the axf using Segger Ozone and J-Link it loads the init data correctly. If I run th...
Realtime Rik
1

votes
0

answer
231

Views

Eclipse + OpenOCD + gdb: Attach to running target

How can I attach to a running MCU target with OpenOCD + gdb? It seems to default to flashing the binary and performing a reset, and unchecking all options under Startup for resetting and flashing results in that no source code or symbols can be loaded.
Rolle
1

votes
1

answer
745

Views

Cannot access memory at address at address “” (gdb)

#include #include #include struct Node { /* Data fields with appropraiate types */ char fname[64]; char lname[64]; char puid[16]; int Age; struct Node *next; }; struct List { struct Node *start; int numNodes; }; struct List * initialize_list() { struct List *list = (struct List *) malloc(sizeof(s...
Kenan Dominic
1

votes
0

answer
54

Views

How do we check filename of a given Fortran file unit in GDB?

Say I have opened a file in a Fortran code OPEN(UNIT=5,FILE='filename',STATUS='old',ACTION='read') and later in the code, I have WRITE(5,*) 'something...' When running in GDB and stop at the line WRITE..., how can I check what is the filename of UNIT=5? Edit The compiler I used is ifort. It turned...
JNL
1

votes
0

answer
30

Views

Linux on Power SDK QEMU Debugging with GDB

I'm checking out the Linux on Power SDK and want to have a setup using QEMU (Setup 2 from the tutorial page). So far I've got the SDK, advance toolchain cross compiler and qemu-user-space-emulator all installed on Ubuntu 16.04. The whole process was quite painstaking since the user guide and all oth...
cbg
1

votes
0

answer
103

Views

print ONLY variables stored in the data segment of program using gdb

How can I print just values that are in the data segement of a program using gdb? I know that info variables shows all local and global variables. I also know i can just look at the assembly file of the program but is there a way to do this with gdb?
cloud916
1

votes
1

answer
99

Views

Prevent breaking/stopping program on signals within GDB

I've run into a bit of an issue. I'm debugging a BOCHS OS emulator in GDB, and it sends Signal 0 fairly often (every time there is a page fault). I was wondering if there was a way to explicitly tell gdb to not break/stop execution on signals? I've tried 'handle all nostop' and specifically 'handle...
JonLuca
1

votes
1

answer
150

Views

How do I make the debugger break when an exception is thrown in D?

When debugging D code that fails due to an uncaught exception, the exception mechanism unrolls the stack all the way back and then prints a stack trace, leaving us with the somewhat less than helpful: (gdb) bt No stack. The stack trace gives us the line the exception was thrown from, but that's not...
Ray
1

votes
0

answer
71

Views

Can I change the layout direction to horizontal in the GDB TUI mode?

The default layout direction for the GDB TUI is up down e.g. src-win at top, asm-win at middle, cmd-win at bottom. Is there a way to change the direction in a horizontal style e.g. src-win at left, asm-win at middle, cmd-win at right?
isamateur
1

votes
0

answer
60

Views

How does gdb know if printed instructions are in arm or thumb mode?

Let's say you're in a gdb session and you're printing instructions of libc functions via x/[num_of_instructions]i [address]. How does gdb know whether they are to be interpreted as thumb or arm instructions?
Narc Eritor
1

votes
0

answer
49

Views

'list function' lists a different function?

So I'm doing a lab assignment and we're basically debugging an old version of coreutils ls. I ran info functions. Among the output lines was static int compare_mtime(V, V);. So I then ran list compare_mtime to see the source code, and it outputs the following: (gdb) list compare_mtime 43 /* Return...
winstontsai

View additional questions