This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 1/3] Constify thread name return path
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>, gdb-patches at sourceware dot org
- Date: Thu, 26 Nov 2015 11:21:28 +0000
- Subject: Re: [PATCH v2 1/3] Constify thread name return path
- Authentication-results: sourceware.org; auth=none
- References: <1448488138-2360-1-git-send-email-simon dot marchi at ericsson dot com> <1448488138-2360-2-git-send-email-simon dot marchi at ericsson dot com>
On 11/25/2015 09:48 PM, Simon Marchi wrote:
> Since this code path returns a string owned by the target (we don't know how
> it's allocated, could be a static read-only string), it's safer if we return
> a constant string. If, for some reasons, the caller wishes to modify the
> string, it should make itself a copy.
>
> gdb/ChangeLog:
>
> * linux-nat.c (linux_nat_thread_name): Constify return value.
> * target.h (struct target_ops) <to_thread_name>: Likewise.
> (target_thread_name): Likewise.
> * target.c (target_thread_name): Likewise.
> * target-delegates.c (debug_thread_name): Regenerate.
> * python/py-infthread.c (thpy_get_name): Constify local variables.
> * thread.c (print_thread_info): Likewise.
> (thread_find_command): Likewise.
OK.
Thanks,
Pedro Alves