Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gdb breakpoint in background mode

Tags:

c++

gdb

I'm trying to set breakpoing (break ) after attaching to process in background mode (attach &). However I got Cannot insert breakpoint 1. Cannot access memory at address 0x5560c872b71a Any reason why it's happening? Setting breakpoint in foreground mode is fine. Program was written in C++.

like image 546
Xiao Wu Avatar asked Dec 31 '25 10:12

Xiao Wu


1 Answers

Any reason why it's happening?

The program must be stopped when inserting a breakpoint into it. Inserting a breakpoint is not an atomic operation, and writing to program code (which is what breakpoint insertion amounts to) while that code is executing may result in all kind of badness.

Use interrupt command to stop the process and bring it to foreground, insert your breakpoint, then continue & to put it into background again.

like image 52
Employed Russian Avatar answered Jan 03 '26 10:01

Employed Russian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!