This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program
- From: asmwarrior <asmwarrior at gmail dot com>
- To: Pedro Alves <palves at redhat dot com>, GDB Patches <gdb-patches at sourceware dot org>
- Date: Mon, 16 Mar 2015 13:11:56 +0800
- Subject: Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program
- Authentication-results: sourceware.org; auth=none
- References: <1423524046-20605-1-git-send-email-palves at redhat dot com> <54F0B52F dot 1050909 at redhat dot com> <54FB20E2 dot 2040403 at redhat dot com> <54FB3C58 dot 6050702 at redhat dot com> <550660C5 dot 2060009 at gmail dot com>
On 2015-3-16 12:49, asmwarrior wrote:
> On 2015-3-8 1:58, Pedro Alves wrote:
>> At this point, I'd like to invite others to try out --enable-build-with-cxx
>> on others hosts, and send in fixes for any errors that stumbles on.
>
> I tested it today on msys + mingw4.8 32bit, and I get a build error:
>
> .../../binutils-gdb/gdb/windows-nat.c: At global scope:
> .../../binutils-gdb/gdb/windows-nat.c:192:1: error: conflicting declaration 'typedef struct thread_info_struct thread_info'
> thread_info;
> ^
> In file included from ../../binutils-gdb/gdb/windows-nat.c:52:0:
> .../../binutils-gdb/gdb/gdbthread.h:160:8: error: 'struct thread_info' has a previous declaration as 'struct thread_info'
> struct thread_info
> ^
> It looks like windows-nat.c has its own thread_info which should overwrite the one in gdbthread.h, but I don't know how to fix it right now.
> Any ideas?
>
> Yuanhui Zhang
>
>
The patch below should fix this build error.
I just change the typedef name inside the windows-nat.c.
gdb/windows-nat.c | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 49c09d3..f812a2c 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -189,16 +189,16 @@ typedef struct thread_info_struct
CONTEXT context;
STACKFRAME sf;
}
-thread_info;
+thread_info_windows;
-static thread_info thread_head;
+static thread_info_windows thread_head;
/* The process and thread handles for the above context. */
static DEBUG_EVENT current_event; /* The current debug event from
WaitForDebugEvent */
static HANDLE current_process_handle; /* Currently executing process */
-static thread_info *current_thread; /* Info on currently selected thread */
+static thread_info_windows *current_thread; /* Info on currently selected thread */
static DWORD main_thread_id; /* Thread ID of the main thread */
/* Counts of things. */
@@ -291,10 +291,10 @@ check (BOOL ok, const char *file, int line)
/* Find a thread record given a thread id. If GET_CONTEXT is not 0,
then also retrieve the context for this thread. If GET_CONTEXT is
negative, then don't suspend the thread. */
-static thread_info *
+static thread_info_windows *
thread_rec (DWORD id, int get_context)
{
- thread_info *th;
+ thread_info_windows *th;
for (th = &thread_head; (th = th->next) != NULL;)
if (th->id == id)
@@ -331,10 +331,10 @@ thread_rec (DWORD id, int get_context)
}
/* Add a thread to the thread list. */
-static thread_info *
+static thread_info_windows *
windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
{
- thread_info *th;
+ thread_info_windows *th;
DWORD id;
gdb_assert (ptid_get_tid (ptid) != 0);
@@ -344,7 +344,7 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
if ((th = thread_rec (id, FALSE)))
return th;
- th = XCNEW (thread_info);
+ th = XCNEW (thread_info_windows);
th->id = id;
th->h = h;
th->thread_local_base = (CORE_ADDR) (uintptr_t) tlb;
@@ -374,13 +374,13 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
static void
windows_init_thread_list (void)
{
- thread_info *th = &thread_head;
+ thread_info_windows *th = &thread_head;
DEBUG_EVENTS (("gdb: windows_init_thread_list\n"));
init_thread_list ();
while (th->next != NULL)
{
- thread_info *here = th->next;
+ thread_info_windows *here = th->next;
th->next = here->next;
xfree (here);
}
@@ -391,7 +391,7 @@ windows_init_thread_list (void)
static void
windows_delete_thread (ptid_t ptid, DWORD exit_code)
{
- thread_info *th;
+ thread_info_windows *th;
DWORD id;
gdb_assert (ptid_get_tid (ptid) != 0);
@@ -412,7 +412,7 @@ windows_delete_thread (ptid_t ptid, DWORD exit_code)
if (th->next != NULL)
{
- thread_info *here = th->next;
+ thread_info_windows *here = th->next;
th->next = here->next;
xfree (here);
}
@@ -446,7 +446,7 @@ do_windows_fetch_inferior_registers (struct regcache *regcache, int r)
else
#endif
{
- thread_info *th = current_thread;
+ thread_info_windows *th = current_thread;
th->context.ContextFlags = CONTEXT_DEBUGGER_DR;
CHECK (GetThreadContext (th->h, &th->context));
/* Copy dr values from that thread.
@@ -1080,7 +1080,7 @@ display_selectors (char * args, int from_tty)
static int
handle_exception (struct target_waitstatus *ourstatus)
{
- thread_info *th;
+ thread_info_windows *th;
DWORD code = current_event.u.Exception.ExceptionRecord.ExceptionCode;
ourstatus->kind = TARGET_WAITKIND_STOPPED;
@@ -1211,7 +1211,7 @@ static BOOL
windows_continue (DWORD continue_status, int id, int killed)
{
int i;
- thread_info *th;
+ thread_info_windows *th;
BOOL res;
DEBUG_EVENTS (("ContinueDebugEvent (cpid=%d, ctid=0x%x, %s);\n",
@@ -1289,7 +1289,7 @@ static void
windows_resume (struct target_ops *ops,
ptid_t ptid, int step, enum gdb_signal sig)
{
- thread_info *th;
+ thread_info_windows *th;
DWORD continue_status = DBG_CONTINUE;
/* A specific PTID means `step only this thread id'. */
@@ -1412,8 +1412,8 @@ get_windows_debug_event (struct target_ops *ops,
{
BOOL debug_event;
DWORD continue_status, event_code;
- thread_info *th;
- static thread_info dummy_thread_info;
+ thread_info_windows *th;
+ static thread_info_windows dummy_thread_info;
int retval = 0;
last_sig = GDB_SIGNAL_0;
@@ -2551,7 +2551,7 @@ static int
windows_get_tib_address (struct target_ops *self,
ptid_t ptid, CORE_ADDR *addr)
{
- thread_info *th;
+ thread_info_windows *th;
th = thread_rec (ptid_get_tid (ptid), 0);
if (th == NULL)