From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92729 invoked by alias); 16 Mar 2015 08:20:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 92713 invoked by uid 89); 16 Mar 2015 08:20:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_FROM_URIBL_PCCC,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-pd0-f178.google.com Received: from mail-pd0-f178.google.com (HELO mail-pd0-f178.google.com) (209.85.192.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 16 Mar 2015 08:19:58 +0000 Received: by pdbni2 with SMTP id ni2so51828880pdb.1 for ; Mon, 16 Mar 2015 01:19:57 -0700 (PDT) X-Received: by 10.70.108.232 with SMTP id hn8mr28724329pdb.68.1426493997126; Mon, 16 Mar 2015 01:19:57 -0700 (PDT) Received: from [192.168.1.104] ([115.199.128.78]) by mx.google.com with ESMTPSA id z6sm15884927pdm.78.2015.03.16.01.19.48 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Mar 2015 01:19:55 -0700 (PDT) Message-ID: <550693AB.60007@gmail.com> Date: Mon, 16 Mar 2015 08:20:00 -0000 From: asmwarrior User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Pedro Alves , 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> <55066A29.8090200@gmail.com> <55068495.5040205@gmail.com> In-Reply-To: <55068495.5040205@gmail.com> Content-Type: multipart/mixed; boundary="------------010504000701050709090106" X-SW-Source: 2015-03/txt/msg00441.txt.bz2 This is a multi-part message in MIME format. --------------010504000701050709090106 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 618 OK, I now successfully build gdb.exe and gdbserver.exe! To handle the INT32_MAX and INT32_MIN macro definition issue, I just have: #ifndef INT32_MIN #define INT32_MIN INT_MIN #endif #ifndef INT32_MAX #define INT32_MAX INT_MAX #endif Before #if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX) # error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to ." #endif In either: mybuildcpp\gdb\gdbserver\build-gnulib-gdbserver\import\inttypes.h and mybuildcpp\gdb\build-gnulib\import\inttypes.h The total patch I use is in attachment. Yuanhui Zhang --------------010504000701050709090106 Content-Type: text/x-c++; name="0001-build-fix-when-using-enable-build-with-cxx-option-un.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-build-fix-when-using-enable-build-with-cxx-option-un.pa"; filename*1="tch" Content-length: 6747 >From d0a34a8b8491f3aae0a7e13e6a5f0a1969aac1dd Mon Sep 17 00:00:00 2001 From: asmwarrior Date: Mon, 16 Mar 2015 16:23:38 +0800 Subject: [PATCH] build fix when using --enable-build-with-cxx option under MinGW. --- gdb/gdb_curses.h | 2 +- gdb/stub-termcap.c | 22 ++++++++++++++-------- gdb/windows-nat.c | 38 +++++++++++++++++++------------------- 3 files changed, 34 insertions(+), 28 deletions(-) diff --git a/gdb/gdb_curses.h b/gdb/gdb_curses.h index 9b3707a..d02cab3 100644 --- a/gdb/gdb_curses.h +++ b/gdb/gdb_curses.h @@ -51,7 +51,7 @@ of the termcap functions will be built from stub-termcap.c. Readline provides its own extern declarations when there's no termcap.h; do the same here for the termcap functions used in GDB. */ -extern int tgetnum (const char *); +extern "C" int tgetnum (const char *); #endif /* SunOS's curses.h has a '#define reg register' in it. Thank you Sun. */ diff --git a/gdb/stub-termcap.c b/gdb/stub-termcap.c index cc8632c..a2e833a 100644 --- a/gdb/stub-termcap.c +++ b/gdb/stub-termcap.c @@ -23,14 +23,20 @@ #include "defs.h" #include - +#ifdef __cplusplus +extern "C" { +#endif /* -Wmissing-prototypes */ -extern int tgetent (char *buffer, char *termtype); -extern int tgetnum (char *name); -extern int tgetflag (char *name); -extern char* tgetstr (char *name, char **area); -extern int tputs (char *string, int nlines, int (*outfun) ()); -extern char *tgoto (const char *cap, int col, int row); +int tgetent (char *buffer, char *termtype); +int tgetnum (char *name); +int tgetflag (char *name); +char* tgetstr (char *name, char **area); +int tputs (char *string, int nlines, int (*outfun) (char *)); +char *tgoto (const char *cap, int col, int row); +#ifdef __cplusplus +} +#endif + /* Each of the files below is a minimal implementation of the standard termcap function with the same name, suitable for use in a Windows @@ -61,7 +67,7 @@ tgetstr (char *name, char **area) } int -tputs (char *string, int nlines, int (*outfun) ()) +tputs (char *string, int nlines, int (*outfun) (char *)) { while (*string) outfun (*string++); 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) -- 1.9.5.msysgit.0 --------------010504000701050709090106--