From: Joel Brobecker <brobecker@gnat.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFA/controversial] move bp by line number past the prologue
Date: Fri, 30 Aug 2002 17:55:00 -0000 [thread overview]
Message-ID: <20020830234119.GA805@gnat.com> (raw)
In-Reply-To: <20020830185346.GE1707@gnat.com>
[-- Attachment #1: Type: text/plain, Size: 646 bytes --]
> 2002-08-30 Jim Ingham <jingham@apple.com>
>
> * linespec.c (decode_line_1): Skip the function prologue if
> funfirstline is set, unless adjust_break_after_prologue is
> unset by the user. Changes the behavior of the break command
> to skip the function prologue when breaking by line number.
>
> 2002-08-30 Joel Brobecker <brobecker@gnat.com>
>
> * linespec.c (adjust_break_after_prologue): New static variable.
> (_initialize_linespec): New function.
>
> * Makefile.in: Update the dependencies for linespec.c
KevinB rightfully pointed out that the patch was missing...
--
Joel
[-- Attachment #2: linespec.c.diff --]
[-- Type: text/plain, Size: 3674 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 30 Aug 2002 18:44:03 -0000
***************
*** 30,35 ****
--- 30,40 ----
#include "value.h"
#include "completer.h"
#include "cp-abi.h"
+ #include "gdbcmd.h"
+
+ /* local variables */
+
+ static int adjust_break_after_prologue = 1;
/* Prototype for one function in parser-defs.h,
instead of including that entire file. */
*************** extern char *operator_chars (char *, cha
*** 42,47 ****
--- 47,54 ----
/* Prototypes for local functions */
+ void _initialize_linespec (void);
+
static void cplusplus_error (const char *name, const char *fmt, ...) ATTR_FORMAT (printf, 2, 3);
static int total_number_of_methods (struct type *type);
*************** decode_line_1 (char **argptr, int funfir
*** 1067,1073 ****
--- 1074,1105 ----
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. This behavior
+ can be deactivated by unsetting adjust-break-after-prologue. */
+
val.pc = 0;
+ if (funfirstline && adjust_break_after_prologue)
+ {
+ 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;
*************** minimal_symbol_found: /* We also jump h
*** 1267,1270 ****
--- 1299,1317 ----
error ("Function \"%s\" not defined.", copy);
return values; /* for lint */
+ }
+
+ void
+ _initialize_linespec (void)
+ {
+ struct cmd_list_element *c;
+
+ c = add_set_cmd ("adjust-break-after-prologue", class_breakpoint,
+ var_boolean, (char *) &adjust_break_after_prologue,
+ "Set whether GDB should adjust the location of a \
+ breakpoint past function prologues when computing its address from a line \
+ number.", &setlist);
+
+ add_show_from_set (c, &showlist);
+
}
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.236
diff -c -3 -p -r1.236 Makefile.in
*** Makefile.in 14 Aug 2002 18:13:30 -0000 1.236
--- Makefile.in 30 Aug 2002 18:44:04 -0000
*************** symtab.o: symtab.c $(defs_h) $(symtab_h)
*** 2233,2239 ****
linespec.o: linespec.c $(linespec_h) $(defs_h) $(frame_h) $(value_h) \
$(objfiles_h) $(symfile_h) $(completer_h) $(symtab_h) \
! $(demangle_h) $(command_h) $(cp_abi_h)
macroexp.o: macroexp.c $(defs_h) $(gdb_obstack_h) $(bcache_h) $(macrotab_h) \
$(macroexp_h) $(gdb_assert_h)
--- 2233,2239 ----
linespec.o: linespec.c $(linespec_h) $(defs_h) $(frame_h) $(value_h) \
$(objfiles_h) $(symfile_h) $(completer_h) $(symtab_h) \
! $(demangle_h) $(command_h) $(cp_abi_h) $(gdbcmd_h)
macroexp.o: macroexp.c $(defs_h) $(gdb_obstack_h) $(bcache_h) $(macrotab_h) \
$(macroexp_h) $(gdb_assert_h)
prev parent reply other threads:[~2002-08-30 23:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-29 11:37 Joel Brobecker
2002-08-29 13:20 ` Kevin Buettner
2002-08-29 13:37 ` Andrew Cagney
2002-08-29 14:50 ` Kevin Buettner
2002-08-29 15:30 ` Michael Snyder
2002-08-30 12:06 ` Joel Brobecker
2002-08-30 17:55 ` Joel Brobecker [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020830234119.GA805@gnat.com \
--to=brobecker@gnat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox