summaryrefslogtreecommitdiff
path: root/gdb/thread.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2015-11-26 09:49:03 -0500
committerSimon Marchi <simon.marchi@ericsson.com>2015-11-26 09:49:03 -0500
commit73ede76585a987a07fbd67a7474b193e4ca05517 (patch)
treede94daac963b3cb4d15f84701db204ff6e42d69b /gdb/thread.c
parent46a3515b49ce30315e2b621525b29cd8263aed15 (diff)
downloadbinutils-gdb-73ede76585a987a07fbd67a7474b193e4ca05517.tar.gz
Constify thread name return path
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.
Diffstat (limited to 'gdb/thread.c')
-rw-r--r--gdb/thread.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/thread.c b/gdb/thread.c
index b47d9901a8b..f8103bd5318 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -1122,7 +1122,7 @@ print_thread_info (struct ui_out *uiout, char *requested_threads, int pid)
struct thread_info *tp;
ptid_t current_ptid;
struct cleanup *old_chain;
- char *extra_info, *name, *target_id;
+ const char *extra_info, *name, *target_id;
int current_thread = -1;
update_thread_list ();
@@ -1781,7 +1781,7 @@ static void
thread_find_command (char *arg, int from_tty)
{
struct thread_info *tp;
- char *tmp;
+ const char *tmp;
unsigned long match = 0;
if (arg == NULL || *arg == '\0')