Questions tagged [gdb]

0

votes
0

answer
23

Views

Struct pointer strange behavior

I'm trying to make a BrainFuck (BF) interpreter using a two-way linked list. However, the way I'm moving through this list seems to have a rather strange impact on cells. So first here's the part of my program that gives me a hard time int main(int argc, char **argv) { Cell c = {NULL, NULL, '\0', NU...
Tix'at
-1

votes
0

answer
13

Views

GDB shows valid pointer but function is called for invalid one

I get very strange behavior in my code. Including a lot of code is not an option so it can be boiled down to this. I have a class with member pointer to another instance of this class called parent (it is nullptr by default). And a function that is called recursively: class FileEntry { void on_child...
funbiscuit
0

votes
0

answer
3

Views

Is there a way of mainpulating the zero flag in gdb?

i want to reverse engineer an executable and in process i want to cause a stack overflow, because of the strcpy function. When disassembling there is a jne after a compare and when is false code continues to an exit function and as a result exiting the program.If it is true it jumps and goes to a c...
0

votes
0

answer
25

Views

How to dump objects of a running Python program?

I have a Python program which basically keeps list of Counter objects and then writes them to disk. After four days counting has finished but the system is almost out of 63GB memory and it has already swapped out 50GB and no progress. Here is a simplified version of my code. import os import time fr...
user1480788
0

votes
0

answer
9

Views

_L_lock_791() when printf() called

bt #0 __lll_lock_wait_private () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:97 #1 0x00007f8bbbc215e0 in _L_lock_791 () from /lib64/libc.so.6 #2 0x00007f8bbbc1bf60 in _IO_vfprintf_internal (s=0x7f8bbbf67040, format=0xcc3ae8 "send wrapper data: gate_sid=%d,uclient_sid=%d,cmd_type=%d\n...
王晓亮
1

votes
1

answer
554

Views

Cannot see any variable values while debugging

I am using Nsight on Ubuntu 16.04. My current set up allows me to compile and run my code perfectly fine through the nsight IDE. After making sure the program was building in debug mode (wasn't originally), it finally allowed me step through my code. The problem I am having is whenever I try to deb...
cmacia06
1

votes
1

answer
341

Views

Computing offset of a function in memory

I am reading documentation for a uprobe tracer and there is a instruction how to compute offset of a function in memory. I am quoting it here. Following example shows how to dump the instruction pointer and %ax register at the probed text address. Probe zfree function in /bin/zsh: # cd /sys/kernel/d...
Marko Kevac
0

votes
0

answer
4

Views

gdb can't cross-compile for arm-linux

I'm both gcc & arm-gcc in the environment path: [[email protected] gdb-arm]$ gcc -v Using built-in specs. Target: i386-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-...
Jiu
1

votes
1

answer
81

Views

evaluating methods of libc++ in gdb when using clang

When compiling this #include #include int main() { std::vector foo; foo.push_back( 1 ); printf( "%zu\n", foo.size() ); } with clang++ foo.cpp -stdlib=libc++ -g, when running a.out in gdb and trying to show the result of foo.size(), gdb says "Cannot evaluate function -- may be inlined". Is there a...
user3459474
0

votes
0

answer
5

Views

QtCreator cannot debug using gdb

debug a pure c program(without Qt, CMake project) in raspbian using QtCreator got error: &"warning: GDB: Failed to set controlling terminal: Inappropriate ioctl for device\n" &"Cannot exec -c exec /home/user/build-Services-Raspberry_Pi-Debug/Server .\n" &"Error: No such file or directory\n" I tried...
Jiu
1

votes
1

answer
281

Views

Linux Kernel Debugging: “Python Exception <class 'gdb.error'> There is no member named module_core.” when trying to use helper scripts in gdb

I've been following this guide to set up a Linux kernel debugging environment with gdb and VMWare. Everything went on smoothly until that part: Connect GDB to the debuggee We won’t be able to see symbols from loaded kernel modules yet. We’ll load the helper script and then run lx-symbols, whic...
0xc3faadd3
1

votes
1

answer
57

Views

Using GDB to fix double free or corruption (!prev) error in large project

Background: I have forked a rather large project (popcornmix omxplayer repo) and I am modifying it to allow for synchronization on multiple displays. I am getting the following segmentation fault at run time *** Error in `./omxplayer.bin': double free or corruption (!prev): 0x02141400 *** ./omxplaye...
puk
0

votes
0

answer
2

Views

GDB on Mac OS X v10.12.6, program terminated with Unknown signal

I'm trying to use GBD on this pice of code #include double global1 = 55.5; double global2 = 66.6; int gg(int a) { int p = 55; int q = 66; int r = p + a; r += q; char c; for(c = 0; c
h3h325
1

votes
1

answer
1.6k

Views

MIPS core dump with ra and pc equal 0000000

I'm getting intermittent core dumps in one of our processes. All of the threads' stacks, aside from the one which crashed, seem OK, and parsed correctly. The thread that crashes has an apparently corrupted call stack. The stack is has two frames, both of them 0x00000000. Looking on the registers, bo...
Necnec
1

votes
1

answer
855

Views

Reason for SIGSEGV

I have a sample application that I have created to understand an experiment with ELF binary format. When I run it, it crashes after receiving SIGSEGV. After attaching it with gdb and then running, I see that it crashes at the following line (gdb) x/i 0x08054697 => 0x8054697: mov %edx,0x80f8f5c...
javed
1

votes
1

answer
19.1k

Views

how to view segmentation fault (core dumped)

I am unable to move forward in getting to see the core dumped. I have got this when i typed gdb normal_estimation core Reading symbols from /home/sai/Documents/pcl_learning/normal_estimation/build/normal_estimation...(no debugging symbols found)...done. warning: core file may not match specified ex...
Sai
1

votes
3

answer
122

Views

using gdb debug c

I run this command in my terminal, gcc -g -I/usr/include -g sample_client.c lsp.o lspmessage.pb-c.o -o sample_client -L/usr/lib -lprotobuf-c in my file directory, I can see a sample_client file. Its property is executable. However, when I run (gdb) sample_client I got this, Undefined command: "sampl...
user2036452
1

votes
1

answer
1.6k

Views

What does 0x4 from cmp 0x4(%esi),%ebx assembly instruction mean?

What does 0x4 from the following assembly line mean? cmp 0x4(%esi),%ebx je ... When this compare returns equal and the jump is performed the registers have the values: %esi 0xe944d6d0 %ebx 0xe94ceccc Sorry for asking such a simple question but I'm having a hard time searching such paranthesis notati...
George
1

votes
5

answer
228

Views

Embedding scripting language for debugging purposes

I would like to embed a scripting language(js, python, perl, even php, anything that's easy to use) in an OpenGL C++ application. I'd like to do this in order to be able to do things like: print values of various C++ class members at runtime cause interrupts that would wake up gdb at runtime after I...
average
1

votes
1

answer
3.6k

Views

GDB Core Analysis of a thread core dump

For some reason, the generated core file is only a core from a thread that is part of the main application. When I load it with the binary that actualy crashed, I get BFD: Warning: core is truncated: expected core file size >= 40919040, found: 61440. How can I tell gdb that this is a thread from tha...
Zlatko
1

votes
1

answer
77

Views

why do we need to pass the program path along with the core file to debugger?

Is it relevant that the program is exactly the same build as the one which crashed to generate the core file? dbx
Medicine
1

votes
2

answer
114

Views

How to skip (not execute!) a call in GDB when debugging without symbols?

I am debugging a Linux program to which I have no symbols. The binary is stripped. No big deal, I can handle that. However, how can I skip a call inside the debugger when I reach a particular piece of code? What I am asking is not this: Use gdb to debug assembly, how to skip a call I am interested i...
0xC0000022L
1

votes
1

answer
1.2k

Views

next command in gdb is not working correctly

I am simply using gdb to step through a code line by line to learn how it is working and what it is doing. It worked fine the first time I did this, but now the next command is not working right. Sometimes it goes forward, sometimes it goes backwards. It doesn't make sense. Every time I do this it s...
kevin
1

votes
2

answer
1.3k

Views

GDB cv::Mat python object issue when debugging a c++ program

When debugging a C++ OpenCV program, I'd like to see an image in my program under GDB, I mean I would like to visualize the data under GDB. Luckily I have: GDB with python support; I have installed python 2.7.4, numpy library, and opencv official release 2.4.4; I have installed the python interface...
ollydbg23
1

votes
1

answer
1.6k

Views

How to interpret gdb disassemble output?

I am trying to match the gdb disassemble output (disas [address]) against the source code. I know that such mapping can be done using (gdb) info line *address to find the matching line. However I do not quite understand the format of the output of disassemble. Specifically, what do the following nu...
Amar
1

votes
1

answer
978

Views

Xamarin.iOS- Debugging native crash in a bound library using GDB

I have a third-party library on which I did bindings and that I built for archiving using XCode. I use it in my C# Xamarin app. Nevertheless, I had a native crash that I have no way of debugging through Xamarin Studio. I tried attaching gdb to the process but I get the following warnings: warning: C...
airpaulg
1

votes
1

answer
530

Views

gdb python : Can anyone explain me how to use this script written in this post?

How to do it for a c code..? Is it possible..? I read this post. I also want to do similar things but i am not able to use the given updated script at link GDB-Python scripting: any samples iterating through C/C++ struct fields I followed the following steps to test : my source code name was : test....
1

votes
1

answer
914

Views

Backtrace points to fopen crash

Following is the backtrace I got from a recent crash. It points to the fopen call. Not sure whats going on here. There is enough space on the device. & Even if the file is not their , it should return NULL. Crashing does not make sense. here is the bt (gdb) bt #0 0xb788f50e in __open_nocancel...
vindyz
1

votes
1

answer
1.4k

Views

GDB debug output for multi-thread program

All, I am debuging a 24-thread program with GDB, now I have find which line in the code the error occurs, but I cannot tell what the error is from the output of GDB. The followsing line of code leads to the error, it's just a normal insertion to a map structure. current_node->children.insert(std::pa...
Bloodmoon
1

votes
2

answer
3.1k

Views

Why “No symbol file now” when I debug by gdb?

the Makefile is: objects = disk.o super.o inode.o namei.o open.o main.o test : $(objects) cc -g -Wall -O2 -o test $(objects) disk.o : fs.h disk.h cc -g -Wall -O2 -c disk.c namei.o : fs.h cc -g -Wall -O2 -c namei.c open.o : fs.h cc -g -Wall -O2 -c open.c super.o : fs.h cc -g -Wall -O2 -c super.c ino...
lxgeek
1

votes
1

answer
44

Views

Is there a way to tell which to tell what the hostname where a binary was compiled is using gdb? [closed]

Upon loading a binary in gdb I can use info sources to see paths for source files. They are absolute paths though but not sure which server the binary was built on. Is this information available at all in the binary?
Palace Chan
1

votes
2

answer
2.4k

Views

What's the file .gdbinit meant for?

Sorry for my ignorance but I saw there were a lot questions about .gdbinit file. I just cannot understand what this file brings to me. Seems that it is used for some python script for modern gdb, making the output of gdb more readable. But what's the exact difference? How can I utilize this file in...
Hongxu Chen
1

votes
1

answer
1.3k

Views

Why is this stack trace appearing when compiled with gcc 4.7 but not with older pre 4.3?

I have a fairly large binary which I had been building for a while on a pretty old version of GCC (4.1.2). I recently built it with 4.7 but when I run it it crashes with the following backtrace: terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct NULL...
Palace Chan
1

votes
1

answer
62

Views

How to do a specific action when ANY Unknown Breakpoint gets Hit in GDB

I have read the following SO question: Do specific action when certain breakpoint hits in gdb Here, we use 'command' to decide what to do when the SPECIFIED Breakboint Gets Hit. My Question is: Suppose I put Breakpoints on ALL the Functions matching a given pattern: gdb$rbreak func_ => 100 Breakpoin...
Sandeep Singh
1

votes
1

answer
1.3k

Views

ELF modify section flags

I compiled a C code using gcc and when I check the sections of the ELF using readelf I can see that the flags for .data section are set to WA (Writable and Allocatable). Is it possible to modify these flags? Can I make this section executable? I am using gdb to debug this binary and I would like to...
Neon Flash
1

votes
1

answer
961

Views

how to detect if process is being debugged

I have a C++ application, lets call dummy1, which I want to debug in cgdb, a curl interface to gdb, in Linux (ubuntu 12.04). The debugging needs to be synchronized with a controller process, which I have the source of. edit the controller connects and communicate with and control dummy1 via http. I...
n611x007
1

votes
1

answer
1.6k

Views

Program exists with file not found even though the file exists

I am trying to solve the binary bomb given in this course. You can download the bomb itself here When I try to start the bomb (in the terminal or in gdb) it exists mith code 127 respectively file not found. But since I can set permissions on the file, copy it ... I'm pretty sure that it exists. Well...
Dave
1

votes
1

answer
93

Views

In gdb, is it possible to find out which memory address has a certain value?

For example, I want to find out which memory address(es) stores the value 0xbffff5a0. Can gdb give me a list of address within a certain range that has this value?
zeion
1

votes
2

answer
145

Views

gcc on windows generating garbage? windows vs linux

I'm trying to find out why in windows has so much more instructions for the same program than linux. So I just used int a=0xbeef; and printf("test\n"); in C and compiled in Linux and Windows. When I debug and disassembly the main frame I got this: On linux: 0x080483e4 : push %ebp 0x080483e5 :...
int3
1

votes
1

answer
134

Views

Program will only crash when it's not connected to a real terminal - how to debug?

I have a program that crashes with a segfault at 1 ip 0000000000000001 sp 0000000008077d60 error 14 whenever it's not connected to a real terminal, e.g. ./program > log.txt & will crash. Running it normally doesn't lead to this strange behavior. I wanted to see if gdb can help me finding the cause f...
user1273684

View additional questions