call observer_notify_new_objfile after the attach command

Message ID
State Changes Requested, archived

Commit Message

Adrian Sendroiu July 10, 2014, 10:56 a.m. UTC
  Thanks, I added a call to remote_check_symbols in the post_attach hook.


From 0820f5ab475bd9e261e7be26dabbd30e5df60544 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrian=20=C8=98endroiu?= <>
Date: Thu, 10 Jul 2014 11:16:41 +0300
Subject: [PATCH] call remote_check_symbols after attaching

 gdb/remote.c |    8 ++++++++
 1 file changed, 8 insertions(+)


Pedro Alves July 10, 2014, 1:53 p.m. UTC | #1

Could you complete the patch according to the instructions
at, so it
could be git am'ed/pushed?  (explain the rationale in the commit
log, ChangeLog, etc.)

Adding a comment in extended_remote_post_attach explaining why
that is done there would be good too.  E.g., mention the case
of no libraries and the program not changing.

Please also add something like this above the new function:

/* Implementation of the to_post_attach method.  */

And, write an explicit NULL check:

  if (symfile_objfile != NULL)

Thanks again,


diff --git a/gdb/remote.c b/gdb/remote.c
index 3aa030c..8b438c7 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4484,6 +4484,13 @@  extended_remote_attach (struct target_ops *ops, const char *args, int from_tty)
   extended_remote_attach_1 (ops, args, from_tty);
+static void
+extended_remote_post_attach (struct target_ops *ops, int pid)
+  if (symfile_objfile)
+    remote_check_symbols();
 /* Check for the availability of vCont.  This function should also check
    the response.  */
@@ -11530,6 +11537,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_supports_disable_randomization;