From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29410 invoked by alias); 20 Jun 2010 07:03:06 -0000 Received: (qmail 26419 invoked by uid 22791); 20 Jun 2010 07:02:59 -0000 X-SWARE-Spam-Status: No, hits=0.7 required=5.0 tests=AWL,BAYES_50,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,FREEMAIL_REPLY,RCVD_IN_DNSWL_NONE,TW_BJ,TW_DB,TW_FW,TW_XD X-Spam-Check-By: sourceware.org Received: from mail-pw0-f41.google.com (HELO mail-pw0-f41.google.com) (209.85.160.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 20 Jun 2010 07:02:49 +0000 Received: by pwi7 with SMTP id 7so2786516pwi.0 for ; Sun, 20 Jun 2010 00:02:47 -0700 (PDT) Received: by 10.143.154.28 with SMTP id g28mr2293565wfo.70.1277017367159; Sun, 20 Jun 2010 00:02:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.32.8 with HTTP; Sun, 20 Jun 2010 00:02:27 -0700 (PDT) In-Reply-To: References: From: Hui Zhu Date: Sun, 20 Jun 2010 07:03:00 -0000 Message-ID: Subject: Re: [Patch] Bug 8287: Skip uninteresting functions while debugging To: Justin Lebar Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-06/txt/msg00435.txt.bz2 patch -p1 < /tmp/prefix.txt patching file gdb/Makefile.in Hunk #1 succeeded at 657 (offset 4 lines). patch: **** malformed patch at line 14: frame-unwind.h \ Could you try other mail client or post your patch as attachment? I think your patch that your post was added a lot of enter like following l= ine: @@ -653,6 +653,7 @@ SFILES =3D ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ Thanks, Hui On Sat, Jun 19, 2010 at 02:55, Justin Lebar wrote: > This adds support for a "blacklist" which contains files and functions > which are skipped while single-stepping. =A0This patch also fixes bug > 11614: decode_variable() in linespec.c does not obey its contract > > diff --git a/gdb/Makefile.in b/gdb/Makefile.in > index fc148fe..5d2c23e 100644 > --- a/gdb/Makefile.in > +++ b/gdb/Makefile.in > @@ -653,6 +653,7 @@ SFILES =3D ada-exp.y ada-lang.c ada-typeprint.c > ada-valprint.c ada-tasks.c \ > =A0 =A0 =A0 =A0auxv.c ax-general.c ax-gdb.c \ > =A0 =A0 =A0 =A0bcache.c \ > =A0 =A0 =A0 =A0bfd-target.c \ > + =A0 =A0 =A0 blacklist.c \ > =A0 =A0 =A0 =A0block.c blockframe.c breakpoint.c buildsym.c \ > =A0 =A0 =A0 =A0c-exp.y c-lang.c c-typeprint.c c-valprint.c \ > =A0 =A0 =A0 =A0charset.c cli-out.c coffread.c coff-pe-read.c \ > @@ -772,7 +773,7 @@ annotate.h sim-regno.h dictionary.h dfp.h main.h > frame-unwind.h =A0\ > =A0remote-fileio.h i386-linux-tdep.h vax-tdep.h objc-lang.h \ > =A0sentinel-frame.h bcache.h symfile.h windows-tdep.h linux-tdep.h \ > =A0gdb_usleep.h jit.h xml-syscall.h ada-operator.inc microblaze-tdep.h \ > -psymtab.h psympriv.h > +psymtab.h psympriv.h blacklist.h > > =A0# Header files that already have srcdir in them, or which are in objdi= r. > > @@ -806,6 +807,7 @@ COMMON_OBS =3D $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \ > =A0 =A0 =A0 =A0addrmap.o \ > =A0 =A0 =A0 =A0auxv.o \ > =A0 =A0 =A0 =A0bfd-target.o \ > + =A0 =A0 =A0 blacklist.o \ > =A0 =A0 =A0 =A0blockframe.o breakpoint.o findvar.o regcache.o \ > =A0 =A0 =A0 =A0charset.o disasm.o dummy-frame.o dfp.o \ > =A0 =A0 =A0 =A0source.o value.o eval.o valops.o valarith.o valprint.o pri= ntcmd.o \ > diff --git a/gdb/blacklist.c b/gdb/blacklist.c > new file mode 100644 > index 0000000..2bd65cc > --- /dev/null > +++ b/gdb/blacklist.c > @@ -0,0 +1,555 @@ > +/* Header for GDB line completion. > + =A0 Copyright (C) 2010 Free Software Foundation, Inc. > + > + =A0 This program is free software; you can redistribute it and/or modify > + =A0 it under the terms of the GNU General Public License as published by > + =A0 the Free Software Foundation; either version 3 of the License, or > + =A0 (at your option) any later version. > + > + =A0 This program is distributed in the hope that it will be useful, > + =A0 but WITHOUT ANY WARRANTY; without even the implied warranty of > + =A0 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =A0See the > + =A0 GNU General Public License for more details. > + > + =A0 You should have received a copy of the GNU General Public License > + =A0 along with this program. =A0If not, see . =A0*/ > + > +#include "defs.h" > +#include "blacklist.h" > +#include "value.h" > +#include "valprint.h" > +#include "ui-out.h" > +#include "gdb_string.h" > +#include "symtab.h" > +#include "gdbcmd.h" > +#include "command.h" > +#include "completer.h" > +#include "stack.h" > +#include "arch-utils.h" > +#include "linespec.h" > +#include "objfiles.h" > + > +struct blacklist_entry > +{ > + =A0int number; > + > + =A0/* null if this isn't a blacklist entry for an entire file. > + =A0 =A0 The blacklist entry owns this pointer. */ > + =A0char *filename; > + > + =A0/* The name of the blacklisted function, if this is a blacklist entr= y for a > + =A0 =A0 function. =A0Note that this might be non-null even if the pc is= 0 if the > + =A0 =A0 entry is pending a shared library load. > + > + =A0 =A0 The blacklist entry owns this pointer. */ > + =A0char *function_name; > + > + =A0/* 0 if this is a blacklist entry for an entire file, or if this ent= ry will > + =A0 =A0 be on a function, pending a shared library load. */ > + =A0CORE_ADDR pc; > + > + =A0/* Architecture we used to create the blacklist entry. May be null > + =A0 =A0 if the entry is pending a shared library load. */ > + =A0struct gdbarch *gdbarch; > + > + =A0int enabled; > + =A0int pending; > + > + =A0struct blacklist_entry *next; > +}; > + > +static void blacklist_function_command (char *arg, int from_tty); > +static void blacklist_file_command (char *arg, int from_tty); > +static void blacklist_info (char *arg, int from_tty); > + > +static void add_blacklist_entry (struct blacklist_entry *b); > +static void blacklist_function_pc (CORE_ADDR pc, char *name, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0stru= ct gdbarch *arch, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0int = pending); > +static void try_resolve_pending_entry (struct blacklist_entry *b); > +static struct gdbarch *get_sal_arch (struct symtab_and_line *sal); > + > +static struct blacklist_entry *blacklist_entry_chain; > +static int blacklist_entry_count; > + > +#define ALL_BLACKLIST_ENTRIES(B) for (B =3D blacklist_entry_chain; B; B > =3D B->next) > + > +static void > +blacklist_file_command (char *arg, int from_tty) > +{ > + =A0struct blacklist_entry *b; > + =A0struct symtab *symtab; > + =A0int pending =3D 0; > + =A0char *filename =3D 0; > + > + =A0/* If no argument was given, try to default to the last > + =A0 =A0 displayed codepoint. */ > + =A0if (arg =3D=3D 0) > + =A0 =A0{ > + =A0 =A0 =A0symtab =3D get_last_displayed_symtab (); > + =A0 =A0 =A0if (symtab =3D=3D 0) > + =A0 =A0 =A0 error (_("No default blacklist file now.")); > + =A0 =A0 =A0else > + =A0 =A0 =A0 filename =3D symtab->filename; > + =A0 =A0} > + =A0else > + =A0 =A0{ > + =A0 =A0 =A0symtab =3D lookup_symtab (arg); > + =A0 =A0 =A0if (symtab =3D=3D 0) > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 fprintf_filtered (gdb_stderr, _("No source file named %= s.\n"), arg); > + =A0 =A0 =A0 =A0 if (!nquery (_("\ > +Add file to blacklist pending future shared library load? "))) > + =A0 =A0 =A0 =A0 =A0 return; > + > + =A0 =A0 =A0 =A0 pending =3D 1; > + =A0 =A0 =A0 =A0 filename =3D arg; > + =A0 =A0 =A0 } > + =A0 =A0 =A0else > + =A0 =A0 =A0 filename =3D symtab->filename; > + =A0 =A0} > + > + =A0b =3D XZALLOC (struct blacklist_entry); > + =A0b->filename =3D strdup(filename); > + =A0b->enabled =3D 1; > + =A0b->pending =3D pending; > + =A0if (symtab !=3D 0) > + =A0 =A0b->gdbarch =3D get_objfile_arch (symtab->objfile); > + > + =A0add_blacklist_entry (b); > + > + =A0printf_filtered ("Blacklisting file %s.\n", filename); > +} > + > +static void > +blacklist_function_command (char *arg, int from_tty) > +{ > + =A0CORE_ADDR func_pc; > + =A0char *name =3D NULL; > + > + =A0/* Default to the current function if no argument is given. */ > + =A0if (arg =3D=3D 0) > + =A0 =A0{ > + =A0 =A0 =A0CORE_ADDR pc; > + =A0 =A0 =A0if (!last_displayed_codepoint_is_valid ()) > + =A0 =A0 =A0 error (_("No default blacklist function now.")); > + > + =A0 =A0 =A0pc =3D get_last_displayed_addr (); > + =A0 =A0 =A0if (!find_pc_partial_function (pc, &name, &func_pc, 0)) > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 error (_("No function found containing current program = point %s."), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 paddress (get_current_arch (), pc)); > + =A0 =A0 =A0 } > + =A0 =A0 =A0blacklist_function_pc (func_pc, name, get_current_arch (), 0= ); > + =A0 =A0} > + =A0else > + =A0 =A0{ > + =A0 =A0 =A0/* Decode arg. =A0We set funfirstline=3D1 so decode_line_1 w= ill give us the > + =A0 =A0 =A0 =A0first line of the function specified, if it can, and so = that we'll > + =A0 =A0 =A0 =A0reject variable names and the like. */ > + > + =A0 =A0 =A0/* TODO maybe want something like parse_breakpoint_sals () > + =A0 =A0 =A0 =A0 in breakpoint.c. */ > + =A0 =A0 =A0int i; > + =A0 =A0 =A0int not_found =3D 0; > + =A0 =A0 =A0int pending =3D 0; > + =A0 =A0 =A0char *orig_arg =3D arg; /* decode_line_1 modifies the arg po= inter. */ > + =A0 =A0 =A0struct symtabs_and_lines sals =3D decode_line_1 (&arg, 1, 0,= 0, 0, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0¬_found); > + > + =A0 =A0 =A0if (not_found) > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 fprintf_filtered (gdb_stderr, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 _("No function foun= d named %s.\n"), orig_arg); > + > + =A0 =A0 =A0 =A0 if (nquery (_("\ > +Add function to blacklist pending future shared library load? "))) > + =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 /* Add the pending blacklist entry. */ > + =A0 =A0 =A0 =A0 =A0 =A0 blacklist_function_pc (0, orig_arg, 0, 1); > + =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 return; > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0if (sals.nelts =3D=3D 0) > + =A0 =A0 =A0 error (_("No function to blacklist.")); /* TODO can I trigg= er this? */ > + =A0 =A0 =A0if (sals.nelts > 1) > + =A0 =A0 =A0 error (_("Specify just one function at a time.")); /* TODO = can I > trigger this? */ > + =A0 =A0 =A0if (strlen (arg) !=3D 0) > + =A0 =A0 =A0 error (_("Junk at end of arguments.")); > + > + =A0 =A0 =A0/* The pc decode_line_1 gives us is the first line of the fu= nction, > + =A0 =A0 =A0 =A0but we actually want the line before that. =A0The call to > + =A0 =A0 =A0 =A0find_pc_partial_function gets us the value we actually w= ant. */ > + =A0 =A0 =A0{ > + =A0 =A0 =A0 struct symtab_and_line *sal =3D &sals.sals[0]; > + =A0 =A0 =A0 CORE_ADDR pc =3D sal->pc; > + =A0 =A0 =A0 CORE_ADDR func_start =3D 0; > + =A0 =A0 =A0 struct gdbarch *arch =3D get_sal_arch (sal); > + > + =A0 =A0 =A0 if (!find_pc_partial_function (pc, &name, &func_start, 0)) > + =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 error (_("No function found containing program poin= t %s."), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0paddress (arch, pc)); > + =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 blacklist_function_pc (func_start, name, arch, 0); > + =A0 =A0 =A0} > + =A0 =A0} > +} > + > +static void > +blacklist_info (char *arg, int from_tty) > +{ > + =A0struct blacklist_entry *b; > + =A0int num_printable_entries =3D 0; > + =A0int entry_num =3D -1; > + =A0int address_width =3D 10; > + =A0struct value_print_options opts; > + =A0struct cleanup *tbl_chain; > + > + =A0get_user_print_options (&opts); > + > + =A0if (arg !=3D 0) > + =A0 =A0{ > + =A0 =A0 =A0entry_num =3D parse_and_eval_long (arg); > + =A0 =A0} > + > + =A0/* Count the number of rows in the table and see if we need space fo= r a > + =A0 =A0 64-bit address anywhere. */ > + =A0ALL_BLACKLIST_ENTRIES (b) > + =A0 =A0if (entry_num =3D=3D -1 || b->number =3D=3D entry_num) > + =A0 =A0 =A0{ > + =A0 =A0 =A0 num_printable_entries++; > + =A0 =A0 =A0 if (b->gdbarch && gdbarch_addr_bit (b->gdbarch) > 32) > + =A0 =A0 =A0 =A0 address_width =3D 18; > + =A0 =A0 =A0} > + > + =A0if (num_printable_entries =3D=3D 0) > + =A0 =A0{ > + =A0 =A0 =A0if (entry_num =3D=3D -1) > + =A0 =A0 =A0 ui_out_message (uiout, 0, "Blacklist is empty.\n"); > + =A0 =A0 =A0else > + =A0 =A0 =A0 ui_out_message (uiout, 0, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "No blacklist entry numbere= d %d.\n", entry_num); > + > + =A0 =A0 =A0return; > + =A0 =A0} > + > + =A0if (opts.addressprint) > + =A0 =A0tbl_chain > + =A0 =A0 =A0 =3D make_cleanup_ui_out_table_begin_end (uiout, 5, num_prin= table_entries, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 "BlacklistTable"); > + =A0else > + =A0 =A0tbl_chain > + =A0 =A0 =A0 =3D make_cleanup_ui_out_table_begin_end (uiout, 4, num_prin= table_entries, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 "BlacklistTable"); > + > + =A0ui_out_table_header (uiout, 7, ui_left, "number", "Num"); > =A0 /* 1 */ > + =A0ui_out_table_header (uiout, 14, ui_left, "type", "Type"); > =A0 /* 2 */ > + =A0ui_out_table_header (uiout, 3, ui_left, "enabled", "Enb"); > =A0 /* 3 */ > + =A0if (opts.addressprint) > + =A0 =A0{ > + =A0 =A0 =A0ui_out_table_header (uiout, address_width, ui_left, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"addr", "Address"); = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* 4 */ > + =A0 =A0} > + =A0ui_out_table_header (uiout, 40, ui_noalign, "what", "What"); > =A0 /* 5 */ > + =A0ui_out_table_body (uiout); > + > + =A0ALL_BLACKLIST_ENTRIES (b) > + =A0 =A0{ > + =A0 =A0 =A0struct cleanup *entry_chain; > + > + =A0 =A0 =A0QUIT; > + =A0 =A0 =A0if (entry_num !=3D -1 && entry_num !=3D b->number) > + =A0 =A0 =A0 continue; > + > + =A0 =A0 =A0entry_chain =3D make_cleanup_ui_out_tuple_begin_end (uiout, > "blklst-entry"); > + =A0 =A0 =A0ui_out_field_int (uiout, "number", b->number); > =A0 /* 1 */ > + > + =A0 =A0 =A0if (b->function_name !=3D 0) > + =A0 =A0 =A0 ui_out_field_string (uiout, "type", "function"); =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 /* 2 */ > + =A0 =A0 =A0else if (b->filename !=3D 0) > + =A0 =A0 =A0 ui_out_field_string (uiout, "type", "file"); =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* 2 */ > + =A0 =A0 =A0else > + =A0 =A0 =A0 internal_error (__FILE__, __LINE__, _("\ > +Blacklist entry should have either a filename or a function name.")); > + > + =A0 =A0 =A0if (b->enabled) > + =A0 =A0 =A0 ui_out_field_string (uiout, "enabled", "y"); =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* 3 */ > + =A0 =A0 =A0else > + =A0 =A0 =A0 ui_out_field_string (uiout, "enabled", "n"); =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* 3 */ > + > + =A0 =A0 =A0if (opts.addressprint) > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 if (b->pc !=3D 0) > + =A0 =A0 =A0 =A0 =A0 ui_out_field_core_addr (uiout, "addr", b->gdbarch, = b->pc); =A0 /* 4 */ > + =A0 =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 =A0 ui_out_field_string (uiout, "addr", "n/a"); =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0/* 4 */ > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0if (!b->pending && b->function_name !=3D 0) > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0struct symbol *sym; > + =A0 =A0 =A0 =A0 =A0gdb_assert (b->pc !=3D 0); > + =A0 =A0 =A0 =A0 =A0sym =3D find_pc_function (b->pc); > + =A0 =A0 =A0 =A0 =A0if (sym) > + =A0 =A0 =A0 =A0 =A0 =A0ui_out_field_fmt (uiout, "what", "%s at %s:%d", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0sym->ginfo.n= ame, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0sym->symtab-= >filename, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0sym->line); > + =A0 =A0 =A0 =A0 =A0else > + =A0 =A0 =A0 =A0 =A0 =A0ui_out_field_string (uiout, "what", "?"); > + =A0 =A0 =A0 } > + =A0 =A0 =A0else if (b->pending && b->function_name !=3D 0) > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 ui_out_field_fmt (uiout, "what", "%s (PENDING)", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 b->function_name); > + =A0 =A0 =A0 } > + =A0 =A0 =A0else if (!b->pending && b->filename !=3D 0) > + =A0 =A0 =A0 ui_out_field_string (uiout, "what", b->filename); > + =A0 =A0 =A0else if (b->pending && b->filename !=3D 0) > + =A0 =A0 =A0 ui_out_field_fmt (uiout, "what", "%s (PENDING)", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 b->filename); > + > + =A0 =A0 =A0ui_out_text (uiout, "\n"); > + =A0 =A0 =A0do_cleanups (entry_chain); > + =A0 =A0} > + > + =A0do_cleanups (tbl_chain); > +} > + > +static void > +blacklist_enable_command (char *arg, int from_tty) > +{ > + =A0struct blacklist_entry *b; > + =A0int entry_num =3D parse_and_eval_long (arg); > + =A0ALL_BLACKLIST_ENTRIES (b) > + =A0 =A0if (b->number =3D=3D entry_num) > + =A0 =A0 =A0{ > + =A0 =A0 =A0 b->enabled =3D 1; > + =A0 =A0 =A0 return; > + =A0 =A0 =A0} > + > + =A0error (_("No blacklist entry numbered %d."), entry_num); > +} > + > +static void > +blacklist_disable_command (char *arg, int from_tty) > +{ > + =A0struct blacklist_entry *b; > + =A0int entry_num =3D parse_and_eval_long (arg); > + =A0ALL_BLACKLIST_ENTRIES (b) > + =A0 =A0if (b->number =3D=3D entry_num) > + =A0 =A0 =A0{ > + =A0 =A0 =A0 b->enabled =3D 0; > + =A0 =A0 =A0 return; > + =A0 =A0 =A0} > + > + =A0error (_("No blacklist entry numbered %d."), entry_num); > +} > + > +static void > +blacklist_delete_command (char *arg, int from_tty) > +{ > + =A0struct blacklist_entry *b, *b_prev; > + =A0int entry_num =3D parse_and_eval_long (arg); > + > + =A0/* We don't need to use a SAFE macro here since we return as soon as= we > + =A0 =A0 remove an element from the list. */ > + =A0b_prev =3D 0; > + =A0ALL_BLACKLIST_ENTRIES (b) > + =A0 =A0if (b->number =3D=3D entry_num) > + =A0 =A0 =A0{ > + =A0 =A0 =A0 if (b_prev !=3D 0) > + =A0 =A0 =A0 =A0 b_prev->next =3D b->next; > + =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 blacklist_entry_chain =3D b->next; > + > + =A0 =A0 =A0 xfree (b->function_name); > + =A0 =A0 =A0 xfree (b->filename); > + =A0 =A0 =A0 xfree (b); > + =A0 =A0 =A0 return; > + =A0 =A0 =A0} > + =A0 =A0else > + =A0 =A0 =A0{ > + =A0 =A0 =A0 b_prev =3D b; > + =A0 =A0 =A0} > + > + =A0error (_("No blacklist entry numbered %d."), entry_num); > +} > + > +static void > +blacklist_function_pc (CORE_ADDR pc, char *name, struct gdbarch *arch, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0int pending) > +{ > + =A0struct blacklist_entry *b =3D XZALLOC (struct blacklist_entry); > + =A0b->pc =3D pc; > + =A0b->gdbarch =3D arch; > + =A0b->enabled =3D 1; > + =A0b->pending =3D pending; > + =A0b->function_name =3D strdup (name); > + > + =A0add_blacklist_entry (b); > + > + =A0if (!pending) > + =A0 =A0printf_filtered ("Blacklisting function %s at %s.\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0name, paddress (get_current_arch= (), pc)); > + =A0else > + =A0 =A0printf_filtered ("Blacklisting function %s pending shared librar= y load.\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0name); > +} > + > +static void > +add_blacklist_entry (struct blacklist_entry *b) > +{ > + =A0struct blacklist_entry *b1; > + > + =A0b->number =3D ++blacklist_entry_count; > + > + =A0/* Add to the end of the chain so that the list of > + =A0 =A0 blacklist entries will be in numerical order. */ > + > + =A0b1 =3D blacklist_entry_chain; > + =A0if (b1 =3D=3D 0) > + =A0 =A0blacklist_entry_chain =3D b; > + =A0else > + =A0 =A0{ > + =A0 =A0 =A0while (b1->next) > + =A0 =A0 =A0 b1 =3D b1->next; > + =A0 =A0 =A0b1->next =3D b; > + =A0 =A0} > +} > + > +int > +function_pc_is_blacklisted (CORE_ADDR pc) > +{ > + =A0struct symtab_and_line sal; > + =A0char *filename; > + =A0struct blacklist_entry *b; > + > + =A0sal =3D find_pc_line (pc, 0); > + =A0filename =3D sal.symtab->filename; > + > + =A0ALL_BLACKLIST_ENTRIES (b) > + =A0 =A0{ > + =A0 =A0 =A0/* First, check whether the file or function this entry is p= ending on has > + =A0 =A0 =A0 =A0been loaded. =A0It might be more sensible to do this on = a solib load, > + =A0 =A0 =A0 =A0but that doesn't seem to work for some reason. */ > + =A0 =A0 =A0if (b->pending) > + =A0 =A0 =A0 try_resolve_pending_entry (b); > + > + =A0 =A0 =A0if (b->enabled && !b->pending > + =A0 =A0 =A0 =A0 && ((b->pc !=3D 0 && pc =3D=3D b->pc) > + =A0 =A0 =A0 =A0 =A0 =A0 || (b->filename !=3D 0 && filename !=3D 0 > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 && strcmp (filename, b->filename) =3D= =3D 0))) > + =A0 =A0 =A0 return 1; > + =A0 =A0} > + > + =A0return 0; > +} > + > +/* Try to look up the file or function corresponding to the given blackl= ist > + =A0 entry. =A0If the file or function now exists, update the entry and = unmark it > + =A0 as pending. */ > +static void > +try_resolve_pending_entry (struct blacklist_entry *b) > +{ > + =A0if (!b->pending) > + =A0 =A0return; > + > + =A0if (b->filename !=3D 0) > + =A0 =A0{ > + =A0 =A0 =A0struct symtab *symtab =3D lookup_symtab (b->filename); > + =A0 =A0 =A0if (symtab !=3D 0) > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 xfree (b->filename); > + =A0 =A0 =A0 =A0 b->filename =3D strdup (symtab->filename); > + =A0 =A0 =A0 =A0 b->gdbarch =3D get_objfile_arch (symtab->objfile); > + =A0 =A0 =A0 =A0 b->pending =3D 0; > + =A0 =A0 =A0 } > + =A0 =A0} > + =A0else if (b->function_name !=3D 0) > + =A0 =A0{ > + =A0 =A0 =A0int not_found =3D 0; > + =A0 =A0 =A0char *func_name =3D b->function_name; > + =A0 =A0 =A0struct symtabs_and_lines sals =3D decode_line_1 (&func_name,= 1, 0, 0, 0, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0¬_found); > + > + =A0 =A0 =A0if (!not_found && sals.nelts =3D=3D 1 && strlen (func_name) = =3D=3D 0) > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 struct symtab_and_line *sal =3D &sals.sals[0]; > + =A0 =A0 =A0 =A0 CORE_ADDR pc =3D sal->pc; > + =A0 =A0 =A0 =A0 CORE_ADDR func_start =3D 0; > + =A0 =A0 =A0 =A0 struct gdbarch *arch =3D get_sal_arch (sal); > + > + =A0 =A0 =A0 =A0 if (find_pc_partial_function (pc, &b->function_name, &f= unc_start, 0)) > + =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 b->pending =3D 0; > + =A0 =A0 =A0 =A0 =A0 =A0 b->pc =3D func_start; > + =A0 =A0 =A0 =A0 =A0 =A0 b->gdbarch =3D arch; > + =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + =A0 =A0} > +} > + > +static struct gdbarch* > +get_sal_arch (struct symtab_and_line *sal) > +{ > + =A0if (sal->section) > + =A0 =A0return get_objfile_arch (sal->section->objfile); > + =A0if (sal->symtab) > + =A0 =A0return get_objfile_arch (sal->symtab->objfile); > + =A0return get_current_arch (); > +} > + > +void > +_initialize_step_blacklist (void) > +{ > + =A0struct cmd_list_element *c; > + > + =A0blacklist_entry_chain =3D 0; > + =A0blacklist_entry_count =3D 0; > + > + =A0add_prefix_cmd ("blacklist", class_blacklist, > blacklist_function_command, _("\ > +Ignore a function while stepping.\n\ > +blacklist [FUNCTION NAME]\n\ > +If no function name is given, blacklist the current function."), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&blacklistlist, "blacklist ", 1, &cm= dlist); > + > + =A0c =3D add_cmd ("file", class_blacklist, blacklist_file_command, _("\ > +Ignore a file while stepping.\n\ > +blacklist file [FILENAME]\n\ > +If no filename is given, blacklist the current file."), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0&blacklistlist); > + =A0set_cmd_completer (c, filename_completer); > + > + =A0c =3D add_cmd ("function", class_blacklist, blacklist_function_comma= nd, _("\ > +Ignore a function while stepping.\n\ > +blacklist function [FUNCTION NAME]\n\ > +If no function name is given, blacklist the current function."), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0&blacklistlist); > + =A0set_cmd_completer (c, location_completer); > + > + =A0add_cmd ("enable", class_blacklist, blacklist_enable_command, _("\ > +Enable a blacklist entry.\n\ > +blacklist enable [NUMBER]"), > + =A0 =A0 =A0 =A0 =A0&blacklistlist); > + > + =A0add_cmd ("disable", class_blacklist, blacklist_disable_command, _("\ > +Disable a blacklist entry.\n\ > +blacklist disable [NUMBER]"), > + =A0 =A0 =A0 =A0 =A0&blacklistlist); > + > + =A0add_cmd ("delete", class_blacklist, blacklist_delete_command, _("\ > +Delete a blacklist entry.\n\ > +blacklist delete [NUMBER]"), > + =A0 =A0 =A0 =A0 =A0 &blacklistlist); > + > + =A0add_info ("blacklist", blacklist_info, _("\ > +Status of blacklist, or of blacklist entry NUMBER.\n\ > +The \"Type\" column indicates one of:\n\ > +\tfile =A0 =A0 =A0 =A0- blacklisted file\n\ > +\tfunction =A0 =A0- blacklisted function")); > +} > diff --git a/gdb/blacklist.h b/gdb/blacklist.h > new file mode 100644 > index 0000000..94d1d93 > --- /dev/null > +++ b/gdb/blacklist.h > @@ -0,0 +1,21 @@ > +/* Header for GDB line completion. > + =A0 Copyright (C) 2010 Free Software Foundation, Inc. > + > + =A0 This program is free software; you can redistribute it and/or modify > + =A0 it under the terms of the GNU General Public License as published by > + =A0 the Free Software Foundation; either version 3 of the License, or > + =A0 (at your option) any later version. > + > + =A0 This program is distributed in the hope that it will be useful, > + =A0 but WITHOUT ANY WARRANTY; without even the implied warranty of > + =A0 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =A0See the > + =A0 GNU General Public License for more details. > + > + =A0 You should have received a copy of the GNU General Public License > + =A0 along with this program. =A0If not, see . =A0*/ > + > +/* Returns 1 if the given pc was blacklisted and shouldn't be stepped in= to. > + =A0 Otherwise, returns 0. */ > + > +int > +function_pc_is_blacklisted (CORE_ADDR pc); > diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c > index 3dca17e..8f60bd4 100644 > --- a/gdb/breakpoint.c > +++ b/gdb/breakpoint.c > @@ -61,6 +61,7 @@ > =A0#include "valprint.h" > =A0#include "jit.h" > =A0#include "xml-syscall.h" > +#include "stack.h" > > =A0/* readline include files */ > =A0#include "readline/readline.h" > @@ -527,19 +528,6 @@ make_cleanup_decref_counted_command_line (struct > counted_command_line **cmdp) > =A0 return make_cleanup (do_cleanup_counted_command_line, cmdp); > =A0} > > -/* Default address, symtab and line to put a breakpoint at > - =A0 for "break" command with no arg. > - =A0 if default_breakpoint_valid is zero, the other three are > - =A0 not valid, and "break" with no arg is an error. > - > - =A0 This set by print_stack_frame, which calls set_default_breakpoint. = =A0*/ > - > -int default_breakpoint_valid; > -CORE_ADDR default_breakpoint_address; > -struct symtab *default_breakpoint_symtab; > -int default_breakpoint_line; > -struct program_space *default_breakpoint_pspace; > - > > =A0/* *PP is a string denoting a breakpoint. =A0Get the number of the bre= akpoint. > =A0 =A0Advance *PP after the string and any trailing whitespace. > @@ -5174,20 +5162,6 @@ describe_other_breakpoints (struct gdbarch *gdbarc= h, > =A0 =A0 } > =A0} > > -/* Set the default place to put a breakpoint > - =A0 for the `break' command with no arguments. =A0*/ > - > -void > -set_default_breakpoint (int valid, struct program_space *pspace, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 CORE_ADDR addr, struct symt= ab *symtab, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int line) > -{ > - =A0default_breakpoint_valid =3D valid; > - =A0default_breakpoint_pspace =3D pspace; > - =A0default_breakpoint_address =3D addr; > - =A0default_breakpoint_symtab =3D symtab; > - =A0default_breakpoint_line =3D line; > -} > > =A0/* Return true iff it is meaningful to use the address member of > =A0 =A0BPT. =A0For some breakpoint types, the address member is irrelevant > @@ -7120,20 +7094,23 @@ parse_breakpoint_sals (char **address, > =A0 if ((*address) =3D=3D NULL > =A0 =A0 =A0 || (strncmp ((*address), "if", 2) =3D=3D 0 && isspace ((*addr= ess)[2]))) > =A0 =A0 { > - =A0 =A0 =A0if (default_breakpoint_valid) > + =A0 =A0 =A0/* The last displayed codepoint, if it's valid, is our defau= lt breakpoint > + =A0 =A0 =A0 =A0 address. */ > + =A0 =A0 =A0if (last_displayed_codepoint_is_valid ()) > =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0 =A0struct symtab_and_line sal; > =A0 =A0 =A0 =A0 =A0init_sal (&sal); =A0 =A0 =A0 =A0 =A0 =A0 =A0/* initial= ize to zeroes */ > =A0 =A0 =A0 =A0 =A0sals->sals =3D (struct symtab_and_line *) > =A0 =A0 =A0 =A0 =A0 =A0xmalloc (sizeof (struct symtab_and_line)); > - =A0 =A0 =A0 =A0 sal.pc =3D default_breakpoint_address; > - =A0 =A0 =A0 =A0 sal.line =3D default_breakpoint_line; > - =A0 =A0 =A0 =A0 sal.symtab =3D default_breakpoint_symtab; > - =A0 =A0 =A0 =A0 sal.pspace =3D default_breakpoint_pspace; > + > + =A0 =A0 =A0 =A0 /* Set sal's pspace, pc, symtab, and line to the values= corresponding > + =A0 =A0 =A0 =A0 =A0 =A0to the last call to print_frame_info. */ > + =A0 =A0 =A0 =A0 set_sal_to_last_displayed_codepoint (&sal); > + > =A0 =A0 =A0 =A0 =A0sal.section =3D find_pc_overlay (sal.pc); > > =A0 =A0 =A0 =A0 =A0/* "break" without arguments is equivalent to "break *= PC" where PC is > - =A0 =A0 =A0 =A0 =A0 =A0the default_breakpoint_address. =A0So make sure = to set > + =A0 =A0 =A0 =A0 =A0 =A0the last displayed codepoint's address. =A0So ma= ke sure to set > =A0 =A0 =A0 =A0 =A0 =A0 sal.explicit_pc to prevent GDB from trying to exp= and the list of > =A0 =A0 =A0 =A0 =A0 =A0 sals to include all other instances with the same= symtab and line. > =A0 =A0 =A0 =A0 =A0 */ > @@ -7150,19 +7127,22 @@ parse_breakpoint_sals (char **address, > =A0 =A0 =A0 /* Force almost all breakpoints to be in terms of the > =A0 =A0 =A0 =A0 =A0current_source_symtab (which is decode_line_1's defaul= t). =A0This > =A0 =A0 =A0 =A0 =A0should produce the results we want almost all of the t= ime while > - =A0 =A0 =A0 =A0 leaving default_breakpoint_* alone. > + =A0 =A0 =A0 =A0 leaving the last displayed codepoint pointers alone. > =A0 =A0 =A0 =A0 =A0ObjC: However, don't match an Objective-C method name = which > =A0 =A0 =A0 =A0 =A0may have a '+' or '-' succeeded by a '[' */ > > =A0 =A0 =A0 struct symtab_and_line cursal =3D get_current_source_symtab_a= nd_line (); > > - =A0 =A0 =A0if (default_breakpoint_valid > + =A0 =A0 =A0if (last_displayed_codepoint_is_valid () > =A0 =A0 =A0 =A0 =A0&& (!cursal.symtab > =A0 =A0 =A0 =A0 =A0 =A0 =A0|| ((strchr ("+-", (*address)[0]) !=3D NULL) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&& ((*address)[1] !=3D '[')))) > - =A0 =A0 =A0 *sals =3D decode_line_1 (address, 1, default_breakpoint_sym= tab, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0default_brea= kpoint_line, addr_string, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0not_found_pt= r); > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 *sals =3D decode_line_1 (address, 1, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0get_last= _displayed_symtab (), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0get_last= _displayed_line (), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0addr_str= ing, not_found_ptr); > + =A0 =A0 =A0 } > =A0 =A0 =A0 else > =A0 =A0 =A0 =A0*sals =3D decode_line_1 (address, 1, (struct symtab *) NUL= L, 0, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 addr_string, = not_found_ptr); > @@ -7336,7 +7316,6 @@ create_breakpoint (struct gdbarch *gdbarch, > =A0 struct captured_parse_breakpoint_args parse_args; > =A0 int i; > =A0 int pending =3D 0; > - =A0int not_found =3D 0; > =A0 enum bptype type_wanted; > =A0 int task =3D 0; > =A0 int prev_bkpt_count =3D breakpoint_count; > @@ -7348,7 +7327,7 @@ create_breakpoint (struct gdbarch *gdbarch, > =A0 parse_args.arg_p =3D &arg; > =A0 parse_args.sals_p =3D &sals; > =A0 parse_args.addr_string_p =3D &addr_string; > - =A0parse_args.not_found_ptr =3D ¬_found; > + =A0parse_args.not_found_ptr =3D 0; > > =A0 e =3D catch_exception (uiout, do_captured_parse_breakpoint, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &parse_args, RETURN_MASK_ALL); > @@ -8083,9 +8062,11 @@ until_break_command (char *arg, int from_tty, > int anywhere) > =A0 /* Set a breakpoint where the user wants it and at return from > =A0 =A0 =A0this function */ > > - =A0if (default_breakpoint_valid) > - =A0 =A0sals =3D decode_line_1 (&arg, 1, default_breakpoint_symtab, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 default_breakpoint_line= , (char ***) NULL, NULL); > + =A0if (last_displayed_codepoint_is_valid ()) > + =A0 =A0sals =3D decode_line_1 (&arg, 1, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 get_last_displayed_symt= ab (), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 get_last_displayed_line= (), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (char ***) NULL, NULL); > =A0 else > =A0 =A0 sals =3D decode_line_1 (&arg, 1, (struct symtab *) NULL, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00, (char ***) NULL, NU= LL); > @@ -8673,10 +8654,11 @@ clear_command (char *arg, int from_tty) > =A0 =A0 =A0 =A0xmalloc (sizeof (struct symtab_and_line)); > =A0 =A0 =A0 make_cleanup (xfree, sals.sals); > =A0 =A0 =A0 init_sal (&sal); =A0 =A0 =A0 =A0 /* initialize to zeroes */ > - =A0 =A0 =A0sal.line =3D default_breakpoint_line; > - =A0 =A0 =A0sal.symtab =3D default_breakpoint_symtab; > - =A0 =A0 =A0sal.pc =3D default_breakpoint_address; > - =A0 =A0 =A0sal.pspace =3D default_breakpoint_pspace; > + > + =A0 =A0 =A0/* Set sal's line, symtab, pc, and pspace to the values corr= esponding to > + =A0 =A0 =A0 =A0the last call to print_frame_info. =A0If the codepoint i= s not valid, > + =A0 =A0 =A0 =A0this will set all the fields to 0. */ > + =A0 =A0 =A0set_sal_to_last_displayed_codepoint (&sal); > =A0 =A0 =A0 if (sal.symtab =3D=3D 0) > =A0 =A0 =A0 =A0error (_("No source file specified.")); > > @@ -10181,7 +10163,8 @@ invalidate_bp_value_on_memory_change > (CORE_ADDR addr, int len, > =A0 =A0 =A0 } > =A0} > > -/* Use default_breakpoint_'s, or nothing if they aren't valid. =A0*/ > +/* Use the last displayed codepoint's values, or nothing > + =A0 if they aren't valid. */ > > =A0struct symtabs_and_lines > =A0decode_line_spec_1 (char *string, int funfirstline) > @@ -10189,11 +10172,13 @@ decode_line_spec_1 (char *string, int funfirstl= ine) > =A0 struct symtabs_and_lines sals; > =A0 if (string =3D=3D 0) > =A0 =A0 error (_("Empty line specification.")); > - =A0if (default_breakpoint_valid) > - =A0 =A0sals =3D decode_line_1 (&string, funfirstline, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 default_breakpoint_symt= ab, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 default_breakpoint_line, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (char ***) NULL, NULL); > + =A0if (last_displayed_codepoint_is_valid ()) > + =A0 =A0{ > + =A0 =A0 =A0sals =3D decode_line_1 (&string, funfirstline, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 get_last_displayed_= symtab (), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 get_last_displayed_= line (), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (char ***) NULL, NU= LL); > + =A0 =A0} > =A0 else > =A0 =A0 sals =3D decode_line_1 (&string, funfirstline, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(struct symtab *) NULL= , 0, (char ***) NULL, NULL); > diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h > index 8b7a5c6..50602b2 100644 > --- a/gdb/breakpoint.h > +++ b/gdb/breakpoint.h > @@ -789,9 +789,6 @@ extern struct breakpoint > *clone_momentary_breakpoint (struct breakpoint *bpkt); > > =A0extern void set_ignore_count (int, int, int); > > -extern void set_default_breakpoint (int, struct program_space *, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 COR= E_ADDR, struct symtab *, int); > - > =A0extern void breakpoint_init_inferior (enum inf_context); > > =A0extern struct cleanup *make_cleanup_delete_breakpoint (struct breakpoi= nt *); > diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c > index fdeb8db..c401eed 100644 > --- a/gdb/cli/cli-cmds.c > +++ b/gdb/cli/cli-cmds.c > @@ -185,6 +185,8 @@ struct cmd_list_element *setchecklist; > > =A0struct cmd_list_element *showchecklist; > > +struct cmd_list_element *blacklistlist; > + > =A0/* Command tracing state. =A0*/ > > =A0int source_verbose =3D 0; > @@ -1308,6 +1310,7 @@ init_cmd_lists (void) > =A0 showprintlist =3D NULL; > =A0 setchecklist =3D NULL; > =A0 showchecklist =3D NULL; > + =A0blacklistlist =3D NULL; > =A0} > > =A0static void > @@ -1372,7 +1375,7 @@ init_cli_cmds (void) > =A0 char *source_help_text; > > =A0 /* Define the classes of commands. > - =A0 =A0 They will appear in the help list in the reverse of this order.= =A0*/ > + =A0 =A0 They will appear in the help list in alphabetical order. =A0*/ > > =A0 add_cmd ("internals", class_maintenance, NULL, _("\ > =A0Maintenance commands.\n\ > diff --git a/gdb/command.h b/gdb/command.h > index a746c82..27cdc33 100644 > --- a/gdb/command.h > +++ b/gdb/command.h > @@ -33,7 +33,7 @@ enum command_class > =A0 no_class =3D -1, class_run =3D 0, class_vars, class_stack, > =A0 class_files, class_support, class_info, class_breakpoint, class_trace, > =A0 class_alias, class_bookmark, class_obscure, class_maintenance, > - =A0class_pseudo, class_tui, class_user, class_xdb > + =A0class_pseudo, class_tui, class_user, class_xdb, class_blacklist > =A0}; > > =A0/* FIXME: cagney/2002-03-17: Once cmd_type() has been removed, ``enum > diff --git a/gdb/gdbcmd.h b/gdb/gdbcmd.h > index 6a230c0..d561e73 100644 > --- a/gdb/gdbcmd.h > +++ b/gdb/gdbcmd.h > @@ -124,6 +124,8 @@ extern struct cmd_list_element *setchecklist; > > =A0extern struct cmd_list_element *showchecklist; > > +extern struct cmd_list_element *blacklistlist; > + > =A0extern void execute_command (char *, int); > > =A0enum command_control_type execute_control_command (struct command_line= *); > diff --git a/gdb/infrun.c b/gdb/infrun.c > index 5f58759..7402fee 100644 > --- a/gdb/infrun.c > +++ b/gdb/infrun.c > @@ -52,6 +52,7 @@ > =A0#include "inline-frame.h" > =A0#include "jit.h" > =A0#include "tracepoint.h" > +#include "blacklist.h" > > =A0/* Prototypes for local functions */ > > @@ -4490,7 +4491,8 @@ infrun: not switching back to stepped thread, it > has vanished\n"); > =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 /* If we have line number information for the function we are > - =A0 =A0 =A0 =A0 thinking of stepping into, step into it. > + =A0 =A0 =A0 =A0 thinking of stepping into and the function isn't blackl= isted, > + =A0 =A0 =A0 =A0step into it. > > =A0 =A0 =A0 =A0 =A0If there are several symtabs at that PC (e.g. with inc= lude > =A0 =A0 =A0 =A0 =A0files), just want to know whether *any* of them have l= ine > @@ -4500,7 +4502,8 @@ infrun: not switching back to stepped thread, it > has vanished\n"); > > =A0 =A0 =A0 =A0tmp_sal =3D find_pc_line (ecs->stop_func_start, 0); > =A0 =A0 =A0 =A0tmp_sal.pspace =3D get_frame_program_space (frame); > - =A0 =A0 =A0 if (tmp_sal.line !=3D 0) > + =A0 =A0 =A0 if (tmp_sal.line !=3D 0 && > + =A0 =A0 =A0 =A0 =A0 !function_pc_is_blacklisted (ecs->stop_func_start)) > =A0 =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0 =A0 =A0if (execution_direction =3D=3D EXEC_REVERSE) > =A0 =A0 =A0 =A0 =A0 =A0 =A0handle_step_into_function_backward (gdbarch, e= cs); > diff --git a/gdb/linespec.c b/gdb/linespec.c > index c5ea28a..19727b5 100644 > --- a/gdb/linespec.c > +++ b/gdb/linespec.c > @@ -1857,7 +1857,13 @@ decode_variable (char *copy, int funfirstline, > char ***canonical, > =A0 =A0 return minsym_found (funfirstline, msymbol); > > =A0 if (not_found_ptr) > - =A0 =A0*not_found_ptr =3D 1; > + =A0 =A0{ > + =A0 =A0 =A0struct symtabs_and_lines sals; > + =A0 =A0 =A0*not_found_ptr =3D 1; > + =A0 =A0 =A0sals.sals =3D 0; > + =A0 =A0 =A0sals.nelts =3D 0; > + =A0 =A0 =A0return sals; > + =A0 =A0} > > =A0 if (!have_full_symbols () > =A0 =A0 =A0 && !have_partial_symbols () > diff --git a/gdb/stack.c b/gdb/stack.c > index 53d4aeb..14febd9 100644 > --- a/gdb/stack.c > +++ b/gdb/stack.c > @@ -73,6 +73,12 @@ static void print_frame (struct frame_info *frame, > int print_level, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 enum print_what print_wha= t, =A0int print_args, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct symtab_and_line sa= l); > > +static void set_last_displayed_codepoint (int valid, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 struct program_space *pspace, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 CORE_ADDR addr, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 struct symtab *symtab, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 int line); > + > =A0/* Zero means do things normally; we are interacting directly with the > =A0 =A0user. =A0One means print the full filename and linenumber when a > =A0 =A0frame is printed, and do so in a format emacs18/emacs19.22 can > @@ -80,6 +86,14 @@ static void print_frame (struct frame_info *frame, > int print_level, > =A0 =A0cases and in a slightly different syntax. =A0*/ > > =A0int annotation_level =3D 0; > + > +/* These variables hold the last codepoint we displayed to the user. =A0= This is > + =A0 where we insert a breakpoint or a blacklist entry by default. */ > +static int last_codepoint_valid =3D 0; > +static struct program_space *last_codepoint_pspace =3D 0; > +static CORE_ADDR last_codepoint_addr =3D 0; > +static struct symtab *last_codepoint_symtab =3D 0; > +static int last_codepoint_line =3D 0; > > > =A0struct print_stack_frame_args > @@ -650,14 +664,96 @@ print_frame_info (struct frame_info *frame, int > print_level, > =A0 =A0 } > > =A0 if (print_what !=3D LOCATION) > - =A0 =A0set_default_breakpoint (1, sal.pspace, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 get_frame_pc (frame= ), sal.symtab, sal.line); > + =A0 =A0set_last_displayed_codepoint (1, sal.pspace, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 get_fra= me_pc (frame), sal.symtab, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sal.lin= e); > > =A0 annotate_frame_end (); > > =A0 gdb_flush (gdb_stdout); > =A0} > > +/* Remember the last codepoint we displayed, which we use e.g. as the pl= ace to > + =A0 put a breakpoint when the `break' command is invoked with no argume= nts. */ > +static void > +set_last_displayed_codepoint (int valid, struct program_space *pspace, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 CORE_ADDR addr,= struct symtab *symtab, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int line) > +{ > + =A0last_codepoint_valid =3D valid; > + =A0last_codepoint_pspace =3D pspace; > + =A0last_codepoint_addr =3D addr; > + =A0last_codepoint_symtab =3D symtab; > + =A0last_codepoint_line =3D line; > +} > + > +void > +clear_last_displayed_codepoint () > +{ > + =A0last_codepoint_valid =3D 0; > + =A0last_codepoint_pspace =3D 0; > + =A0last_codepoint_addr =3D 0; > + =A0last_codepoint_symtab =3D 0; > + =A0last_codepoint_line =3D 0; > +} > + > +int > +last_displayed_codepoint_is_valid () > +{ > + =A0return last_codepoint_valid; > +} > + > +struct program_space* > +get_last_displayed_pspace () > +{ > + =A0if (last_codepoint_valid) > + =A0 =A0return last_codepoint_pspace; > + =A0return 0; > +} > + > +CORE_ADDR > +get_last_displayed_addr () > +{ > + =A0if (last_codepoint_valid) > + =A0 =A0return last_codepoint_addr; > + =A0return 0; > +} > + > +struct symtab* > +get_last_displayed_symtab () > +{ > + =A0if (last_codepoint_valid) > + =A0 =A0return last_codepoint_symtab; > + =A0return 0; > +} > + > +int > +get_last_displayed_line () > +{ > + =A0if (last_codepoint_valid) > + =A0 =A0return last_codepoint_line; > + =A0return 0; > +} > + > +void > +set_sal_to_last_displayed_codepoint (struct symtab_and_line *sal) > +{ > + =A0if (last_codepoint_valid) > + =A0 =A0{ > + =A0 =A0 =A0sal->pspace =3D last_codepoint_pspace; > + =A0 =A0 =A0sal->pc =3D last_codepoint_addr; > + =A0 =A0 =A0sal->symtab =3D last_codepoint_symtab; > + =A0 =A0 =A0sal->line =3D last_codepoint_line; > + =A0 =A0} > + =A0else > + =A0 =A0{ > + =A0 =A0 =A0sal->pspace =3D 0; > + =A0 =A0 =A0sal->pc =3D 0; > + =A0 =A0 =A0sal->symtab =3D 0; > + =A0 =A0 =A0sal->line =3D 0; > + =A0 =A0} > +} > + > =A0/* Attempt to obtain the FUNNAME and FUNLANG of the function correspon= ding > =A0 =A0to FRAME. =A0*/ > =A0void > diff --git a/gdb/stack.h b/gdb/stack.h > index 5e874b4..fa08035 100644 > --- a/gdb/stack.h > +++ b/gdb/stack.h > @@ -39,4 +39,14 @@ void iterate_over_block_local_vars (struct block *bloc= k, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0it= erate_over_block_arg_local_vars_cb cb, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vo= id *cb_data); > > +/* Get or set the last displayed codepoint, which is, e.g. where we set a > + =A0 breakpoint when `break' is supplied with no arguments. */ > +void clear_last_displayed_codepoint (); > +int last_displayed_codepoint_is_valid (); > +struct program_space* get_last_displayed_pspace (); > +CORE_ADDR get_last_displayed_addr (); > +struct symtab* get_last_displayed_symtab (); > +int get_last_displayed_line (); > +void set_sal_to_last_displayed_codepoint (struct symtab_and_line *sal); > + > =A0#endif /* #ifndef STACK_H */ > diff --git a/gdb/symfile.c b/gdb/symfile.c > index eda26cc..b56badf 100644 > --- a/gdb/symfile.c > +++ b/gdb/symfile.c > @@ -56,6 +56,7 @@ > =A0#include "elf-bfd.h" > =A0#include "solib.h" > =A0#include "remote.h" > +#include "stack.h" > > =A0#include > =A0#include > @@ -2709,7 +2710,7 @@ clear_symtab_users (void) > > =A0 clear_displays (); > =A0 breakpoint_re_set (); > - =A0set_default_breakpoint (0, NULL, 0, 0, 0); > + =A0clear_last_displayed_codepoint (); > =A0 clear_pc_function_cache (); > =A0 observer_notify_new_objfile (NULL); > > diff --git a/gdb/testsuite/gdb.base/Makefile.in > b/gdb/testsuite/gdb.base/Makefile.in > index 5e8e385..bd54184 100644 > --- a/gdb/testsuite/gdb.base/Makefile.in > +++ b/gdb/testsuite/gdb.base/Makefile.in > @@ -1,7 +1,7 @@ > =A0VPATH =3D @srcdir@ > =A0srcdir =3D @srcdir@ > > -EXECUTABLES =3D all-types annota1 bitfields break \ > +EXECUTABLES =3D all-types annota1 bitfields blacklist blacklist-solib br= eak \ > =A0 =A0 =A0 =A0call-ar-st call-rt-st call-strs callfuncs callfwmall \ > =A0 =A0 =A0 =A0chng-syms commands compiler condbreak constvars coremaker \ > =A0 =A0 =A0 =A0dbx-test display ending-run execd-prog exprs \ > diff --git a/gdb/testsuite/gdb.base/blacklist-solib-lib.c > b/gdb/testsuite/gdb.base/blacklist-solib-lib.c > new file mode 100644 > index 0000000..792cd01 > --- /dev/null > +++ b/gdb/testsuite/gdb.base/blacklist-solib-lib.c > @@ -0,0 +1,11 @@ > +/* Simple shared library */ > + > +int square(int num) > +{ > + =A0return multiply(num, num); > +} > + > +int multiply(int a, int b) > +{ > + =A0return a * b; > +} > diff --git a/gdb/testsuite/gdb.base/blacklist-solib-main.c > b/gdb/testsuite/gdb.base/blacklist-solib-main.c > new file mode 100644 > index 0000000..746bb5f > --- /dev/null > +++ b/gdb/testsuite/gdb.base/blacklist-solib-main.c > @@ -0,0 +1,6 @@ > +int square(int num); > + > +int main() > +{ > + =A0return square(0); > +} > diff --git a/gdb/testsuite/gdb.base/blacklist-solib.exp > b/gdb/testsuite/gdb.base/blacklist-solib.exp > new file mode 100644 > index 0000000..b713394 > --- /dev/null > +++ b/gdb/testsuite/gdb.base/blacklist-solib.exp > @@ -0,0 +1,129 @@ > +# =A0 Copyright 2010 Free Software Foundation, Inc. > + > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =A0See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. =A0If not, see . > + > +# This file was written by Justin Lebar. (justin.lebar@gmail.com) > + > +# > +# Tests blacklisting shared libraries. > +# > + > +# This only works on GNU/Linux. > +if { ![isnative] || [is_remote host] || ![istarget *-linux*] || > [skip_shlib_tests]} { > + =A0 =A0continue > +} > + > +set test "blacklist-solib" > +set srcfile_main "${test}-main.c" > +set binfile_main "${objdir}/${subdir}/${test}-test" > +set srcfile_lib "${test}-lib.c" > +set libname "lib${test}" > +set binfile_lib ${objdir}/${subdir}/${libname}.so > + > +# > +# Compile our program under test. =A0The main program references a share= d library > +# libblacklist-solib.so, which contains two functions, square(), which is > +# referenced by the main program, and multiply(), which is not reference= d by > +# the main program. > +# > + > +if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} > ${binfile_lib} [list debug > additional_flags=3D-Wl,-soname,${libname}.so]] !=3D ""} { > + =A0 =A0return -1 > +} > + > +if {[gdb_compile "${srcdir}/${subdir}/${srcfile_main}" > "${binfile_main}.o" object debug] !=3D ""} { > + =A0 =A0return -1 > +} > + > +if {[gdb_compile "${binfile_main}.o" "${binfile_main}" executable \ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 [list debug "additional_flags=3D-L${obj= dir}/${subdir} > -l${test} \ > + > -Wl,-rpath=3D${objdir}/${subdir}"]] !=3D ""} { > + =A0 =A0return -1 > +} > + > +gdb_start > +gdb_load ${binfile_main} > + > +# > +# At this point, if we try to blacklist the file ${srcfile_lib} or the f= unction > +# multiply(), we should get a prompt asking us if we want to enable the > +# blacklist entry pending a shared library load. > +# > + > +gdb_test "blacklist file ${srcfile_lib}" \ > +"Blacklisting file ${srcfile_lib}." \ > +"blacklisting file in solib" \ > +"No source file named ${srcfile_lib}.* > +Add file to blacklist pending future shared library load.*"\ > +"y" > + > +# > +# Does info blacklist list this entry as pending? > +# > +gdb_test "info blacklist" \ > +"Num\\s+Type\\s+Enb\\s+Address\\s+What\\s* > +1\\s+file\\s+y\\s+n/a\\s+${srcfile_lib} \\(PENDING\\)\\s*" \ > +"info blacklist with pending file" > + > +if ![runto_main] { fail "blacklist tests suppressed" } > + > +# > +# We shouldn't step into square(), since we blacklisted blacklist-solib-= lib.c. > +# > +gdb_test "step" "" > +gdb_test "bt" "#0\\s+main.*" "step after blacklisting solib file." > + > +# > +# Our entry should no longer be pending. =A0Note that we unfortunately n= eed to do > +# at least one step before the entry will be unmarked as pending. > +# > +gdb_test "info blacklist" \ > +"Num\\s+Type\\s+Enb\\s+Address\\s+What\\s* > +1\\s+file\\s+y\\s+n/a\\s+.*${srcfile_lib}\\s*" \ > +"info blacklist with pending file" > + > +# > +# Now restart gdb and testing blacklisting of a function inside a solib. > +# > +gdb_exit > +gdb_start > +gdb_load ${binfile_main} > + > +gdb_test "blacklist function multiply" \ > +"Blacklisting function multiply pending shared library load." \ > +"blacklisting function in solib" \ > +"No function found named multiply..* > +Add function to blacklist pending future shared library load.*"\ > +"y" > + > +if ![runto_main] { fail "blacklist tests suppressed" } > + > +# > +# Our first step should take us into square. > +# > +gdb_test "step" "square.*" > + > +# > +# Now our entry should no longer be pending. > +# > +gdb_test "info blacklist" \ > +"Num\\s+Type\\s+Enb\\s+Address\\s+What\\s* > +1\\s+function\\s+y\\s+0x\[0-9a-f\]+\\s+multiply at .*${srcfile_lib}:.*\\= s*" \ > + > +# > +# This step shouldn't go into multiply -- we should skip it and go on to= the > +# last line of square. > +# > +gdb_test "step" "" > +gdb_test "bt" "#0\\s+square.*" > diff --git a/gdb/testsuite/gdb.base/blacklist.c > b/gdb/testsuite/gdb.base/blacklist.c > new file mode 100644 > index 0000000..565ba93 > --- /dev/null > +++ b/gdb/testsuite/gdb.base/blacklist.c > @@ -0,0 +1,13 @@ > +int foo(); > +int bar(); > +int baz(int, int); > + > +int main() > +{ > + =A0return baz(foo(), bar()); > +} > + > +int foo() > +{ > + =A0return 0; > +} > diff --git a/gdb/testsuite/gdb.base/blacklist.exp > b/gdb/testsuite/gdb.base/blacklist.exp > new file mode 100644 > index 0000000..ed1afb8 > --- /dev/null > +++ b/gdb/testsuite/gdb.base/blacklist.exp > @@ -0,0 +1,140 @@ > +# =A0 Copyright 2010 Free Software Foundation, Inc. > + > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =A0See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. =A0If not, see . > + > +# This file was written by Justin Lebar. (justin.lebar@gmail.com) > + > +if { [prepare_for_testing blacklist.exp "blacklist" \ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{blacklist.c blackli= st1.c } \ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{debug nowarnings}] = } { > + =A0 =A0return -1 > +} > + > +set srcfile blacklist.c > +set srcfile1 blacklist1.c > + > +# > +# Right after we start gdb, there's no default file or function to black= list. > +# > +gdb_test "blacklist file" "No default blacklist file now." > +gdb_test "blacklist function" "No default blacklist function now." > +gdb_test "blacklist" "No default blacklist function now." > + > +if ![runto_main] { fail "blacklist tests suppressed" } > + > +# > +# Test |info blacklist| with an empty blacklist. > +# > +gdb_test "info blacklist" "Blacklist is empty." "info blacklist empty" > + > +# > +# Create a blacklist entry for the current file and function. > +# > +gdb_test "blacklist file" "Blacklisting file .*$srcfile." > +gdb_test "blacklist" "Blacklisting function main() at .*\." > + > +# > +# Create a blacklist entry for a specified file and function. > +# > +gdb_test "blacklist file blacklist1.c" "Blacklisting file .*$srcfile1." > +gdb_test "blacklist function baz" "Blacklisting function baz at .*" > + > +# > +# Test bad blacklist entry modification commands > +# > +gdb_test "blacklist enable 999" "No blacklist entry numbered 999." > +gdb_test "blacklist disable 999" "No blacklist entry numbered 999." > +gdb_test "blacklist delete 999" "No blacklist entry numbered 999." > +gdb_test "blacklist enable" "Argument required \\(expression to compute\= \)." > +gdb_test "blacklist disable" "Argument required \\(expression to compute= \\)." > +gdb_test "blacklist delete" "Argument required \\(expression to compute\= \)." > +gdb_test "blacklist enable a" "No symbol \"a\" in current context." > +gdb_test "blacklist disable a" "No symbol \"a\" in current context." > +gdb_test "blacklist delete a" "No symbol \"a\" in current context." > + > +# > +# Test that blacklist function doesn't allow extra characters at the end= of its > +# arguments list. > +# > +gdb_test "blacklist function foo bar" "Junk at end of arguments." > + > +# > +# Ask for info on a blacklist entry which doesn't exist. > +# > +gdb_test "info blacklist 999" "No blacklist entry numbered 999." > + > +# > +# Does |info blacklist| look right? > +# > +gdb_test "info blacklist" \ > +"Num\\s+Type\\s+Enb\\s+Address\\s+What\\s* > +1\\s+file\\s+y\\s+n/a.*$srcfile\\s* > +2\\s+function\\s+y\\s+0x\[0-9a-f\]+ main at .*$srcfile:\[0-9\]+\\s* > +3\\s+file\\s+y\\s+n/a.*$srcfile1\\s* > +4\\s+function\\s+y\\s+0x\[0-9a-f\]+ baz at .*$srcfile1:\[0-9\]+\\s*" > + > +# > +# Right now, we have an outstanding blacklist on both source files, so w= hen we > +# step into the first line in main(), we should step right over it and g= o to > +# the second line of main(). > +# > +if ![runto_main] { fail "blacklist tests suppressed" } > +send_gdb "step\n" > +gdb_test "bt" "#0\\s+main.*" "step after all blacklisted" > + > +# > +# Now remove blacklist.c from the blacklist. =A0Our first step should ta= ke us > +# into foo(), and our second step should take us to the next line in mai= n(). > +# > +send_gdb "blacklist delete 1\n" > +# Check that entry 1 is missing from |info blacklist| > +gdb_test "info blacklist" \ > +"Num\\s+Type\\s+Enb\\s+Address\\s+What\\s* > +2\\s+function\\s+y\\s+0x\[0-9a-f\]+ main at .*$srcfile:\[0-9\]+\\s* > +3\\s+file\\s+y\\s+n/a.*$srcfile1\\s* > +4\\s+function\\s+y\\s+0x\[0-9a-f\]+ baz at .*$srcfile1:\[0-9\]+\\s*" > + > +if ![runto_main] { fail "blacklist tests suppressed" } > +gdb_test "step" "foo \\(\\) at.*" "step after deleting 1 (1)" > +send_gdb "step\n"; # Return from foo() > +gdb_test "step" "main \\(\\) at.*" "step after deleting 1 (2)" > + > +# > +# Now disable our blacklisting of blacklist1.c. =A0We should now step in= to foo(), > +# then into bar(), but not into baz(). > +# > +send_gdb "blacklist disable 3\n" > +# Is entry 3 disabled in |info blacklist|? > +gdb_test "info blacklist 3" ".*\\n3\\s+file\\s+n.*" \ > + =A0 =A0 =A0 =A0 "info blacklist shows entry as disabled" > + > +if ![runto_main] { fail "blacklist tests suppressed" } > +gdb_test "step" "bar \\(\\) at.*" "step after disabling 3 (1)" > +send_gdb "step\n"; # Return from foo() > +gdb_test "step" "foo \\(\\) at.*" "step after disabling 3 (2)" > +send_gdb "step\n"; # Return from bar() > +gdb_test "step" "main \\(\\) at.*" "step after disabling 3 (3)" > + > +# > +# Enable blacklist entry 3 and make sure we step over it like before. > +# > +send_gdb "blacklist enable 3\n" > +# Is entry 3 enabled in |info blacklist|? > +gdb_test "info blacklist 3" ".*\\n3\\s+file\\s+y.*" \ > + =A0 =A0 =A0 =A0 "info blacklist shows entry as enabled" > +if ![runto_main] { fail "blacklist tests suppressed" } > +gdb_test "step" "foo \\(\\) at.*" "step after deleting 1 (1)" > +send_gdb "step\n"; # Return from foo() > +gdb_test "step" "main \\(\\) at.*" "step after deleting 1 (2)" > + > diff --git a/gdb/testsuite/gdb.base/blacklist1.c > b/gdb/testsuite/gdb.base/blacklist1.c > new file mode 100644 > index 0000000..2dab5c3 > --- /dev/null > +++ b/gdb/testsuite/gdb.base/blacklist1.c > @@ -0,0 +1,9 @@ > +int bar() > +{ > + =A0return 1; > +} > + > +int baz(int a, int b) > +{ > + =A0return a + b; > +} >