public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: henrik.wallin@windriver.com
To: gdb-patches@sourceware.org
Subject: [RFC][PATCH 04/15] Fix crash in tstatus after detach
Date: Wed, 14 Oct 2015 11:14:00 -0000	[thread overview]
Message-ID: <410dda80c8530a193308630ff74a456fadd4bc9e.1444820235.git.henrik.wallin@windriver.com> (raw)
In-Reply-To: <cover.1444820235.git.henrik.wallin@windriver.com>
In-Reply-To: <cover.1444820235.git.henrik.wallin@windriver.com>

From: Par Olsson <par.olsson@windriver.com>

When calling tstatus after detaching the process,
gdbserver tries to access inferior memory which
results in a crash.
This changes the behavior of the agent_loaded_p()
to return false if no inferior is loaded.

gdb/ChangeLog:

	* agent.c (agent_loaded_p): Add check that inferior is present.

Signed-off-by: Par Olsson <par.olsson@windriver.com>
Signed-off-by: Henrik Wallin <henrik.wallin@windriver.com>
---
 gdb/common/agent.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gdb/common/agent.c b/gdb/common/agent.c
index 5c307290589d..c9b6c41bc4ff 100644
--- a/gdb/common/agent.c
+++ b/gdb/common/agent.c
@@ -73,9 +73,16 @@ static struct ipa_sym_addresses ipa_sym_addrs;
 
 static int all_agent_symbols_looked_up = 0;
 
+#ifdef GDBSERVER
+#include <inferiors.h>
+#endif
 int
 agent_loaded_p (void)
 {
+#ifdef GDBSERVER
+  if (current_thread == NULL)
+    return 0;
+#endif
   return all_agent_symbols_looked_up;
 }
 
-- 
2.1.4

  parent reply	other threads:[~2015-10-14 11:14 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-14 11:14 [RFC][PATCH 00/15] Fast tracepoint support for ARMv7 henrik.wallin
2015-10-14 11:14 ` [RFC][PATCH 02/15] Fix internal error when saving fast tracepoint definitions henrik.wallin
2015-10-15 17:19   ` Pedro Alves
2015-10-14 11:14 ` [RFC][PATCH 01/15] Fix endian problem for tracepoint enabled flag henrik.wallin
2015-10-15 17:16   ` Pedro Alves
2015-10-29 18:20     ` Wallin, Henrik
2015-10-14 11:14 ` henrik.wallin [this message]
2015-10-14 11:48   ` [RFC][PATCH 04/15] Fix crash in tstatus after detach Gary Benson
2015-10-29 18:45     ` Wallin, Henrik
2015-10-30 14:15       ` Gary Benson
2015-10-15 17:22   ` Pedro Alves
2015-10-29 18:31     ` Wallin, Henrik
2015-10-14 15:07 ` [RFC][PATCH 07/15] Fix mmap usage of MAP_FIXED for multiple pages henrik.wallin
2015-10-14 15:26   ` Andreas Schwab
2015-10-29 17:58     ` Wallin, Henrik
2015-10-14 15:07 ` [RFC][PATCH 05/15] Fix crash when tstart after detach henrik.wallin
2015-10-15 17:24   ` Pedro Alves
2015-10-14 15:07 ` [RFC][PATCH 08/15] gdbserver: Move pointer dereference to after assert checks henrik.wallin
2015-10-15 17:29   ` Pedro Alves
2015-10-29 19:01     ` Wallin, Henrik
2015-10-30  0:20       ` Antoine Tremblay
2015-10-30  5:25         ` Antoine Tremblay
2015-10-14 15:07 ` [RFC][PATCH 12/15] gdbserver: Add help functions to get arm/thumb mode henrik.wallin
2015-10-14 15:07 ` [RFC][PATCH 10/15] gdb: Add arm_fast_tracepoint_valid_at henrik.wallin
2015-10-27 13:36   ` Yao Qi
2015-10-29 22:36     ` Wallin, Henrik
2015-10-14 15:07 ` [RFC][PATCH 06/15] Add possibility to restart trace after tfind henrik.wallin
2015-10-15 17:26   ` Pedro Alves
2015-10-14 15:07 ` [RFC][PATCH 03/15] Fix crash in enable/disable after detach henrik.wallin
2015-10-15 16:30   ` Pedro Alves
2015-10-29 18:29     ` Wallin, Henrik
2015-10-14 15:08 ` [RFC][PATCH 15/15] gdb/gdbserver: Enable tracepoint for ARM henrik.wallin
2015-10-14 15:08 ` [RFC][PATCH 11/15] gdbserver: Add helper functions to create arm instructions henrik.wallin
2015-10-14 15:12 ` [RFC][PATCH 14/15] gdbserver: Add linux-arm-ipa.c henrik.wallin
2015-10-27 13:36   ` Yao Qi
2015-10-14 15:15 ` [RFC][PATCH 13/15] gdbserver: Add arm_install_fast_tracepoint_jump_pad henrik.wallin
2015-10-14 15:21 ` [RFC][PATCH 09/15] gdb: Add relocate instruction helpers henrik.wallin
2015-10-27 13:30   ` Yao Qi
2015-10-29 20:40     ` Wallin, Henrik
2015-11-20 18:06     ` Simon Marchi
2015-11-23 11:00       ` Yao Qi
2015-11-24 16:29         ` Simon Marchi
2015-10-27 13:23 ` [RFC][PATCH 00/15] Fast tracepoint support for ARMv7 Yao Qi
2015-10-30  1:52   ` Wallin, Henrik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=410dda80c8530a193308630ff74a456fadd4bc9e.1444820235.git.henrik.wallin@windriver.com \
    --to=henrik.wallin@windriver.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).