This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: [patch] Small improvements to coverage info (4/n)


> After your patch does behavior change when trying to break on a line
> with a return stmt inside a debugger?

Note that every patch in the series was tested against GDB too, so hopefully 
this would have been caught...  But the answer is no, see lower_gimple_return:

  /* Generate a goto statement and remove the return statement.  */
 found:
  /* When not optimizing, make sure user returns are preserved.  */
  if (!optimize && gimple_has_location (stmt))
    DECL_ARTIFICIAL (tmp_rs.label) = 0;
  t = gimple_build_goto (tmp_rs.label);
  /* location includes block.  */
  gimple_set_location (t, gimple_location (stmt));
  gsi_insert_before (gsi, t, GSI_SAME_STMT);
  gsi_remove (gsi, false);

So the label, the goto and its location are all preserved:

(gdb) b ops.adb:11
Breakpoint 1 at 0x40308e: file ops.adb, line 11.
(gdb) run
Starting program: /home/eric/gnat/test_ops_okovb 

Breakpoint 1, ops.both_ok (a=..., b=...) at ops.adb:11
11               return True;      -- # ok

(gdb) b ops.adb:14
Breakpoint 1 at 0x4030c1: file ops.adb, line 14.
(gdb) run
Starting program: /home/eric/gnat/test_ops_okovb 

Breakpoint 1, ops.both_ok (a=..., b=...) at ops.adb:14
14               return False;     -- # ko

(gdb) b ops.adb:19
Breakpoint 1 at 0x403115: file ops.adb, line 19.
(gdb) run
Starting program: /home/eric/gnat/test_ops_okovb 

Breakpoint 1, ops.both_ok (a=..., b=...) at ops.adb:19
19               return False; -- # ov

-- 
Eric Botcazou


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