bool supports_z_point_type (char z_type) override;
- void process_qsupported (char **features, int count) override;
+ void process_qsupported (gdb::array_view<const char * const> features) override;
bool supports_tracepoints () override;
PTRACE_GETREGSET. */
void
-x86_target::process_qsupported (char **features, int count)
+x86_target::process_qsupported (gdb::array_view<const char * const> features)
{
- int i;
-
/* Return if gdb doesn't support XML. If gdb sends "xmlRegisters="
with "i386" in qSupported query, it supports x86 XML target
descriptions. */
use_xml = 0;
- for (i = 0; i < count; i++)
- {
- const char *feature = features[i];
+ for (const char *feature : features)
+ {
if (startswith (feature, "xmlRegisters="))
{
char *copy = xstrdup (feature + 13);
free (copy);
}
}
+
update_xmltarget ();
}
';'. */
if (*p == ':')
{
- char **qsupported = NULL;
- int count = 0;
- int unknown = 0;
- int i;
+ std::vector<std::string> qsupported;
+ std::vector<const char *> unknowns;
/* Two passes, to avoid nested strtok calls in
target_process_qsupported. */
for (p = strtok_r (p + 1, ";", &saveptr);
p != NULL;
p = strtok_r (NULL, ";", &saveptr))
- {
- count++;
- qsupported = XRESIZEVEC (char *, qsupported, count);
- qsupported[count - 1] = xstrdup (p);
- }
+ qsupported.emplace_back (p);
- for (i = 0; i < count; i++)
+ for (const std::string &feature : qsupported)
{
- p = qsupported[i];
- if (strcmp (p, "multiprocess+") == 0)
+ if (feature == "multiprocess+")
{
/* GDB supports and wants multi-process support if
possible. */
if (target_supports_multi_process ())
cs.multi_process = 1;
}
- else if (strcmp (p, "qRelocInsn+") == 0)
+ else if (feature == "qRelocInsn+")
{
/* GDB supports relocate instruction requests. */
gdb_supports_qRelocInsn = 1;
}
- else if (strcmp (p, "swbreak+") == 0)
+ else if (feature == "swbreak+")
{
/* GDB wants us to report whether a trap is caused
by a software breakpoint and for us to handle PC
if (target_supports_stopped_by_sw_breakpoint ())
cs.swbreak_feature = 1;
}
- else if (strcmp (p, "hwbreak+") == 0)
+ else if (feature == "hwbreak+")
{
/* GDB wants us to report whether a trap is caused
by a hardware breakpoint. */
if (target_supports_stopped_by_hw_breakpoint ())
cs.hwbreak_feature = 1;
}
- else if (strcmp (p, "fork-events+") == 0)
+ else if (feature == "fork-events+")
{
/* GDB supports and wants fork events if possible. */
if (target_supports_fork_events ())
cs.report_fork_events = 1;
}
- else if (strcmp (p, "vfork-events+") == 0)
+ else if (feature == "vfork-events+")
{
/* GDB supports and wants vfork events if possible. */
if (target_supports_vfork_events ())
cs.report_vfork_events = 1;
}
- else if (strcmp (p, "exec-events+") == 0)
+ else if (feature == "exec-events+")
{
/* GDB supports and wants exec events if possible. */
if (target_supports_exec_events ())
cs.report_exec_events = 1;
}
- else if (strcmp (p, "vContSupported+") == 0)
+ else if (feature == "vContSupported+")
cs.vCont_supported = 1;
- else if (strcmp (p, "QThreadEvents+") == 0)
+ else if (feature == "QThreadEvents+")
;
- else if (strcmp (p, "no-resumed+") == 0)
+ else if (feature == "no-resumed+")
{
/* GDB supports and wants TARGET_WAITKIND_NO_RESUMED
events. */
else
{
/* Move the unknown features all together. */
- qsupported[i] = NULL;
- qsupported[unknown] = p;
- unknown++;
+ unknowns.push_back (feature.c_str ());
}
}
/* Give the target backend a chance to process the unknown
features. */
- target_process_qsupported (qsupported, unknown);
-
- for (i = 0; i < count; i++)
- free (qsupported[i]);
- free (qsupported);
+ target_process_qsupported (unknowns);
}
sprintf (own_buf,
#include "target/wait.h"
#include "target/waitstatus.h"
#include "mem-break.h"
+#include "gdbsupport/array-view.h"
#include "gdbsupport/btrace-common.h"
#include <vector>
unsigned char *myaddr, unsigned int len);
/* Target specific qSupported support. FEATURES is an array of
- features with COUNT elements. */
- virtual void process_qsupported (char **features, int count);
+ features unsupported by the core of GDBserver. */
+ virtual void process_qsupported
+ (gdb::array_view<const char * const> features);
/* Return true if the target supports tracepoints, false otherwise. */
virtual bool supports_tracepoints ();
#define target_async(enable) \
the_target->async (enable)
-#define target_process_qsupported(features, count) \
- the_target->process_qsupported (features, count)
+#define target_process_qsupported(features) \
+ the_target->process_qsupported (features)
#define target_supports_catch_syscall() \
the_target->supports_catch_syscall ()