This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/6] gdbserver: Add debugging printf when setting last_resume_kind.
- From: Doug Evans <dje at google dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Wed, 18 Dec 2013 09:31:23 -0800
- Subject: Re: [PATCH 3/6] gdbserver: Add debugging printf when setting last_resume_kind.
- Authentication-results: sourceware.org; auth=none
- References: <yjt238lrup75 dot fsf at ruffy dot mtv dot corp dot google dot com> <52B18420 dot 5060303 at redhat dot com>
On Wed, Dec 18, 2013 at 3:16 AM, Pedro Alves <palves@redhat.com> wrote:
> On 12/17/2013 09:45 PM, Doug Evans wrote:
>> Hi.
>>
>> This patch adds a debugging printf to the setting of last_resume_kind
>> which I found useful while debugging 16168.
>>
>> 2013-12-17 Doug Evans <dje@google.com>
>>
>> * linux-low.c (resume_kind_to_str): New function.
>> (linux_set_resume_request): Add debugging printf when setting
>> last_resume_kind.
>>
>> ---
>> gdb/gdbserver/linux-low.c | 25 +++++++++++++++++++++++++
>> 1 file changed, 25 insertions(+)
>>
>> diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
>> index 464aaf0..3883e50 100644
>> --- a/gdb/gdbserver/linux-low.c
>> +++ b/gdb/gdbserver/linux-low.c
>> @@ -3301,6 +3301,24 @@ struct thread_resume_array
>> size_t n;
>> };
>>
>> +/* Return the string name of KIND. */
>> +
>> +static const char *
>> +resume_kind_to_str (enum resume_kind kind)
>> +{
>> + switch (kind)
>> + {
>> + case resume_continue:
>> + return "resume_continue";
>
> Can you do this with a macro please? See lynx-low.c:ptrace_request_to_str
> for example.
>
> OK with that change.
>
>> + case resume_step:
>> + return "resume_step";
>> + case resume_stop:
>> + return "resume_stop";
>> + default:
>> + gdb_assert_not_reached ("bad resume_kind");
>> + }
>> +}
>> +
For three values? Aren't we getting into over-engineering territory?