From 75cbc781e371279f4403045be93b07fd8fe7fde5 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 25 Jun 2018 17:18:18 +0100 Subject: [PATCH] gdb: For macOS, s/thread_info/struct thread_info/ The macOS build currently fails with several instances of this problem: In file included from ../../src/gdb/darwin-nat.h:22:0, from ../../src/gdb/i386-darwin-nat.c:37: ../../src/gdb/gdbthread.h:376:59: error: type/value mismatch at argument 1 in template parameter list for 'template class gdb::ref_ptr' = gdb::ref_ptr; ^ ../../src/gdb/gdbthread.h:376:59: note: expected a type, got 'thread_info' ../../src/gdb/gdbthread.h:396:28: error: variable or field 'delete_thread' declared void extern void delete_thread (thread_info *thread); ^ (...) This is because there's a thread_info function in the Darwin/XNU/mach API: http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_info.html Fix this in the same way it had been fixed in commit 7aabaf9d4ad5 ("Create private_thread_info hierarchy"), by adding an explicit "struct" keyword. gdb/ChangeLog: 2018-06-25 Pedro Alves * gdbthread.h (thread_info_ref, delete_thread) (delete_thread_silent, first_thread_of_inferior) (any_thread_of_inferior, switch_to_thread) (enable_thread_stack_temporaries) (thread_stack_temporaries_enabled_p, push_thread_stack_temporary) (get_last_thread_stack_temporary) (value_in_thread_stack_temporaries, can_access_registers_thread): Spell out "struct thread_info" instead of just "thread_info". * inferior.h (notice_new_inferior): Likewise. --- gdb/ChangeLog | 12 ++++++++++++ gdb/gdbthread.h | 28 ++++++++++++++-------------- gdb/inferior.h | 2 +- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4a3f7183a51..be8383eb0ac 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2018-06-25 Pedro Alves + + * gdbthread.h (thread_info_ref, delete_thread) + (delete_thread_silent, first_thread_of_inferior) + (any_thread_of_inferior, switch_to_thread) + (enable_thread_stack_temporaries) + (thread_stack_temporaries_enabled_p, push_thread_stack_temporary) + (get_last_thread_stack_temporary) + (value_in_thread_stack_temporaries, can_access_registers_thread): + Spell out "struct thread_info" instead of just "thread_info". + * inferior.h (notice_new_inferior): Likewise. + 2018-06-25 Pedro Alves * windows-nat.c (windows_delete_thread): Use find_thread_ptid and diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index bd5ab9193f9..ec607bb8c0d 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -373,7 +373,7 @@ public: /* A gdb::ref_ptr pointer to a thread_info. */ using thread_info_ref - = gdb::ref_ptr; + = gdb::ref_ptr; /* Create an empty thread list, or empty the existing one. */ extern void init_thread_list (void); @@ -393,12 +393,12 @@ extern struct thread_info *add_thread_with_info (ptid_t ptid, struct private_thread_info *); /* Delete an existing thread list entry. */ -extern void delete_thread (thread_info *thread); +extern void delete_thread (struct thread_info *thread); /* Delete an existing thread list entry, and be quiet about it. Used after the process this thread having belonged to having already exited, for example. */ -extern void delete_thread_silent (thread_info *thread); +extern void delete_thread_silent (struct thread_info *thread); /* Delete a step_resume_breakpoint from the thread database. */ extern void delete_step_resume_breakpoint (struct thread_info *); @@ -448,15 +448,15 @@ struct thread_info *find_thread_by_handle (struct value *thread_handle, struct inferior *inf); /* Finds the first thread of the specified inferior. */ -extern thread_info *first_thread_of_inferior (inferior *inf); +extern struct thread_info *first_thread_of_inferior (inferior *inf); /* Returns any thread of inferior INF, giving preference to the current thread. */ -extern thread_info *any_thread_of_inferior (inferior *inf); +extern struct thread_info *any_thread_of_inferior (inferior *inf); /* Returns any non-exited thread of inferior INF, giving preference to the current thread, and to not executing threads. */ -extern thread_info *any_live_thread_of_inferior (inferior *inf); +extern struct thread_info *any_live_thread_of_inferior (inferior *inf); /* Change the ptid of thread OLD_PTID to NEW_PTID. */ void thread_change_ptid (ptid_t old_ptid, ptid_t new_ptid); @@ -493,7 +493,7 @@ extern struct thread_info *iterate_over_threads (thread_callback_func, void *); extern int thread_count (void); /* Switch context to thread THR. Also sets the STOP_PC global. */ -extern void switch_to_thread (thread_info *thr); +extern void switch_to_thread (struct thread_info *thr); /* Switch context to no thread selected. */ extern void switch_to_no_thread (); @@ -660,7 +660,7 @@ class enable_thread_stack_temporaries { public: - explicit enable_thread_stack_temporaries (thread_info *thr) + explicit enable_thread_stack_temporaries (struct thread_info *thr) : m_thr (thr) { gdb_assert (m_thr != NULL); @@ -683,17 +683,17 @@ public: private: - thread_info *m_thr; + struct thread_info *m_thr; }; -extern bool thread_stack_temporaries_enabled_p (thread_info *tp); +extern bool thread_stack_temporaries_enabled_p (struct thread_info *tp); -extern void push_thread_stack_temporary (thread_info *tp, struct value *v); +extern void push_thread_stack_temporary (struct thread_info *tp, struct value *v); -extern value *get_last_thread_stack_temporary (thread_info *tp); +extern value *get_last_thread_stack_temporary (struct thread_info *tp); extern bool value_in_thread_stack_temporaries (struct value *, - thread_info *thr); + struct thread_info *thr); /* Add TP to the end of its inferior's pending step-over chain. */ @@ -723,7 +723,7 @@ extern void validate_registers_access (void); /* Check whether it makes sense to access a register of THREAD at this point. Returns true if registers may be accessed; false otherwise. */ -extern bool can_access_registers_thread (thread_info *thread); +extern bool can_access_registers_thread (struct thread_info *thread); /* Returns whether to show which thread hit the breakpoint, received a signal, etc. and ended up causing a user-visible stop. This is diff --git a/gdb/inferior.h b/gdb/inferior.h index 3f4d7a50d60..bfad91d9f3e 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -177,7 +177,7 @@ extern void delete_longjmp_breakpoint_cleanup (void *arg); extern void detach_command (const char *, int); -extern void notice_new_inferior (thread_info *, int, int); +extern void notice_new_inferior (struct thread_info *, int, int); extern struct value *get_return_value (struct value *function, struct type *value_type); -- 2.30.2