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 T, class Policy> class gdb::ref_ptr'
     = gdb::ref_ptr<thread_info, refcounted_object_ref_policy>;
							     ^
  ../../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 7aabaf9d4a
("Create private_thread_info hierarchy"), by adding an explicit
"struct" keyword.

gdb/ChangeLog:
2018-06-25  Pedro Alves  <palves@redhat.com>

	* 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.
This commit is contained in:
Pedro Alves 2018-06-25 17:18:18 +01:00
parent b7a08269ca
commit 75cbc781e3
3 changed files with 27 additions and 15 deletions

View File

@ -1,3 +1,15 @@
2018-06-25 Pedro Alves <palves@redhat.com>
* 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 <palves@redhat.com> 2018-06-25 Pedro Alves <palves@redhat.com>
* windows-nat.c (windows_delete_thread): Use find_thread_ptid and * windows-nat.c (windows_delete_thread): Use find_thread_ptid and

View File

@ -373,7 +373,7 @@ public:
/* A gdb::ref_ptr pointer to a thread_info. */ /* A gdb::ref_ptr pointer to a thread_info. */
using thread_info_ref using thread_info_ref
= gdb::ref_ptr<thread_info, refcounted_object_ref_policy>; = gdb::ref_ptr<struct thread_info, refcounted_object_ref_policy>;
/* Create an empty thread list, or empty the existing one. */ /* Create an empty thread list, or empty the existing one. */
extern void init_thread_list (void); 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 *); struct private_thread_info *);
/* Delete an existing thread list entry. */ /* 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 /* Delete an existing thread list entry, and be quiet about it. Used
after the process this thread having belonged to having already after the process this thread having belonged to having already
exited, for example. */ 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. */ /* Delete a step_resume_breakpoint from the thread database. */
extern void delete_step_resume_breakpoint (struct thread_info *); 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); struct inferior *inf);
/* Finds the first thread of the specified inferior. */ /* 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 /* Returns any thread of inferior INF, giving preference to the
current thread. */ 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 /* Returns any non-exited thread of inferior INF, giving preference to
the current thread, and to not executing threads. */ 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. */ /* Change the ptid of thread OLD_PTID to NEW_PTID. */
void thread_change_ptid (ptid_t old_ptid, ptid_t 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); extern int thread_count (void);
/* Switch context to thread THR. Also sets the STOP_PC global. */ /* 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. */ /* Switch context to no thread selected. */
extern void switch_to_no_thread (); extern void switch_to_no_thread ();
@ -660,7 +660,7 @@ class enable_thread_stack_temporaries
{ {
public: public:
explicit enable_thread_stack_temporaries (thread_info *thr) explicit enable_thread_stack_temporaries (struct thread_info *thr)
: m_thr (thr) : m_thr (thr)
{ {
gdb_assert (m_thr != NULL); gdb_assert (m_thr != NULL);
@ -683,17 +683,17 @@ public:
private: 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 *, 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. */ /* 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. /* Check whether it makes sense to access a register of THREAD at this point.
Returns true if registers may be accessed; false otherwise. */ 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 /* Returns whether to show which thread hit the breakpoint, received a
signal, etc. and ended up causing a user-visible stop. This is signal, etc. and ended up causing a user-visible stop. This is

View File

@ -177,7 +177,7 @@ extern void delete_longjmp_breakpoint_cleanup (void *arg);
extern void detach_command (const char *, int); 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, extern struct value *get_return_value (struct value *function,
struct type *value_type); struct type *value_type);