This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[rfa] rda / samples: Allow multiple connections.
- From: Michael Snyder <msnyder at redhat dot com>
- To: gdb-patches at sources dot redhat dot com, binutils at sources dot redhat dot com, rda at sources dot redhat dot com, Andrew Cagney <cagney at gnu dot org>
- Date: Fri, 09 Jul 2004 20:05:04 +0000
- Subject: [rfa] rda / samples: Allow multiple connections.
- Organization: Red Hat, Inc.
Allocate gdbserv_target only once, so that gdb can disconnect and reconnect.
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