From 570083757caf694cbcf250a64f88709a8676aacf Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sun, 12 Feb 2012 19:15:01 +0000 Subject: gdb/ 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/exec.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gdb/exec.c') diff --git a/gdb/exec.c b/gdb/exec.c index cd129f7..8a3e797 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -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\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; -- cgit v1.1