From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36904 invoked by alias); 28 Mar 2015 07:13:47 -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 36889 invoked by uid 89); 28 Mar 2015 07:13:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: smtp.gentoo.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 28 Mar 2015 07:13:44 +0000 Received: from vapier (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with SMTP id 73ED4340A5E; Sat, 28 Mar 2015 07:13:42 +0000 (UTC) Date: Sat, 28 Mar 2015 07:13:00 -0000 From: Mike Frysinger To: Jiri Gaisler Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v4 06/13] sim/erc32: Use gdb callback for UART I/O when linked with gdb. Message-ID: <20150328071342.GJ30239@vapier> Mail-Followup-To: Jiri Gaisler , gdb-patches@sourceware.org References: <1426626170-21401-1-git-send-email-jiri@gaisler.se> <1426626170-21401-7-git-send-email-jiri@gaisler.se> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="gBYU9MM4gf8jKg2V" Content-Disposition: inline In-Reply-To: <1426626170-21401-7-git-send-email-jiri@gaisler.se> X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00935.txt.bz2 --gBYU9MM4gf8jKg2V Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 4159 On 17 Mar 2015 22:02, Jiri Gaisler wrote: > Use the host_callback feature for printing when linked with gdb. please write ChangeLog entries > if (dumbio) > return; /* do nothing */ > - if (!ifd1) > + if (ifd1 =3D=3D 0 && f1open) { > tcsetattr(0, TCSANOW, &ioc1); > - if (!ifd2) > + tcflush(ifd1, TCIFLUSH); 8 spaces -> 1 tab > + } > + if (ifd2 =3D=3D 0 && f1open) { > tcsetattr(0, TCSANOW, &ioc2); > + tcflush(ifd2, TCIFLUSH); 8 spaces -> 1 tab > + if (callback && !callback->isatty(callback, ifd1)) { > + tty_setup =3D 0; > + } drop the braces > if (sis_verbose) > printf("serial port A on stdin/stdout\n"); > if (!dumbio) { > tcgetattr(ifd1, &ioc1); > + if (tty_setup) { > iocold1 =3D ioc1; > ioc1.c_lflag &=3D ~(ICANON | ECHO); > ioc1.c_cc[VMIN] =3D 0; > ioc1.c_cc[VTIME] =3D 0; > } > + } need to fix indentation > @@ -1027,17 +1042,19 @@ port_init() > printf("serial port B on stdin/stdout\n"); > if (!dumbio) { > tcgetattr(ifd2, &ioc2); > + if (tty_setup) { > iocold2 =3D ioc2; > ioc2.c_lflag &=3D ~(ICANON | ECHO); > ioc2.c_cc[VMIN] =3D 0; > ioc2.c_cc[VTIME] =3D 0; > } > + } need to fix indentation > - if (!dumbio && ofd2 =3D=3D 1) setbuf(f2out, NULL); > + if (!dumbio && tty_setup && ofd2 =3D=3D 1) setbuf(f2out, NULL); uncuddle while you're here > @@ -1066,6 +1083,9 @@ read_uart(addr) > if (f1open) { > anum =3D DO_STDIO_READ(ifd1, aq, UARTBUF); > } > + else { > + anum =3D 0; > + } drop the braces > @@ -1098,6 +1118,9 @@ read_uart(addr) > if (f2open) { > bnum =3D DO_STDIO_READ(ifd2, bq, UARTBUF); > } > + else { > + bnum =3D 0; > + } drop the braces > @@ -1130,6 +1153,9 @@ read_uart(addr) > if (f1open) { > anum =3D DO_STDIO_READ(ifd1, aq, UARTBUF); > } > + else { > + anum =3D 0; > + } drop the braces > @@ -1142,6 +1168,9 @@ read_uart(addr) > if (f2open) { > bnum =3D DO_STDIO_READ(ifd2, bq, UARTBUF); > } > + else { > + bnum =3D 0; > + } drop the braces > @@ -1182,8 +1211,12 @@ write_uart(addr, data) > if (wnuma < UARTBUF) > wbufa[wnuma++] =3D c; > else { > - while (wnuma) > + while (wnuma) { > + if (ofd1 =3D=3D 1 && callback) > + wnuma -=3D callback->write_stdout(callback, wbufa, wnu= ma); > + else needs tabs for indenting > @@ -1206,8 +1239,12 @@ write_uart(addr, data) > if (wnumb < UARTBUF) > wbufb[wnumb++] =3D c; > else { > - while (wnumb) > + while (wnumb) { > + if (ofd1 =3D=3D 1 && callback) > + wnumb -=3D callback->write_stdout(callback, wbufb, wnu= mb); > + else > wnumb -=3D fwrite(wbufb, 1, wnumb, f2out); > + } same here > @@ -1245,19 +1282,37 @@ write_uart(addr, data) > static void > flush_uart() > { > - while (wnuma && f1open) > + while (wnuma && f1open) { > + if (ofd1 =3D=3D 1 && callback) { > + wnuma -=3D callback->write_stdout(callback, wbufa, wnuma); > + callback->flush_stdout(callback); > + } > + else 8 spaces -> 1 tab > wnuma -=3D fwrite(wbufa, 1, wnuma, f1out); > - while (wnumb && f2open) > + } > + while (wnumb && f2open) { > + if (ofd2 =3D=3D 1 && callback) { > + wnuma -=3D callback->write_stdout(callback, wbufb, wnuma); > + callback->flush_stdout(callback); > + } > + else 8 spaces -> 1 tab this keeps coming up. i'll stop noting it with the expectation you'll fix= all=20 the new code. > + while (callback->write_stdout(callback, &uarta_sreg, 1) !=3D= 1); should be a space before the ( -- comes up a few times in this patch also, prefer to have an explicit body rather than cuddle the ; while (...) continue; comes up a few times in this patch -mike --gBYU9MM4gf8jKg2V Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVFlSlAAoJEEFjO5/oN/WBqHoQANBtIxO8NXKIqlkcYItev2Zn 1rrADRBGxC9vKa6f8YMNzs99nb62/LStP1A6l47zMSqBGtAGpv8nAwi40UogK65c GwH/7sLR0yeE/L8EtxBCJWV2Cbt0BQiLMYQvgzZDEw7dXCA0uDkiSk/GZ9YgkXQR +d/CAEzrjykLTw1rGiZlZPEhBWgS0Qdz/SPemvyNWoCYmEHHwXMzHipGWD/LQ42k i8S09R/9Dscpyh0C9u1tDSOgJJhuqt7YedNgyEEMku1nKow+ng+I+XtwB596Zbby gj463+0WkjW+ZPGK3It/ly/LOWLQNZB0WEDhgCAX2pzJWvVDHTcANE+oaqfSY3LH Ct5qAvHIv33WT/r9Ho4Bd4qR/nTHPG5Iu299WxIMu5rrXTGF2ELS97W+CeDSEw64 nq7ftIOx4X8yHvQPwHtgqA4qdEJQd8SRA8NBJGrPo4VPVzCFScBqZ8t7Rn/OoMeq pAUYkZDIMx4GhI0+j6nRsjjMnUQbvPe5XgOTjk5Fs2tc8YXeg5DCo4KgjbxReuoU SnIcCrknmSbJKPAeE3LBxXoVa+TiFhOvm6ygGJr5HuWgzgCf2ZMfC45/VVKR7Gtn UFHHLd3J0a6EjkEtiyIT8NWhY8CDlOUMbYCOAhUCQqo8l2RspWDzKj3Nwf0GPdQZ 18bzbbp6Cy2l5o4yt2cf =Sgd9 -----END PGP SIGNATURE----- --gBYU9MM4gf8jKg2V--