[RFA/controversial] move bp by line number past the prologue

Joel Brobecker
2002-08-29T18:15:27Z

[-- Attachment #1: Type: text/plain, Size: 1145 bytes --]

This proposal has been discussed on this gdb-patches mailing list, and
there has been no consensus. Some of us are in favor of this change,
others are against. I am submitting this change for approval as a
request to make a decision. I don't know if making a small summary of
the different points for/against this change of behavior would be
useful, all the discussion is archived under

[RFC] breakpoints and function prologues...

http://sources.redhat.com/ml/gdb-patches/2002-07/msg00448.html and
http://sources.redhat.com/ml/gdb-patches/2002-07/msg00451.html

Let me know if you would like to see such a summary (I'll try not to
distort too much the different points too much in my favor :-).

2002-08-29 Jim Ingham <jingham@apple.com>

* linespec.c (decode_line_1): Skip the function prologue if
funfirstline is set. Changes the behavior of the break command
to skip the function prologue when breaking by line number.

This change introduces 5 FAILs in one testcase which assumes the current
behavior, so the FAIL is expected. Should this patch be approved, I'll
the testcase up.

Ahem... Ok to apply?
--
Joel

[-- Attachment #2: linespec.c.diff --]
[-- Type: text/plain, Size: 1312 bytes --]

Index: linespec.c
===================================================================
RCS file: /cvs/src/src/gdb/linespec.c,v
retrieving revision 1.21
diff -c -3 -p -r1.21 linespec.c
*** linespec.c 11 May 2002 22:46:19 -0000 1.21
--- linespec.c 29 Aug 2002 18:03:02 -0000
*************** decode_line_1 (char **argptr, int funfir
*** 1067,1073 ****
--- 1067,1097 ----
if (val.symtab == 0)
val.symtab = s;

+ /* If funfirstline is set, we need to look up the function
+ containing the line, and move past the prologue. */
+
val.pc = 0;
+ if (funfirstline)
+ {
+ CORE_ADDR pc = 0;
+
+ if (find_line_pc (val.symtab, val.line, &pc))
+ {
+ struct symbol *func_sym;
+ struct symtab_and_line sal;
+
+ func_sym = find_pc_function (pc);
+ if (func_sym)
+ {
+ sal = find_function_start_sal (func_sym, 1);
+ /* Don't move the line, just set the pc
+ to the right place. */
+ if (val.line <= sal.line)
+ val.pc = sal.pc;
+ }
+ }
+ }
+
values.sals = (struct symtab_and_line *)
xmalloc (sizeof (struct symtab_and_line));
values.sals[0] = val;