From: "H.J. Lu" <hjl.tools@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>, GDB <gdb-patches@sourceware.org>
Subject: Re: RFC: Support target specific qSupported
Date: Wed, 03 Feb 2010 16:44:00 -0000 [thread overview]
Message-ID: <6dc9ffc81002030844h3d6cc2b5ye67c79d52defdce5@mail.gmail.com> (raw)
In-Reply-To: <20100203152350.GA1580@caradoc.them.org>
[-- Attachment #1: Type: text/plain, Size: 479 bytes --]
On Wed, Feb 3, 2010 at 7:23 AM, Daniel Jacobowitz <dan@codesourcery.com> wrote:
> On Wed, Feb 03, 2010 at 07:08:26AM -0800, H.J. Lu wrote:
>> How about this patch? It allows a target to add a field to qSupported.
>
> There are big comments at the top of gdbarch.c and gdbarch.h that
> point at gdbarch.sh. They are generated files. Also, please
> call XXXX instead of XXX. Otherwise, it looks fine, though.
>
This is the patch I checked in.
Thanks.
--
H.J.
[-- Attachment #2: gdb-qsupported-3.patch --]
[-- Type: text/plain, Size: 5156 bytes --]
2010-02-03 H.J. Lu <hongjiu.lu@intel.com>
* gdbarch.sh: Add qsupported.
* gdbarch.c: Regenerated.
* gdbarch.h: Likewise.
* remote.c (remote_state): Add gdbarch.
(init_remote_state): Set gdbarch.
(remote_query_supported): Support gdbarch_qsupported.
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 6448fc3..cfb042b 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -252,6 +252,7 @@ struct gdbarch
int has_global_breakpoints;
gdbarch_has_shared_address_space_ftype *has_shared_address_space;
gdbarch_fast_tracepoint_valid_at_ftype *fast_tracepoint_valid_at;
+ const char * qsupported;
};
@@ -395,6 +396,7 @@ struct gdbarch startup_gdbarch =
0, /* has_global_breakpoints */
default_has_shared_address_space, /* has_shared_address_space */
default_fast_tracepoint_valid_at, /* fast_tracepoint_valid_at */
+ 0, /* qsupported */
/* startup_gdbarch() */
};
@@ -661,6 +663,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of has_global_breakpoints, invalid_p == 0 */
/* Skip verify of has_shared_address_space, invalid_p == 0 */
/* Skip verify of fast_tracepoint_valid_at, invalid_p == 0 */
+ /* Skip verify of qsupported, invalid_p == 0 */
buf = ui_file_xstrdup (log, &length);
make_cleanup (xfree, buf);
if (length > 0)
@@ -1035,6 +1038,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: push_dummy_code = <%s>\n",
host_address_to_string (gdbarch->push_dummy_code));
fprintf_unfiltered (file,
+ "gdbarch_dump: qsupported = %s\n",
+ gdbarch->qsupported);
+ fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_read_pc_p() = %d\n",
gdbarch_read_pc_p (gdbarch));
fprintf_unfiltered (file,
@@ -3576,6 +3582,23 @@ set_gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch,
gdbarch->fast_tracepoint_valid_at = fast_tracepoint_valid_at;
}
+const char *
+gdbarch_qsupported (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ /* Skip verify of qsupported, invalid_p == 0 */
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_qsupported called\n");
+ return gdbarch->qsupported;
+}
+
+void
+set_gdbarch_qsupported (struct gdbarch *gdbarch,
+ const char * qsupported)
+{
+ gdbarch->qsupported = qsupported;
+}
+
/* Keep a registry of per-architecture data-pointers required by GDB
modules. */
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 661d34b..1353ab1 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -923,6 +923,11 @@ typedef int (gdbarch_fast_tracepoint_valid_at_ftype) (struct gdbarch *gdbarch, C
extern int gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr, int *isize, char **msg);
extern void set_gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch, gdbarch_fast_tracepoint_valid_at_ftype *fast_tracepoint_valid_at);
+/* Not NULL if a target has additonal field for qSupported. */
+
+extern const char * gdbarch_qsupported (struct gdbarch *gdbarch);
+extern void set_gdbarch_qsupported (struct gdbarch *gdbarch, const char * qsupported);
+
/* Definition for an unknown syscall, used basically in error-cases. */
#define UNKNOWN_SYSCALL (-1)
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index e1d3ff5..0eaa0ef 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -766,6 +766,9 @@ m:int:has_shared_address_space:void:::default_has_shared_address_space::0
# True if a fast tracepoint can be set at an address.
m:int:fast_tracepoint_valid_at:CORE_ADDR addr, int *isize, char **msg:addr, isize, msg::default_fast_tracepoint_valid_at::0
+
+# Not NULL if a target has additonal field for qSupported.
+v:const char *:qsupported:::0:0::0:gdbarch->qsupported
EOF
}
diff --git a/gdb/remote.c b/gdb/remote.c
index bf7568c..2c3dfdb 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -327,6 +327,9 @@ struct remote_state
/* Nonzero if the user has pressed Ctrl-C, but the target hasn't
responded to that. */
int ctrlc_pending_p;
+
+ /* GDBARCH associated with this target. */
+ struct gdbarch *gdbarch;
};
/* Private data that we'll store in (struct thread_info)->private. */
@@ -566,6 +569,9 @@ init_remote_state (struct gdbarch *gdbarch)
rs->buf = xrealloc (rs->buf, rs->buf_size);
}
+ /* Record our GDBARCH. */
+ rs->gdbarch = gdbarch;
+
return rsa;
}
@@ -3475,10 +3481,24 @@ remote_query_supported (void)
rs->buf[0] = 0;
if (remote_protocol_packets[PACKET_qSupported].support != PACKET_DISABLE)
{
- if (rs->extended)
- putpkt ("qSupported:multiprocess+");
+ const char *qsupported = gdbarch_qsupported (rs->gdbarch);
+ if (qsupported)
+ {
+ char *q;
+ if (rs->extended)
+ q = concat ("qSupported:multiprocess+;", qsupported, NULL);
+ else
+ q = concat ("qSupported:", qsupported, NULL);
+ putpkt (q);
+ xfree (q);
+ }
else
- putpkt ("qSupported");
+ {
+ if (rs->extended)
+ putpkt ("qSupported:multiprocess+");
+ else
+ putpkt ("qSupported");
+ }
getpkt (&rs->buf, &rs->buf_size, 0);
next prev parent reply other threads:[~2010-02-03 16:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-03 4:03 H.J. Lu
2010-02-03 7:04 ` Hui Zhu
2010-02-03 13:59 ` Daniel Jacobowitz
2010-02-03 14:05 ` H.J. Lu
2010-02-03 14:15 ` Tristan Gingold
2010-02-03 14:26 ` H.J. Lu
2010-02-03 14:22 ` Daniel Jacobowitz
2010-02-03 14:34 ` H.J. Lu
2010-02-03 14:46 ` Daniel Jacobowitz
2010-02-03 15:08 ` H.J. Lu
2010-02-03 15:31 ` Daniel Jacobowitz
[not found] ` <20100203152350.GA1580@caradoc.them.org>
2010-02-03 16:44 ` H.J. Lu [this message]
2010-02-03 17:57 ` Daniel Jacobowitz
2010-02-03 18:31 ` H.J. Lu
2010-02-03 18:59 ` H.J. Lu
2010-02-03 19:03 ` Daniel Jacobowitz
2010-02-03 19:06 ` H.J. Lu
2010-02-03 19:17 ` Daniel Jacobowitz
2010-02-03 19:09 ` Mark Kettenis
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=6dc9ffc81002030844h3d6cc2b5ye67c79d52defdce5@mail.gmail.com \
--to=hjl.tools@gmail.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