-1

After running the program in gdb and disas command:

   0x0000555555556692 <+0>:  sub    $0x18,%rsp
   0x0000555555556696 <+4>:  mov    %0x28,%rax
   0x00005555555566da <+13>: jmpq   *%rax

if i use

(gdb) until *0x000055555555669f

which is line <+13>, does it execute line 13 then stops or does it execute only line 4 then stops?

  • Did you try it? What does `print /x $pc` show? That will tell you whether the JMP has executed and updated the program counter (RIP) yet or not. Perhaps also useful to test be with a valid address in RAX so code-fetch from the new RIP won't fault. Also, are you sure that's real output? `0x...696` to `0x...6da` is more than a 9 byte gap in address, and `mov %0x28,%rax` isn't valid AT&T syntax. And a `$0x28` mov-immediate would be either 7 or 10 bytes long, not 9, unless you somehow encoded the sign-extended-imm32 version manually with redundant prefixes. – Peter Cordes Mar 10 '20 at 20:06
  • 1
    Yes, you're right. That's not the real output. I was just making up addresses for the sake of the question. I tried it and it looks like until [enter address here] command will not execute the statement at the addr. specified in the argument. It will only execute the statement before it, so only <+4>. Please correct me if I am wrong. – Block o Butter Mar 10 '20 at 20:14
  • Wait a minute, your question claims `0x000055555555669f` is the `<+13>` line, but it has a different address in the fake disassembly. At least make your question self-consistent if you're going to make something up, or better construct a real test case and assemble it, then copy/paste GDB output. (Including what happened when you tried). I didn't notice that text at first and thought you were asking about a situation where the `until` address was somewhere in the middle of an instruction, or was the branch target or something. – Peter Cordes Mar 11 '20 at 01:04

1 Answers1

1

gdb will always break before executing the instruction it breaks on.

depsterr
  • 71
  • 6