From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98106 invoked by alias); 18 May 2017 08:56:14 -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 98073 invoked by uid 89); 18 May 2017 08:56:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-19.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=5657, Hx-languages-length:5922 X-HELO: smtp.CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE (HELO smtp.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 18 May 2017 08:56:07 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 688176A2 for ; Thu, 18 May 2017 10:56:07 +0200 (CEST) Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id kEPpLO-eYxdd for ; Thu, 18 May 2017 10:56:03 +0200 (CEST) Received: from lokon.CeBiTec.Uni-Bielefeld.DE (lokon.CeBiTec.Uni-Bielefeld.DE [129.70.161.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 514CE6A1 for ; Thu, 18 May 2017 10:56:03 +0200 (CEST) Received: (from ro@localhost) by lokon.CeBiTec.Uni-Bielefeld.DE (8.15.2+Sun/8.15.2/Submit) id v4I8u3h7006388; Thu, 18 May 2017 10:56:03 +0200 (MEST) From: Rainer Orth To: gdb-patches@sourceware.org Subject: Fix tui compilation with Solaris libcurses (PR tui/21482) Date: Thu, 18 May 2017 08:56:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (usg-unix-v) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SW-Source: 2017-05/txt/msg00410.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 3789 On both mainline and the 8.0 branch, gdb compilation fails on Solaris 10 with the native libcurses: * Initially, compilation failed like this: In file included from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/gdb_curses.= h:42: 0, from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-dat= a.h:2 6, from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-dis= asm.c :31: /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-disasm.c: In function =E2= =80=98CORE_A DDR tui_disassemble(gdbarch*, tui_asm_line*, CORE_ADDR, int)=E2=80=99: /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-disasm.c:71:19: error: = =E2=80=98class string_file=E2=80=99 has no member named =E2=80=98wclear=E2=80=99; did you= mean =E2=80=98clear=E2=80=99? gdb_dis_out.clear (); ^ /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-disasm.c:78:19: error: = =E2=80=98class string_file=E2=80=99 has no member named =E2=80=98wclear=E2=80=99; did you= mean =E2=80=98clear=E2=80=99? gdb_dis_out.clear (); ^ make[2]: *** [Makefile:1927: tui-disasm.o] Error 1 It turned out this happens because has #define clear() wclear(stdscr) This can be avoided by defining NOMACROS, which the patch below does for solaris2.*. * Even with this workaround, compilation fails in gdb/tui for several instances of the same problem: /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-winsource.c: In function = =E2=80=98void tui_erase_source_content(tui_win_info*, int)=E2=80=99: /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-winsource.c:257:18: error= : invalid conversion from =E2=80=98const char*=E2=80=99 to =E2=80=98char*= =E2=80=99 [-fpermissive] no_src_str); ^ In file included from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/gdb_curses.= h:42:0, from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-dat= a.h:26, from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-win= source.c:33: /vol/gcc-7/lib/gcc/sparc-sun-solaris2.10/7.1.0/include-fixed/curses.h:699:1= 2: note: initializing argument 4 of =E2=80=98int mvwaddstr(WINDOW*, int, = int, char*)=E2=80=99 extern int mvwaddstr(WINDOW *, int, int, char *); ^~~~~~~~~ make[2]: *** [Makefile:1927: tui-winsource.o] Error 1 Unlike ncurses, declares=20 extern int mvwaddstr(WINDOW *, int, int, char *); i.e. the last arg is char *, not const char *. The patch fixes this by casting the last arg to mvwaddstr to char *, as was recently done on mainline in a newterm() call (the only difference between 8.0 and mainline gdb/tui). With those changes, gdb on the 8.0 branch compiles cleanly on sparcv9-sun-solaris2.10 with native curses and amd64-pc-solaris2.12 with bundled ncurses (well, almost: on Solaris 12 ncurses in /usr/include is used, but gdb linked against -lcurses which fails: Undefined first referenced symbol in file wattr_on tui-wingeneral.o wattr_off tui-wingeneral.o but that's a different and preexisting problem). Ok for mainline and 8.0 branch? Rainer --=20 ---------------------------------------------------------------------------= -- Rainer Orth, Center for Biotechnology, Bielefeld University 2017-05-17 Rainer Orth PR tui/21482 * configure.ac (NOMACROS): Define. * configure: Regenerate. * config.in: Regenerate. * tui/tui-windata.c (tui_erase_data_content): Cast last mvwaddstr to char *. * tui/tui-wingeneral.c (box_win): Likewise. * tui/tui-winsource.c (tui_erase_source_content): Likewise. (tui_show_source_line): Likewise. (tui_show_exec_info_content): Likewise. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=sol2-gdb-tui-curses.patch Content-length: 2772 # HG changeset patch # Parent bfb43bbf7ca9808a9e660c111b68eef77999e76c Fix tui compilation with Solaris libcurses (PR tui/21482) diff --git a/gdb/configure.ac b/gdb/configure.ac --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1312,6 +1312,14 @@ case $host_os in Solaris 2.[789] when using GCC. ]) fi ;; esac +# On Solaris, we need to define NOMACROS so the native doesn't +# define clear which interferes with the clear member of class string_file. +case $host_os in + solaris2.*) + AC_DEFINE(NOMACROS, 1, + [Define to 1 to avoid defining clear which interferes with class string_file. ]) + ;; +esac AC_CHECK_HEADERS(curses.h cursesX.h ncurses.h ncurses/ncurses.h ncurses/term.h) AC_CHECK_HEADERS(term.h, [], [], [#if HAVE_CURSES_H diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c --- a/gdb/tui/tui-windata.c +++ b/gdb/tui/tui-windata.c @@ -117,7 +117,7 @@ tui_erase_data_content (const char *prom mvwaddstr (TUI_DATA_WIN->generic.handle, (TUI_DATA_WIN->generic.height / 2), x_pos, - prompt); + (char *) prompt); } wrefresh (TUI_DATA_WIN->generic.handle); } diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c --- a/gdb/tui/tui-wingeneral.c +++ b/gdb/tui/tui-wingeneral.c @@ -101,7 +101,7 @@ box_win (struct tui_gen_win_info *win_in box (win, tui_border_vline, tui_border_hline); #endif if (win_info->title) - mvwaddstr (win, 0, 3, win_info->title); + mvwaddstr (win, 0, 3, (char *) win_info->title); wattroff (win, attrs); } } diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -254,7 +254,7 @@ tui_erase_source_content (struct tui_win mvwaddstr (win_info->generic.handle, (win_info->generic.height / 2), x_pos, - no_src_str); + (char *) no_src_str); /* elz: Added this function call to set the real contents of the window to what is on the screen, so that later calls @@ -280,7 +280,7 @@ tui_show_source_line (struct tui_win_inf wattron (win_info->generic.handle, A_STANDOUT); mvwaddstr (win_info->generic.handle, lineno, 1, - line->which_element.source.line); + (char *) line->which_element.source.line); if (line->which_element.source.is_exec_point) wattroff (win_info->generic.handle, A_STANDOUT); @@ -565,7 +565,8 @@ tui_show_exec_info_content (struct tui_w mvwaddstr (exec_info->handle, cur_line, 0, - exec_info->content[cur_line - 1]->which_element.simple_string); + (char *) exec_info->content[cur_line - 1] + ->which_element.simple_string); tui_refresh_win (exec_info); exec_info->content_in_use = TRUE; } --=-=-=--