This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: PATCH: Add xmlRegisters= to qsupported query
On Sunday 28 March 2010 21:52:07, H.J. Lu wrote:
> const char *qsupported = gdbarch_qsupported (target_gdbarch);
> - if (qsupported)
> + if (qsupported || remote_support_xml)
> {
> - char *q;
> + char *q, *x;
> + char *p = NULL;
> + const char *m;
> +
> if (rs->extended)
> - q = concat ("qSupported:multiprocess+;", qsupported, NULL);
> + m = "multiprocess+;";
> else
> - q = concat ("qSupported:", qsupported, NULL);
> + m = "";
> +
> + if (remote_support_xml)
> + {
> + if (qsupported)
> + p = concat ("xmlRegisters=", remote_support_xml,
> + ";", NULL);
> + else
> + p = concat ("xmlRegisters=", remote_support_xml, NULL);
> + x = p;
> + }
> + else
> + x = "";
> +
> + q = concat ("qSupported:", m, x,
> + qsupported ? qsupported : "",
> + NULL);
> putpkt (q);
> + if (p)
> + xfree (p);
> xfree (q);
There's some hair here for handling gdbarch_qsupported, but,
is it going to end up used at all? It isn't used today.
[personaly, I'd try to write the above in a way that avoids all
this if/then/if/then/else/else nesting everytime a few
qSupported feature is added.]
--
Pedro Alves