0

I am trying to write a GDB script that "listens" to a remote target and responds to the start of one of two processes. I have the targeting part done but am stuck on identifying which breakpoint is hit.

The script would look something like this:

break *0x400de0    # Process 1 start addr
break *0x40f650    # Process 2 start addr
c                  # <- GDB waits here for one of the two processes to begin
# hits one of two breakpoints #
if (??? == "0x400de0")
    # do something
else
    # do something else

However, I'm somewhat stuck on getting the address at the breakpoint into a variable. I've looked into using frame which prints the current address, however I have no idea how to get that into a variable to use for comparison.

1
  • 1
    Try variable $pc. Commented Sep 10, 2019 at 10:01

1 Answer 1

1

I think you're looking for:

if ($pc == 0x400de0)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.