From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17009 invoked by alias); 30 Aug 2002 23:41:21 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 16998 invoked from network); 30 Aug 2002 23:41:20 -0000 Received: from unknown (HELO takamaka.act-europe.fr) (205.232.38.234) by sources.redhat.com with SMTP; 30 Aug 2002 23:41:20 -0000 Received: by takamaka.act-europe.fr (Postfix, from userid 507) id 20283D2CC1; Fri, 30 Aug 2002 16:41:20 -0700 (PDT) Date: Fri, 30 Aug 2002 17:55:00 -0000 From: Joel Brobecker To: gdb-patches@sources.redhat.com Subject: Re: [RFA/controversial] move bp by line number past the prologue Message-ID: <20020830234119.GA805@gnat.com> References: <20020829181524.GC971@gnat.com> <1020829201635.ZM24274@localhost.localdomain> <20020830185346.GE1707@gnat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MGYHOYXEY6WxJCY8" Content-Disposition: inline In-Reply-To: <20020830185346.GE1707@gnat.com> User-Agent: Mutt/1.4i X-SW-Source: 2002-08/txt/msg01059.txt.bz2 --MGYHOYXEY6WxJCY8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 646 > 2002-08-30 Jim Ingham > > * 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 > > * 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 --MGYHOYXEY6WxJCY8 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="linespec.c.diff" Content-length: 3674 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) --MGYHOYXEY6WxJCY8--