aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAdrian Sendroiu <adrian.sendroiu@freescale.com>2014-07-11 10:51:48 +0100
committerPedro Alves <palves@redhat.com>2014-07-11 10:51:48 +0100
commitb9c1d481cc639a9c1f31aea164f8716a85edd89f (patch)
tree6102de6e0c83016f6d180988cb5233547281083b /gdb
parent68372333a2467491f007d59c390d67f58df0bb77 (diff)
downloadgdb-b9c1d481cc639a9c1f31aea164f8716a85edd89f.zip
gdb-b9c1d481cc639a9c1f31aea164f8716a85edd89f.tar.gz
gdb-b9c1d481cc639a9c1f31aea164f8716a85edd89f.tar.bz2
remote: call remote_check_symbols after attaching
When debugging a remote bare-metal target with "target extended-remote" + attach, GDB won't send a qSymbol packet to initiate symbol lookup. This happens because all the previous places in which GDB might have done this are guarded by conditions that don't hold in the said scenario: there are no shared libraries, no vsyscall page and the binary file didn't change in the time passed between the "file" and the "attach" commands. To solve this problem remote_check_symbols is called in the target_post_attach hook. gdb/ 2014-07-11 Adrian Sendroiu <adrian.sendroiu@freescale.com> * remote.c (extended_remote_post_attach): New function. (init_extended_remote_ops): Install it as to_post_attach method.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/remote.c15
2 files changed, 20 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 56f2909..9aea5a9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2014-07-11 Adrian Sendroiu <adrian.sendroiu@freescale.com>
+
+ * remote.c (extended_remote_post_attach): New function.
+ (init_extended_remote_ops): Install it as to_post_attach method.
+
2014-07-09 Pedro Alves <palves@redhat.com>
* infcmd.c (attach_command_post_wait): Don't call
diff --git a/gdb/remote.c b/gdb/remote.c
index 3aa030c..76efefa 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4484,6 +4484,20 @@ extended_remote_attach (struct target_ops *ops, const char *args, int from_tty)
extended_remote_attach_1 (ops, args, from_tty);
}
+/* Implementation of the to_post_attach method. */
+
+static void
+extended_remote_post_attach (struct target_ops *ops, int pid)
+{
+ /* In certain cases GDB might not have had the chance to start
+ symbol lookup up until now. This could happen if the debugged
+ binary is not using shared libraries, the vsyscall page is not
+ present (on Linux) and the binary itself hadn't changed since the
+ debugging process was started. */
+ if (symfile_objfile != NULL)
+ remote_check_symbols();
+}
+
/* Check for the availability of vCont. This function should also check
the response. */
@@ -11530,6 +11544,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya).";
extended_remote_ops.to_mourn_inferior = extended_remote_mourn;
extended_remote_ops.to_detach = extended_remote_detach;
extended_remote_ops.to_attach = extended_remote_attach;
+ extended_remote_ops.to_post_attach = extended_remote_post_attach;
extended_remote_ops.to_kill = extended_remote_kill;
extended_remote_ops.to_supports_disable_randomization
= extended_remote_supports_disable_randomization;