Can I set a breakpoint on 'memory access' in GDB?

I am running an application through gdb and I want to set a breakpoint for any time a specific variable is accessed / changed. Is there a good method for doing this? I would also be interested in...

How to run gdb against a daemon in the background?

I'm trying to debug a server I wrote with gdb as it segfaults under very specific and rare conditions. Is there any way I can make gdb run in the background (via quiet or batch mode?), follow...

How to dump or search in call stacks of ALL threads in Visual Studio

How to dump or search in call stacks of ALL threads in Visual Studio? We have a server process to debug and it has hundreds of threads running, so it should be hard to manually check each...

What does <value optimized out> mean in gdb?

(gdb) n 134 a = b = c = 0xdeadbeef + ((uint32_t)length) + initval; (gdb) n (gdb) p a $30 = <value optimized out> (gdb) p b $31 = <value optimized out> (gdb) p c $32 = 3735928563 How can gdb...

Hex input in Windows Command-line

I am trying to solve this programming puzzle another student at my school put out, and we were given an .exe and the corresponding .c source code. The way I am trying to attack the problem is...

Using backspace with ncurses

I have a simple ncurses program set up that reads characters one at a time with getch() and copies them into a buffer. The issue I am having is detecting a press of the backspace key. Here is the...

Segmentation Fault when loading font with FreeType

I'm trying to use the FreeType library together with libpng to output a PNG image of a glyph. My code compiles just fine but I then run into a segmentation fault. Here's some debugging output from...

Stepping through the debbuger in qtcreator causes gdb crash after a couple seconds

After I step through any code in this file in particular in a static library, gdb crashes after a couple of seconds. I can step through other parts of the static library and shared libs that I...

_mm_load_ps caused segment fault

I have a code snippet. The snippet just loads 2 arrays and calculates dot product between them using SSE. Code here: using namespace std; long long size = 3200000; float* _random() { ...

GDB: setting complex break point with condition involving variable from previous frame

Is it possible to set a complex breakpoint which has condition which involves check on the argument passed to the outer function(frame). eg. 1 #0 sample::_processMessage (this=0xa5c8c0,...

Failed to build gem native extensions of jquery-rails after installing Python 2.7

Using: Ruby: 2.1.1 Rails: 4 OS: Debian Wheezy Short problem story: I installed Python 2.7 and now my bundle install won't succeed anymore. It got stuck at: Using jquery-rails...

In GDB, can you set memory as if it were a char array?

Say for instance I have a 32 element unsigned char array at address 0xdeadbeef. I would like to overwrite the contents of the array in memory. I am not compiled with -g, and so cannot just do a...

Linux x86_64 assembly socket programming

Hello all. So I'm learning assembly.And as per my usual learning steps with any new language I pick up I've arrived at networking with assembly. Which, sadly isn't going that well as I've pretty...

Understanding how EIP (RIP) register works?

I'm a complete novice to computer architecture and the low level stuff that happens at the processor/memory level. I'll start by saying that. What i've done with computers has pretty much always...

GDB debugging arguments passed through newlib

I am trying to use newlib on a TI CC2538 ARM Cortex M3 part. The objective is to use printf for debugging messages and I've actually got that working. However the system will segfault after a...

Is there an equivalent of GDB for GCC for debugging when compiling with CLANG?

I have found that you can debug with GDB when compiling with GCC however at our university we are required to use CLANG for compiling and I can't find an equivalent of GDB for GCC for CLANG, is there one?

A buffer overflow exercise using a shellcode

I'm doing an exercise about a buffer overload on a C program, the goal of this problem is to get the root shell once I have inserted a shellcode into the program. This is what I have until...

Why NASM on Linux changes registers in x86_64 assembly

I am new to x86_64 assembly programming. I was writing simple "Hello World" program in x86_64 assembly. Below is my code, which runs perfectly fine. global _start section .data msg: db...

How do I use OCIServerVersion (Oracle) from a C program?

FYI: This code is part of an opensource LabView LLB/library/DLL for DB access My code segment is as follows: #ifdef HAVE_ORACLE case oracle_api: sprintf(DriverName, "%s\nOracle ",...

How to debug an application requiring low ports to be opened with GDB on Ubuntu

I have an application that requires to open port 80. In accordance to this, I gave the binary capabilities to open low ports. Also I gave capabilities to gdb itself. When I run the binary, port is...

Direct kernel boot option in virt manager

I installed Ubuntu18.04 desktop in a kvm-qemu virtualization setup and it is working. I found that there is a direct kernel boot option in virt-manager settings for a virtual machine. I want to...

Undeterministic std::system_error: what(): Operation not permitted

I am trying to run my program and once in a few runs I get an error: terminate called after throwing an instance of 'std::system_error' what(): Operation not permitted My code is available...

How to fix "g++: error: helloworld.cpp: No such file or directory" in visual Studio Code with WSL installed?

I installed Visual Studio Code on W10 to run some code with WSL installed ( Ubuntu). I followed the steps in the following article : https://code.visualstudio.com/docs/cpp/config-wsl But I keep...

Eigen3 and Clion: How to display matrix contents in Clion ide?

I have followed the instructions for updating my GDB for use with Eigen3. However, the CLion IDE is unable to load the contents of eigen matrices in the debug panel. What should be a quick...

GDB - how can a breakpoint disable itself the best way?

If I have a breakpoint that has the number 8 for example. If I want this breakpoint to be disabled after it is hit, I write the following in commands 8: disable 8 end If I delete a breakpoint...

Docker and Flutter Web hot reload

I'm trying to web development environment with Flutter in docker with docker compose. *I stuck with a hot reload for Flutter, is there any way to make it work? (except installing VSCode on...

MACOSX M1 ARM64 Visual Studio Code on MACOS Fails to start debugger w/ C++ application

I am seeing the following error from the console window on VSC. ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". process exited with status -1 (attach failed...

Cannot access memory when debugging xv6 user program using gdb

I am currently self-studying 2020 MIT 6.S081: Operating System Engineering https://pdos.csail.mit.edu/6.828/2020/schedule.html. I have followed all the steps for MAC OS to set up the environment...

getifaddrs returning 'bad file descriptor'/crashing the application

In my program, I have a thread which has to continuously monitor the network interfaces therefore it continuosly uses getifaddrs() in a while loop. while(true) { struct ifaddrs...

gmp is missing while configuring building gdb from source

I am trying to build gdb from source, which version is 11.1. I have configured the GMP including path, but the configure script still report an error. configure: error: GMP is missing or...