From patchwork Mon Mar 16 11:42:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 5626 Received: (qmail 62808 invoked by alias); 16 Mar 2015 11:42:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 62798 invoked by uid 89); 16 Mar 2015 11:42:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_50, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 16 Mar 2015 11:42:09 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2GBg6aX017809 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 16 Mar 2015 07:42:07 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2GBg5OC020271; Mon, 16 Mar 2015 07:42:06 -0400 Message-ID: <5506C18C.9080408@redhat.com> Date: Mon, 16 Mar 2015 11:42:04 +0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: asmwarrior , GDB Patches Subject: Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program References: <1423524046-20605-1-git-send-email-palves@redhat.com> <54F0B52F.1050909@redhat.com> <54FB20E2.2040403@redhat.com> <54FB3C58.6050702@redhat.com> <550660C5.2060009@gmail.com> <5506661C.1040103@gmail.com> In-Reply-To: <5506661C.1040103@gmail.com> On 03/16/2015 05:11 AM, asmwarrior wrote: > The patch below should fix this build error. > I just change the typedef name inside the windows-nat.c. > > > thread_info_windows.patch > > > 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; > Thanks! I realized I have a mingw cross compiler handy, so I indeed see this too. I wrote a ChangeLog entry and pushed your patch in, as below. I renamed the structure to windows_thread_info instead, as everything Windows target-specific in the file always uses windows_ as prefix, and gdbserver also names its equivalent structure with a "win32_" as prefix, not suffix. I also renamed the struct tag for consistency. --- From 876d1cd7b5899e7927e298a7f7344a0da48425a9 Mon Sep 17 00:00:00 2001 From: Yuanhui Zhang Date: Mon, 16 Mar 2015 11:31:31 +0000 Subject: [PATCH 1/3] windows-nat.c: conflicting declaration of struct thread_info in C++ mode Building mingw GDB with --enable-build-with-cxx shows: ../../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 ^ Simply rename the structure to avoid the conflict. gdb/ChangeLog: 2015-03-16 Yuanhui Zhang Pedro Alves * windows-nat.c (struct thread_info_struct): Rename to ... (struct windows_thread_info_struct): ... this. (thread_info): Rename to ... (windows_thread_info): ... this. All users updated. --- gdb/ChangeLog | 9 +++++++++ gdb/windows-nat.c | 42 +++++++++++++++++++++--------------------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 043b783..8828635 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2015-03-16 Yuanhui Zhang + Pedro Alves + + * windows-nat.c (struct thread_info_struct): Rename to ... + (struct windows_thread_info_struct): ... this. + (thread_info): Rename to ... + (windows_thread_info): ... this. + All users updated. + 2015-03-14 Jan Kratochvil Pedro Alves diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 42a6046..e5b28c1 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -177,9 +177,9 @@ static enum gdb_signal last_sig = GDB_SIGNAL_0; /* Thread information structure used to track information that is not available in gdb's thread structure. */ -typedef struct thread_info_struct +typedef struct windows_thread_info_struct { - struct thread_info_struct *next; + struct windows_thread_info_struct *next; DWORD id; HANDLE h; CORE_ADDR thread_local_base; @@ -189,16 +189,16 @@ typedef struct thread_info_struct CONTEXT context; STACKFRAME sf; } -thread_info; +windows_thread_info; -static thread_info thread_head; +static windows_thread_info 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 windows_thread_info *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 windows_thread_info * thread_rec (DWORD id, int get_context) { - thread_info *th; + windows_thread_info *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 windows_thread_info * windows_add_thread (ptid_t ptid, HANDLE h, void *tlb) { - thread_info *th; + windows_thread_info *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 (windows_thread_info); 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; + windows_thread_info *th = &thread_head; DEBUG_EVENTS (("gdb: windows_init_thread_list\n")); init_thread_list (); while (th->next != NULL) { - thread_info *here = th->next; + windows_thread_info *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; + windows_thread_info *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; + windows_thread_info *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; + windows_thread_info *th = current_thread; th->context.ContextFlags = CONTEXT_DEBUGGER_DR; CHECK (GetThreadContext (th->h, &th->context)); /* Copy dr values from that thread. @@ -983,7 +983,7 @@ display_selectors (char * args, int from_tty) static int handle_exception (struct target_waitstatus *ourstatus) { - thread_info *th; + windows_thread_info *th; DWORD code = current_event.u.Exception.ExceptionRecord.ExceptionCode; ourstatus->kind = TARGET_WAITKIND_STOPPED; @@ -1114,7 +1114,7 @@ static BOOL windows_continue (DWORD continue_status, int id, int killed) { int i; - thread_info *th; + windows_thread_info *th; BOOL res; DEBUG_EVENTS (("ContinueDebugEvent (cpid=%d, ctid=0x%x, %s);\n", @@ -1192,7 +1192,7 @@ static void windows_resume (struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal sig) { - thread_info *th; + windows_thread_info *th; DWORD continue_status = DBG_CONTINUE; /* A specific PTID means `step only this thread id'. */ @@ -1315,8 +1315,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; + windows_thread_info *th; + static windows_thread_info dummy_thread_info; int retval = 0; last_sig = GDB_SIGNAL_0; @@ -2450,7 +2450,7 @@ static int windows_get_tib_address (struct target_ops *self, ptid_t ptid, CORE_ADDR *addr) { - thread_info *th; + windows_thread_info *th; th = thread_rec (ptid_get_tid (ptid), 0); if (th == NULL)