This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v12 5/5] Test adding and removing a symbol file at runtime.


This test exercises the commands 'add-symbol-file'
and 'remove-symbol-file'.

2013-04-04  Nicolas Blanc  <nicolas.blanc@intel.com>

gdb/testsuite
	* gdb.base/sym-file-lib.c: New file.
	* gdb.base/sym-file-loader.c: New file.
	* gdb.base/sym-file-loader.h: New file.
	* gdb.base/sym-file-main.c: New file.
	* gdb.base/sym-file.exp: New file.

Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
---
 gdb/testsuite/gdb.base/sym-file-lib.c    |   26 +++
 gdb/testsuite/gdb.base/sym-file-loader.c |  348 ++++++++++++++++++++++++++++++
 gdb/testsuite/gdb.base/sym-file-loader.h |   83 +++++++
 gdb/testsuite/gdb.base/sym-file-main.c   |   78 +++++++
 gdb/testsuite/gdb.base/sym-file.exp      |  160 ++++++++++++++
 5 files changed, 695 insertions(+), 0 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/sym-file-lib.c
 create mode 100644 gdb/testsuite/gdb.base/sym-file-loader.c
 create mode 100644 gdb/testsuite/gdb.base/sym-file-loader.h
 create mode 100644 gdb/testsuite/gdb.base/sym-file-main.c
 create mode 100644 gdb/testsuite/gdb.base/sym-file.exp

