public inbox for rda@sourceware.org
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@redhat.com>
To: gdb-patches@sources.redhat.com, binutils@sources.redhat.com,
	rda@sources.redhat.com, Andrew Cagney <cagney@gnu.org>
Subject: [rfa] rda / samples: Allow multiple connections.
Date: Fri, 09 Jul 2004 20:05:00 -0000	[thread overview]
Message-ID: <40EEFA70.7040806@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 78 bytes --]

Allocate gdbserv_target only once, so that gdb can disconnect and reconnect.


[-- Attachment #2: diff4 --]
[-- Type: text/plain, Size: 1506 bytes --]

2004-07-09  Michael Snyder  <msnyder@redhat.com>

	* samples/demo-target.c (demo_target): Call malloc only once,
	so that gdb can detach and re-attach repeatedly.

Index: demo-target.c
===================================================================
RCS file: /cvs/cvsfiles/devo/rda/samples/demo-target.c,v
retrieving revision 1.19
diff -p -r1.19 demo-target.c
*** demo-target.c	21 Aug 2002 22:43:14 -0000	1.19
--- demo-target.c	9 Jul 2004 19:54:04 -0000
*************** static struct gdbserv* sole_connection =
*** 136,142 ****
  struct gdbserv_target *
  demo_target (struct gdbserv *serv, void *context)
  {
!   struct gdbserv_target *target;
  
    if (sole_connection != NULL)
      {
--- 161,167 ----
  struct gdbserv_target *
  demo_target (struct gdbserv *serv, void *context)
  {
!   static struct gdbserv_target *target = NULL;
  
    if (sole_connection != NULL)
      {
*************** demo_target (struct gdbserv *serv, void 
*** 147,153 ****
    fprintf (stderr, "Accepted gdb connection.\n");
    sole_connection = serv;
  
!   target = malloc (sizeof (struct gdbserv_target));
    memset (target, sizeof (*target), 0);
  
    /* Callback structure for function pointers that handle processed
--- 172,179 ----
    fprintf (stderr, "Accepted gdb connection.\n");
    sole_connection = serv;
  
!   if (target == NULL)
!     target = malloc (sizeof (struct gdbserv_target));
    memset (target, sizeof (*target), 0);
  
    /* Callback structure for function pointers that handle processed

                 reply	other threads:[~2004-07-09 20:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=40EEFA70.7040806@redhat.com \
    --to=msnyder@redhat.com \
    --cc=binutils@sources.redhat.com \
    --cc=cagney@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=rda@sources.redhat.com \
    /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).