[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-arm] [PATCH v5 3/3] target/arm: Add the XML dynam
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [Qemu-arm] [PATCH v5 3/3] target/arm: Add the XML dynamic generation |
Date: |
Thu, 12 Apr 2018 10:55:24 +0100 |
On 4 April 2018 at 13:26, Alex Bennée <address@hidden> wrote:
>
> Abdallah Bouassida <address@hidden> writes:
>
>> Generate an XML description for the cp-regs.
>> Register these regs with the gdb_register_coprocessor().
>> Add arm_gdb_get_sysreg() to use it as a callback to read those regs.
>> Add a dummy arm_gdb_set_sysreg().
>>
>> Signed-off-by: Abdallah Bouassida <address@hidden>
>> ---
>> gdbstub.c | 10 ++++++++
>> include/qom/cpu.h | 5 +++-
>> target/arm/cpu.c | 1 +
>> target/arm/cpu.h | 26 +++++++++++++++++++
>> target/arm/gdbstub.c | 71
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++
>> target/arm/helper.c | 27 ++++++++++++++++++++
>> 6 files changed, 139 insertions(+), 1 deletion(-)
>>
>> diff --git a/gdbstub.c b/gdbstub.c
>> index f1d5148..09065bc 100644
>> --- a/gdbstub.c
>> +++ b/gdbstub.c
>> @@ -674,6 +674,16 @@ static const char *get_feature_xml(const char *p, const
>> char **newp,
>> }
>> return target_xml;
>> }
>> + if (cc->gdb_get_dynamic_xml) {
>> + CPUState *cpu = first_cpu;
>> + char *xmlname = g_strndup(p, len);
>> + const char *xml = cc->gdb_get_dynamic_xml(cpu, xmlname);
>> +
>> + free(xmlname);
>
> g_free for a g_strndup'ed string please - although I'm confused as to
> why you need to g_strdup the string. You already have p and its not like
> gdb_get_dynamic_xml couldn't dup the string if it needed to (which it
> doesn't seem to).
This is strndup, not strdup. p is not a NUL-terminated string,
so we're creating one to hand to the hook function rather than
requiring it to deal with a non-terminated string.
thanks
-- PMM