diff --git a/gdb/testsuite/gdb.base/sym-file-lib.c b/gdb/testsuite/gdb.base/sym-file-lib.c
new file mode 100644
index 0000000..586215d
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sym-file-lib.c
@@ -0,0 +1,26 @@
+/* Copyright 2013 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.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+extern int
+bar ()
+{
+  return 1; /* gdb break at bar */
+}
+
+extern int
+foo (int a)
+{
+  return a; /* gdb break at foo */
+}
diff --git a/gdb/testsuite/gdb.base/sym-file-loader.c b/gdb/testsuite/gdb.base/sym-file-loader.c
new file mode 100644
index 0000000..58975cb
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sym-file-loader.c
@@ -0,0 +1,348 @@
+/* Copyright 2013 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.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+
+#include "sym-file-loader.h"
+
+#ifdef TARGET_LP64
+
+unsigned char
+elf_st_type (unsigned char st_info)
+{
+  return ELF64_ST_TYPE (st_info);
+}
+
+#elif defined TARGET_ILP32
+
+unsigned char
+elf_st_type (unsigned char st_info)
+{
+  return ELF32_ST_TYPE (st_info);
+}
+
+#endif
+
+/* Load a program segment.  */
+
+static struct segment *
+load (char *addr, Elf_Phdr *phdr, struct segment *tail_seg)
+{
+  struct segment *seg = NULL;
+  char *mapped_addr = NULL;
+  void *from = NULL;
+  void *to = NULL;
+
+  /* For the sake of simplicity all operations are permitted.  */
+  unsigned perm = PROT_READ | PROT_WRITE | PROT_EXEC;
+
+  mapped_addr = (char *) mmap ((void *) phdr->p_vaddr,
+			       phdr->p_memsz, perm,
+			       MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+
+  from = (void *) (addr + phdr->p_offset);
+  to = (void *) mapped_addr;
+
+  memcpy (to, from, phdr->p_filesz);
+
+  seg = (struct segment *) malloc (sizeof (struct segment));
+
+  if (seg == 0)
+    return 0;
+
+  seg->mapped_addr = mapped_addr;
+  seg->phdr = phdr;
+  seg->next = 0;
+
+  if (tail_seg != 0)
+    tail_seg->next = seg;
+
+  return seg;
+}
+
+/* Mini shared library loader.  No reallocation
+   is performed for the sake of simplicity.  */
+
+int
+load_shlib (const char *file, Elf_Ehdr **ehdr_out, struct segment **seg_out)
+{
+  unsigned i = 0;
+  int fd = -1;
+  off_t fsize = -1;
+  char *addr = NULL;
+  Elf_Ehdr *ehdr = NULL;
+  Elf_Phdr *phdr = NULL;
+  struct segment *head_seg = NULL;
+  struct segment *tail_seg = NULL;
+
+  /* Map the lib in memory for reading.  */
+  fd = open (file, O_RDONLY);
+  if (fd < 0)
+    {
+      perror ("fopen failed.");
+      return -1;
+    }
+
+  fsize = lseek (fd, 0, SEEK_END);
+
+  if (fsize < 0)
+    {
+      perror ("lseek failed.");
+      return -1;
+    }
+
+  addr = (char *) mmap (NULL, fsize, PROT_READ, MAP_PRIVATE, fd, 0);
+  if (addr == (char *) -1)
+    {
+      perror ("mmap failed.");
+      return -1;
+    }
+
+  /* Check if the lib is an ELF file.  */
+  ehdr = (Elf_Ehdr *) addr;
+  if (ehdr->e_ident[EI_MAG0] != ELFMAG0
+      || ehdr->e_ident[EI_MAG1] != ELFMAG1
+      || ehdr->e_ident[EI_MAG2] != ELFMAG2
+      || ehdr->e_ident[EI_MAG3] != ELFMAG3)
+    {
+      printf ("Not an ELF file: %x\n", ehdr->e_ident[EI_MAG0]);
+      return -1;
+    }
+
+  if (ehdr->e_ident[EI_CLASS] == ELFCLASS32)
+    {
+      if (sizeof (int *) != 4)
+	{
+	  printf ("Architecture mismatch.");
+	  return -1;
+	}
+    }
+  else if (ehdr->e_ident[EI_CLASS] == ELFCLASS64)
+    {
+      if (sizeof (int *) != 8)
+	{
+	  printf ("Architecture mismatch.");
+	  return -1;
+	}
+    }
+
+  /* Load the program segments.  For the sake of simplicity
+     assume that no reallocation is needed.  */
+  phdr = (Elf_Phdr *) (addr + ehdr->e_phoff);
+  for (i = 0; i < ehdr->e_phnum; i++, phdr++)
+    {
+      if (phdr->p_type == PT_LOAD)
+	{
+	  struct segment *next_seg = load (addr, phdr, tail_seg);
+	  if (next_seg == 0)
+	    continue;
+	  tail_seg = next_seg;
+	  if (head_seg == 0)
+	    head_seg = next_seg;
+	}
+    }
+  *ehdr_out = ehdr;
+  *seg_out = head_seg;
+  return 0;
+}
+
+/* Return the section-header table.  */
+
+Elf_Shdr *
+find_shdrtab (Elf_Ehdr *ehdr)
+{
+  return (Elf_Shdr *) (((char *) ehdr) + ehdr->e_shoff);
+}
+
+/* Return the string table of the section headers.  */
+
+const char *
+find_shstrtab (Elf_Ehdr *ehdr, unsigned *size)
+{
+  const Elf_Shdr *shdr = NULL;
+  const Elf_Shdr *shstr = NULL;
+
+  if (ehdr->e_shnum <= ehdr->e_shstrndx)
+    {
+      printf ("The index of the string table is corrupt.");
+      return NULL;
+    }
+
+  shdr = find_shdrtab (ehdr);
+
+  shstr = &shdr[ehdr->e_shstrndx];
+  *size = shstr->sh_size;
+  return ((const char *) ehdr) + shstr->sh_offset;
+}
+
+/* Return the string table named SECTION.  */
+
+const char *
+find_strtab (Elf_Ehdr *ehdr,
+	     const char *section, unsigned *strtab_size)
+{
+  unsigned shstrtab_size = 0;
+  const char *shstrtab = NULL;
+  unsigned i = 0;
+  const Elf_Shdr *shdr = find_shdrtab (ehdr);
+
+  /* Get the string table of the section headers.  */
+  shstrtab = find_shstrtab (ehdr, &shstrtab_size);
+  if (shstrtab == NULL)
+    return NULL;
+
+  for (i = 0; i < ehdr->e_shnum; i++)
+    {
+      Elf_Word name = shdr[i].sh_name;
+      if (shdr[i].sh_type == SHT_STRTAB && name <= shstrtab_size
+	  && strcmp ((const char *) &shstrtab[name], section) == 0)
+	{
+	  *strtab_size = shdr[i].sh_size;
+	  return ((const char *) ehdr) + shdr[i].sh_offset;
+	}
+
+    }
+  return NULL;
+}
+
+/* Return the section header named SECTION.  */
+
+Elf_Shdr *
+find_shdr (Elf_Ehdr *ehdr, const char *section)
+{
+  unsigned shstrtab_size = 0;
+  const char *shstrtab = NULL;
+  unsigned i = 0;
+
+  /* Get the string table of the section headers.  */
+  shstrtab = find_shstrtab (ehdr, &shstrtab_size);
+  if (shstrtab == NULL)
+    return NULL;
+
+  Elf_Shdr *shdr = find_shdrtab (ehdr);
+  for (i = 0; i < ehdr->e_shnum; i++)
+    {
+      Elf_Word name = shdr[i].sh_name;
+      if (name <= shstrtab_size)
+	{
+	  if (strcmp ((const char *) &shstrtab[name], section) == 0)
+	    return &shdr[i];
+	}
+
+    }
+  return NULL;
+}
+
+/* Return the symbol table.  */
+
+Elf_Sym *
+find_symtab (Elf_Ehdr *ehdr, unsigned *symtab_size)
+{
+  unsigned i = 0;
+  const Elf_Shdr *shdr = find_shdrtab (ehdr);
+  for (i = 0; i < ehdr->e_shnum; i++)
+    {
+      if (shdr[i].sh_type == SHT_SYMTAB)
+	{
+	  *symtab_size = shdr[i].sh_size / sizeof (Elf_Sym);
+	  return (Elf_Sym *) (((const char *) ehdr) + shdr[i].sh_offset);
+	}
+    }
+  return NULL;
+}
+
+/* Translate a file offset to an address in a loaded segment.   */
+
+int
+translate_offset (Elf_Word file_offset, struct segment *seg, void **addr)
+{
+  while (seg)
+    {
+      Elf_Word p_from = 0, p_to = 0;
+      Elf_Phdr *phdr = seg->phdr;
+
+      if (phdr == NULL)
+	{
+	  seg = seg->next;
+	  continue;
+	}
+
+      p_from = phdr->p_offset;
+      p_to = p_from + phdr->p_filesz;
+      if (p_from <= file_offset && file_offset < p_to)
+	{
+	  *addr = (void *) (seg->mapped_addr + (file_offset - p_from));
+	  return 0;
+	}
+      seg = seg->next;
+    }
+
+  return -1;
+}
+
+/* Lookup the address of FUNC.  */
+
+int
+lookup_function (const char *func,
+		 Elf_Ehdr *ehdr, struct segment *seg, void **addr)
+{
+  const char *strtab = NULL;
+  unsigned strtab_size = 0;
+  Elf_Sym *symtab = NULL;
+  unsigned symtab_size = 0;
+  unsigned i = 0;
+
+  /* Get the string table for the symbols.  */
+  strtab = find_strtab (ehdr, ".strtab", &strtab_size);
+  if (strtab == NULL)
+    {
+      printf (".strtab not found.");
+      return -1;
+    }
+
+  /* Get the symbol table.  */
+  symtab = find_symtab (ehdr, &symtab_size);
+  if (symtab == NULL)
+    {
+      printf ("symbol table not found.");
+      return -1;
+    }
+
+  for (i = 0; i < symtab_size; i++)
+    {
+      Elf_Sym *sym = &symtab[i];
+
+      if (elf_st_type (sym->st_info) != STT_FUNC)
+	continue;
+
+      if (sym->st_name < strtab_size)
+	{
+	  const char *name = &strtab[sym->st_name];
+	  if (strcmp (name, func) == 0)
+	    {
+
+	      unsigned offset = (unsigned) sym->st_value;
+	      return translate_offset (offset, seg, addr);
+	    }
+	}
+    }
+
+  return -1;
+}
diff --git a/gdb/testsuite/gdb.base/sym-file-loader.h b/gdb/testsuite/gdb.base/sym-file-loader.h
new file mode 100644
index 0000000..573726b
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sym-file-loader.h
@@ -0,0 +1,83 @@
+/* Copyright 2013 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.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __SYM_FILE_LOADER__
+#define __SYM_FILE_LOADER__
+
+#include <elf.h>
+
+#ifdef TARGET_LP64
+
+typedef Elf64_Phdr Elf_Phdr;
+typedef Elf64_Ehdr Elf_Ehdr;
+typedef Elf64_Shdr Elf_Shdr;
+typedef Elf64_Sym Elf_Sym;
+typedef Elf64_Word Elf_Word;
+
+#elif defined TARGET_ILP32
+
+typedef Elf32_Phdr Elf_Phdr;
+typedef Elf32_Ehdr Elf_Ehdr;
+typedef Elf32_Shdr Elf_Shdr;
+typedef Elf32_Sym Elf_Sym;
+typedef Elf32_Word Elf_Word;
+
+#endif
+
+struct segment
+{
+  char *mapped_addr;
+  Elf_Phdr *phdr;
+  struct segment *next;
+};
+
+/* Mini shared library loader.  No reallocation is performed
+   for the sake of simplicity.  */
+
+int
+load_shlib (const char *file, Elf_Ehdr **ehdr_out, struct segment **seg_out);
+
+/* Return the section-header table.  */
+
+Elf_Shdr *find_shdrtab (Elf_Ehdr *ehdr);
+
+/* Return the string table of the section headers.  */
+
+const char *find_shstrtab (Elf_Ehdr *ehdr, unsigned *size);
+
+/* Return the string table named SECTION.  */
+
+const char *find_strtab (Elf_Ehdr *ehdr,
+			 const char *section, unsigned *strtab_size);
+
+/* Return the section header named SECTION.  */
+
+Elf_Shdr *find_shdr (Elf_Ehdr *ehdr, const char *section);
+
+/* Return the symbol table.  */
+
+Elf_Sym *find_symtab (Elf_Ehdr *ehdr, unsigned *symtab_size);
+
+/* Translate a file offset to an address in a loaded segment.   */
+
+int translate_offset (Elf_Word file_offset, struct segment *seg, void **addr);
+
+/* Lookup the address of FUNC.  */
+
+int
+lookup_function (const char *func, Elf_Ehdr* ehdr,
+		 struct segment *seg, void **addr);
+
+#endif
diff --git a/gdb/testsuite/gdb.base/sym-file-main.c b/gdb/testsuite/gdb.base/sym-file-main.c
new file mode 100644
index 0000000..e1b0044
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sym-file-main.c
@@ -0,0 +1,78 @@
+/* Copyright 2013 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.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "sym-file-loader.h"
+
+void
+gdb_add_symbol_file (void *addr, const char *file)
+{
+  return;
+}
+
+void
+gdb_remove_symbol_file (void *addr)
+{
+  return;
+}
+
+/* Load a shared library without relying on the standard
+   loader to test GDB's commands for adding and removing
+   symbol files at runtime.  */
+
+int
+main (int argc, const char *argv[])
+{
+  const char *file = SHLIB_NAME;
+  Elf_Ehdr *ehdr = NULL;
+  struct segment *head_seg = NULL;
+  Elf_Shdr *text = NULL;
+  char *text_addr = NULL;
+  int (*pbar) () = NULL;
+  int (*pfoo) (int) = NULL;
+
+  if (load_shlib (file, &ehdr, &head_seg) != 0)
+    return -1;
+
+  /* Get the text section.  */
+  text = find_shdr (ehdr, ".text");
+  if (text == NULL)
+    return -1;
+
+  /* Notify GDB to add the symbol file.  */
+  if (translate_offset (text->sh_offset, head_seg, (void **) &text_addr) != 0)
+    return -1;
+
+  gdb_add_symbol_file (text_addr, file);
+
+  /* Call bar from SHLIB_NAME.  */
+  if (lookup_function ("bar", ehdr, head_seg, (void *) &pbar) != 0)
+    return -1;
+
+  (*pbar) ();
+
+  /* Call foo from SHLIB_NAME.  */
+  if (lookup_function ("foo", ehdr, head_seg, (void *) &pfoo) != 0)
+    return -1;
+
+  (*pfoo) (2);
+
+  /* Notify GDB to remove the symbol file.  */
+  gdb_remove_symbol_file (text_addr);
+
+  return 0;
+}
diff --git a/gdb/testsuite/gdb.base/sym-file.exp b/gdb/testsuite/gdb.base/sym-file.exp
new file mode 100644
index 0000000..fee93f4
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sym-file.exp
@@ -0,0 +1,160 @@
+# Copyright 2013 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.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+# Test adding and removing a symbol file dynamically:
+# 1)  Run to gdb_add_symbol_file in $mainfile.
+# 2)  Set a pending breakpoint at bar in $libsrc.
+# 3)  Load $shlib_name using 'add-symbol-file'.
+# 4)  'info files' must display $libname.
+# 5)  Continue to bar in $libsrc.
+# 6)  Set a breakpoint at foo in $librc.
+# 7)  Continue to foo in $libsrc.
+# 8)  Set a breakpoint at gdb_remove_symbol_file.
+# 9)  Continue to gdb_remove_symbol_file in $mainfile.
+# 10) Remove $shlib_name using 'remove-symbol-file'.
+# 11) 'info files' must not display $libname, anymore.
+# 12) Check that the breakpoints at foo and bar are pending.
+# 13) Check that the execution can continue without error.
+
+if { ![is_elf_target] } {
+    return 0
+}
+
+if [skip_shlib_tests] {
+    return 0
+}
+
+if [is_remote target] {
+    return 0
+}
+
+set target_size TARGET_UNKNOWN
+if [is_lp64_target] {
+    set target_size TARGET_LP64
+} elseif [is_ilp32_target] {
+   set target_size TARGET_ILP32
+} else {
+    return 0
+}
+
+set testfile sym-file.exp
+set mainfile sym-file-main
+set loaderfile sym-file-loader
+set libfile sym-file-lib
+set srcfiles "${mainfile}.c ${loaderfile}.c"
+set libsrc "${srcdir}/${subdir}/${libfile}.c"
+set libname "${libfile}.so"
+set shlib_name "${objdir}/${subdir}/${libname}"
+set libobj "${objdir}/${subdir}/${libname}"
+set exec_opts [list debug "additional_flags=-D$target_size\
+ -DSHLIB_NAME\\=\"$shlib_name\""]
+
+if [get_compiler_info] {
+    return -1
+}
+
+if { [gdb_compile_shlib $libsrc $libobj {debug}] != "" } {
+    untested ${testfile}
+    return
+}
+
+if { [prepare_for_testing ${testfile} ${mainfile} ${srcfiles} $exec_opts] } {
+    return
+}
+
+# 1) Run to GDB_ADD_SYMBOl_FILE in $mainfile for adding
+#    $shlib_name.
+set result [runto gdb_add_symbol_file]
+if { !$result } then {
+   return
+}
+
+# 2) Set a pending breakpoint at bar in $libsrc.
+set result [gdb_breakpoint bar allow-pending]
+if { !$result } then {
+   return
+}
+
+# 3) Add $shlib_name using 'add-symbol-file'.
+set result [gdb_test "add-symbol-file ${shlib_name} addr" \
+		     "Reading symbols from .*${shlib_name}\\.\\.\\.done\\." \
+		     "add-symbol-file ${shlib_name} addr" \
+		     "add symbol table from file \".*${shlib_name}\"\
+ at.*\\(y or n\\) " \
+		     "y"]
+if { $result != 0 } then {
+   return
+}
+
+# 4) 'info files' must display $libname.
+gdb_test "info files" \
+	 "^(?=(.*${libname})).*" \
+	 "info files must display $libname"
+
+# 5) Continue to bar in $libsrc to ensure that the breakpoint
+#    was bound correctly after adding $shilb_name.
+set lnum_bar [gdb_get_line_number "break at bar" ${libfile}.c]
+gdb_continue_to_breakpoint bar ".*$libfile\\.c:$lnum_bar.*"
+
+# 6) Set a breakpoint at foo in $libsrc.
+set result [gdb_breakpoint foo]
+if { !$result } then {
+    return
+}
+
+# 7) Continue to foo in $libsrc to ensure that the breakpoint
+#    was bound correctly.
+set lnum_foo [gdb_get_line_number "break at foo" ${libfile}.c]
+gdb_continue_to_breakpoint foo ".*$libfile\\.c:$lnum_foo.*"
+
+# 8) Set a breakpoint at gdb_remove_symbol_file in $mainfile for
+#    removing $shlib_name.
+set result [gdb_breakpoint gdb_remove_symbol_file]
+if { !$result } then {
+    return
+}
+
+# 9) Continue to gdb_remove_symbol_file in $mainfile.
+gdb_continue_to_breakpoint gdb_remove_symbol_file
+
+# 10) Remove $shlib_name using 'remove-symbol-file'.
+set result [gdb_test "remove-symbol-file -a addr" \
+		     ""\
+     		     "remove-symbol-file -a addr" \
+		     "Remove symbol table from file \".*${shlib_name}\"\\?\
+.*\\(y or n\\) " \
+		     "y"]
+if { $result != 0 } then {
+    return
+}
+
+# 11) 'info files' must not display $libname, anymore.
+gdb_test "info files" \
+	 "^(?!(.*${libname})).*" \
+	 "info files must not display ${libname}"
+
+# 12) Check that the breakpoints at foo and bar are pending after removing
+#     $shlib_name.
+gdb_test "info breakpoints 2" \
+	 ".*PENDING.*" \
+	 "check if Breakpoint 2 is pending."
+
+gdb_test "info breakpoints 3" \
+	 ".*PENDING.*" \
+	 "check if Breakpoint 3 is pending."
+
+# 13) Check that the execution can continue without error.
+gdb_continue_to_end
+
-- 
1.7.6.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]