Index: infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.259 diff -u -p -r1.259 infrun.c --- infrun.c 16 Dec 2007 19:14:23 -0000 1.259 +++ infrun.c 19 Dec 2007 07:57:28 -0000 @@ -2704,17 +2704,22 @@ process_event_stop_test: if (ecs->stop_func_end && ecs->sal.end >= ecs->stop_func_end) { - /* If this is the last line of the function, don't keep stepping - (it would probably step us out of the function). - This is particularly necessary for a one-line function, - in which after skipping the prologue we better stop even though - we will be in mid-line. */ - if (debug_infrun) - fprintf_unfiltered (gdb_stdlog, "infrun: stepped to a different function\n"); - stop_step = 1; - print_stop_reason (END_STEPPING_RANGE, 0); - stop_stepping (ecs); - return; + /* We landed in the last line of the function. To help debugging + one-line functions, always stop (even if stopping mid-line) when + the function starts and finishes in the same line. */ + struct symtab_and_line fun_start_sal; + + fun_start_sal = find_pc_line (ecs->stop_func_start, 0); + if (fun_start_sal.line != 0 && fun_start_sal.line == ecs->sal.line) + { + if (debug_infrun) + fprintf_unfiltered (gdb_stdlog, + "infrun: stepped to a different function\n"); + stop_step = 1; + print_stop_reason (END_STEPPING_RANGE, 0); + stop_stepping (ecs); + return; + } } step_range_start = ecs->sal.pc; step_range_end = ecs->sal.end;