gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 12 Feb 2012 19:15:01 +0000 (19:15 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 12 Feb 2012 19:15:01 +0000 (19:15 +0000)
Fix crash on loaded shlibs without loaded exec_bfd.
* exec.c (exec_files_info): Do not crash on NULL EXEC_BFD.
(set_section_command): Replace exec_bfd by p->bfd.

gdb/testsuite/
* gdb.server/server-exec-info.exp: New file.

gdb/ChangeLog
gdb/exec.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.server/server-exec-info.exp [new file with mode: 0644]

index 8467263e1ad4e9803d90070199909e8ca18423aa..e11ad4aa3d3fe98ac421efc735665f5680d27951 100644 (file)
@@ -1,3 +1,9 @@
+2012-02-12  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Fix crash on loaded shlibs without loaded exec_bfd.
+       * exec.c (exec_files_info): Do not crash on NULL EXEC_BFD.
+       (set_section_command): Replace exec_bfd by p->bfd.
+
 2012-02-10  Tom Tromey  <tromey@redhat.com>
 
        * linespec.c (decode_line_internal): Skip symtabs_from_filename
index cd129f7cbcb0d602417dc85cf49cfe421448e8bf..8a3e79763bf219be94a68fa962ac258f7e3d026f 100644 (file)
@@ -761,7 +761,10 @@ print_section_info (struct target_section_table *t, bfd *abfd)
 static void
 exec_files_info (struct target_ops *t)
 {
-  print_section_info (current_target_sections, exec_bfd);
+  if (exec_bfd)
+    print_section_info (current_target_sections, exec_bfd);
+  else
+    puts_filtered (_("\t<no file loaded>\n"));
 
   if (vmap)
     {
@@ -813,9 +816,9 @@ set_section_command (char *args, int from_tty)
   table = current_target_sections;
   for (p = table->sections; p < table->sections_end; p++)
     {
-      if (!strncmp (secname, bfd_section_name (exec_bfd,
+      if (!strncmp (secname, bfd_section_name (p->bfd,
                                               p->the_bfd_section), seclen)
-         && bfd_section_name (exec_bfd, p->the_bfd_section)[seclen] == '\0')
+         && bfd_section_name (p->bfd, p->the_bfd_section)[seclen] == '\0')
        {
          offset = secaddr - p->addr;
          p->addr += offset;
index f0eab1ca4e6707834b032b71ec2e7e4fac85093e..4de14578c9f48846c1bafc37b7bd1b81e86b6f17 100644 (file)
@@ -1,3 +1,7 @@
+2012-02-12  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * gdb.server/server-exec-info.exp: New file.
+
 2012-02-10  Pedro Alves  <palves@redhat.com>
 
        * gdb.base/break-interp.exp (test_attach_gdb): Assume $file is
diff --git a/gdb/testsuite/gdb.server/server-exec-info.exp b/gdb/testsuite/gdb.server/server-exec-info.exp
new file mode 100644 (file)
index 0000000..3d773af
--- /dev/null
@@ -0,0 +1,29 @@
+# Copyright (C) 2012 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/>.
+
+load_lib gdbserver-support.exp
+
+set testfile "no-execfile-info"
+set srcfile "server.c"
+#if { [build_executable ${testfile}.exp ${testfile} ${srcfile}] == -1} {
+if [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] {
+    return -1
+}
+
+gdb_test "file" ".*" "file" \
+        {Discard symbol table from `.*'\? \(y or n\) } "y"
+gdbserver_run ""
+gdb_test "set sysroot remote:"
+gdb_test "info files" "\r\nLocal exec file:\r\n\t<no file loaded>"
This page took 0.05014 seconds and 4 git commands to generate.