This is the mail archive of the mailing list for the Archer project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI bpstat evaluations vs. breakpoint hits

Hi Phil,

bpstats get evaluated first, incl. breakpoint conditions.  Only then infrun
decides whether to act on that breakpoint.  Sometimes it does not have to.

Therefore the conditionals may get evaluated more times than the breakpoint is

With the WIP patch
	[patch] Fix stale tp->step_resume_breakpoint

(as otherwise GDB internal errors) and

#include <stdio.h>
int cond (void) { puts ("cond"); return 1; } 
int func (void) { return 0; }
int main (void)
  int i = func ();
  return 0;

gcc -o 2 2.c -Wall -g;./gdb -nx ./2 -ex start -ex 'b *$pc+5 if cond ()' -ex disass -ex "echo Let's roll\n" -ex 'set debug infrun 0' -ex next 

GNU gdb (GDB)

Breakpoint 2 at 0x4004f1: file 2.c, line 6.
Dump of assembler code for function main:
   0x00000000004004e4 <+0>:	push   %rbp
   0x00000000004004e5 <+1>:	mov    %rsp,%rbp
   0x00000000004004e8 <+4>:	sub    $0x10,%rsp
=> 0x00000000004004ec <+8>:	callq  0x4004d9 <func>
   0x00000000004004f1 <+13>:	mov    %eax,-0x4(%rbp)
   0x00000000004004f4 <+16>:	mov    $0x0,%eax
   0x00000000004004f9 <+21>:	leaveq 
   0x00000000004004fa <+22>:	retq   
End of assembler dump.
Let's roll

Breakpoint 2, 0x00000000004004f1 in main () at 2.c:6
6	  int i = func ();
(gdb) _

Therefore any actions upon breakpoint should be executed somewhere around
bpstat_do_actions, which happens much later than bpstat_stop_status and its


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]