public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [review] Don't read agent symbols when disabled
@ 2019-10-31  1:48 Christian Biesinger (Code Review)
  2019-10-31 20:37 ` Tom Tromey (Code Review)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christian Biesinger (Code Review) @ 2019-10-31  1:48 UTC (permalink / raw)
  To: gdb-patches; +Cc: Christian Biesinger

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/464
......................................................................

Don't read agent symbols when disabled

This avoids unnecessary work, and becomes important with the patch in
https://sourceware.org/ml/gdb-patches/2019-10/msg01143.html

gdb/ChangeLog:

2019-10-30  Christian Biesinger  <cbiesinger@google.com>

	* agent.c (set_can_use_agent): When the setting is turned on,
	look up agent symbols if we don't have them yet.
	(agent_new_objfile): Don't look up agent symbols when the agent
	setting is off.

Change-Id: I6523a5640c95d38299998050a6c620e51096e8ed
---
M gdb/agent.c
1 file changed, 15 insertions(+), 4 deletions(-)



diff --git a/gdb/agent.c b/gdb/agent.c
index bc71860..da251a3 100644
--- a/gdb/agent.c
+++ b/gdb/agent.c
@@ -20,6 +20,8 @@
 #include "gdbcmd.h"
 #include "target.h"
 #include "gdbsupport/agent.h"
+#include "observable.h"
+#include "objfiles.h"
 
 /* Enum strings for "set|show agent".  */
 
@@ -46,20 +48,29 @@
 static void
 set_can_use_agent (const char *args, int from_tty, struct cmd_list_element *c)
 {
-  if (target_use_agent (can_use_agent == can_use_agent_on) == 0)
+  bool can_use = (can_use_agent == can_use_agent_on);
+  if (can_use && !agent_loaded_p ())
+    {
+      /* Since the setting was off, we may not have observed the objfiles and
+         therefore not looked up the required symbols.  Do so now.  */
+      for (objfile *objfile : current_program_space->objfiles ())
+	if (agent_look_up_symbols (objfile) == 0)
+	  break;
+    }
+  if (target_use_agent (can_use) == 0)
     /* Something wrong during setting, set flag to default value.  */
     can_use_agent = can_use_agent_off;
 }
 
-#include "observable.h"
-#include "objfiles.h"
-
 static void
 agent_new_objfile (struct objfile *objfile)
 {
   if (objfile == NULL || agent_loaded_p ())
     return;
 
+  if (can_use_agent == can_use_agent_off)
+    return;
+
   agent_look_up_symbols (objfile);
 }
 

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I6523a5640c95d38299998050a6c620e51096e8ed
Gerrit-Change-Number: 464
Gerrit-PatchSet: 1
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-MessageType: newchange

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [review] Don't read agent symbols when disabled
  2019-10-31  1:48 [review] Don't read agent symbols when disabled Christian Biesinger (Code Review)
@ 2019-10-31 20:37 ` Tom Tromey (Code Review)
  2019-10-31 20:47 ` [pushed] " Sourceware to Gerrit sync (Code Review)
  2019-10-31 20:47 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey (Code Review) @ 2019-10-31 20:37 UTC (permalink / raw)
  To: Christian Biesinger, gdb-patches

Tom Tromey has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/464
......................................................................


Patch Set 1: Code-Review+2

Thanks for the patch.  This is ok.


-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I6523a5640c95d38299998050a6c620e51096e8ed
Gerrit-Change-Number: 464
Gerrit-PatchSet: 1
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Thu, 31 Oct 2019 20:37:00 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pushed] Don't read agent symbols when disabled
  2019-10-31  1:48 [review] Don't read agent symbols when disabled Christian Biesinger (Code Review)
  2019-10-31 20:37 ` Tom Tromey (Code Review)
