public inbox for rda@sourceware.org
 help / color / mirror / Atom feed
* [rfa] rda / samples: Allow multiple connections.
@ 2004-07-09 20:05 Michael Snyder
  0 siblings, 0 replies; only message in thread
From: Michael Snyder @ 2004-07-09 20:05 UTC (permalink / raw)
  To: gdb-patches, binutils, rda, Andrew Cagney

[-- 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-07-09 20:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-09 20:05 [rfa] rda / samples: Allow multiple connections Michael Snyder

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).