@ 2019-10-31 20:47 ` Sourceware to Gerrit sync (Code Review)
  2019-10-31 20:47 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-10-31 20:47 UTC (permalink / raw)
  To: Christian Biesinger, gdb-patches; +Cc: Tom Tromey

Sourceware to Gerrit sync has submitted this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/464
......................................................................

Don't read agent symbols when disabled

This avoids unnecessary work, and becomes important with the patch in
https://sourceware.org/ml/gdb-patches/2019-10/msg01143.html

gdb/ChangeLog:

2019-10-31  Christian Biesinger  <cbiesinger@google.com>

	* agent.c (set_can_use_agent): When the setting is turned on,
	look up agent symbols if we don't have them yet.
	(agent_new_objfile): Don't look up agent symbols when the agent
	setting is off.

Change-Id: I6523a5640c95d38299998050a6c620e51096e8ed
---
M gdb/ChangeLog
M gdb/agent.c
2 files changed, 22 insertions(+), 4 deletions(-)


diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cdc44bc..3c26e6d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
 2019-10-31  Christian Biesinger  <cbiesinger@google.com>
 
+	* agent.c (set_can_use_agent): When the setting is turned on,
+	look up agent symbols if we don't have them yet.
+	(agent_new_objfile): Don't look up agent symbols when the agent
+	setting is off.
+
+2019-10-31  Christian Biesinger  <cbiesinger@google.com>
+
 	* config.in: Regenerate.
 
 2019-10-31  Christian Biesinger  <cbiesinger@google.com>
diff --git a/gdb/agent.c b/gdb/agent.c
index bc71860..da251a3 100644
--- a/gdb/agent.c
+++ b/gdb/agent.c
@@ -20,6 +20,8 @@
 #include "gdbcmd.h"
 #include "target.h"
 #include "gdbsupport/agent.h"
+#include "observable.h"
+#include "objfiles.h"
 
 /* Enum strings for "set|show agent".  */
 
@@ -46,20 +48,29 @@
 static void
 set_can_use_agent (const char *args, int from_tty, struct cmd_list_element *c)
 {
-  if (target_use_agent (can_use_agent == can_use_agent_on) == 0)
+  bool can_use = (can_use_agent == can_use_agent_on);
+  if (can_use && !agent_loaded_p ())
+    {
+      /* Since the setting was off, we may not have observed the objfiles and
+         therefore not looked up the required symbols.  Do so now.  */
+      for (objfile *objfile : current_program_space->objfiles ())
+	if (agent_look_up_symbols (objfile) == 0)
+	  break;
+    }
+  if (target_use_agent (can_use) == 0)
     /* Something wrong during setting, set flag to default value.  */
     can_use_agent = can_use_agent_off;
 }
 
-#include "observable.h"
-#include "objfiles.h"
-
 static void
 agent_new_objfile (struct objfile *objfile)
 {
   if (objfile == NULL || agent_loaded_p ())
     return;
 
+  if (can_use_agent == can_use_agent_off)
+    return;
+
   agent_look_up_symbols (objfile);
 }
 

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I6523a5640c95d38299998050a6c620e51096e8ed
Gerrit-Change-Number: 464
Gerrit-PatchSet: 2
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: merged

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pushed] Don't read agent symbols when disabled
  2019-10-31  1:48 [review] Don't read agent symbols when disabled Christian Biesinger (Code Review)
  2019-10-31 20:37 ` Tom Tromey (Code Review)
  2019-10-31 20:47 ` [pushed] " Sourceware to Gerrit sync (Code Review)
@ 2019-10-31 20:47 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-10-31 20:47 UTC (permalink / raw)
  To: Christian Biesinger, Tom Tromey, gdb-patches

The original change was created by Christian Biesinger.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/464
......................................................................

Don't read agent symbols when disabled

This avoids unnecessary work, and becomes important with the patch in
https://sourceware.org/ml/gdb-patches/2019-10/msg01143.html

gdb/ChangeLog:

2019-10-31  Christian Biesinger  <cbiesinger@google.com>

	* agent.c (set_can_use_agent): When the setting is turned on,
	look up agent symbols if we don't have them yet.
	(agent_new_objfile): Don't look up agent symbols when the agent
	setting is off.

Change-Id: I6523a5640c95d38299998050a6c620e51096e8ed
---
M gdb/ChangeLog
M gdb/agent.c
2 files changed, 22 insertions(+), 4 deletions(-)



diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cdc44bc..3c26e6d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
 2019-10-31  Christian Biesinger  <cbiesinger@google.com>
 
+	* agent.c (set_can_use_agent): When the setting is turned on,
+	look up agent symbols if we don't have them yet.
+	(agent_new_objfile): Don't look up agent symbols when the agent
+	setting is off.
+
+2019-10-31  Christian Biesinger  <cbiesinger@google.com>
+
 	* config.in: Regenerate.
 
 2019-10-31  Christian Biesinger  <cbiesinger@google.com>
diff --git a/gdb/agent.c b/gdb/agent.c
index bc71860..da251a3 100644
--- a/gdb/agent.c
+++ b/gdb/agent.c
@@ -20,6 +20,8 @@
 #include "gdbcmd.h"
 #include "target.h"
 #include "gdbsupport/agent.h"
+#include "observable.h"
+#include "objfiles.h"
 
 /* Enum strings for "set|show agent".  */
 
@@ -46,20 +48,29 @@
 static void
 set_can_use_agent (const char *args, int from_tty, struct cmd_list_element *c)
 {
-  if (target_use_agent (can_use_agent == can_use_agent_on) == 0)
+  bool can_use = (can_use_agent == can_use_agent_on);
+  if (can_use && !agent_loaded_p ())
+    {
+      /* Since the setting was off, we may not have observed the objfiles and
+         therefore not looked up the required symbols.  Do so now.  */
+      for (objfile *objfile : current_program_space->objfiles ())
+	if (agent_look_up_symbols (objfile) == 0)
+	  break;
+    }
+  if (target_use_agent (can_use) == 0)
     /* Something wrong during setting, set flag to default value.  */
     can_use_agent = can_use_agent_off;
 }
 
-#include "observable.h"
-#include "objfiles.h"
-
 static void
 agent_new_objfile (struct objfile *objfile)
 {
   if (objfile == NULL || agent_loaded_p ())
     return;
 
+  if (can_use_agent == can_use_agent_off)
+    return;
+
   agent_look_up_symbols (objfile);
 }
 

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I6523a5640c95d38299998050a6c620e51096e8ed
Gerrit-Change-Number: 464
Gerrit-PatchSet: 2
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-31 20:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-31  1:48 [review] Don't read agent symbols when disabled Christian Biesinger (Code Review)
2019-10-31 20:37 ` Tom Tromey (Code Review)
2019-10-31 20:47 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-10-31 20:47 ` Sourceware to Gerrit sync (Code Review)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).