Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Jiri Gaisler <jiri@gaisler.se>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v4 06/13] sim/erc32: Use gdb callback for UART I/O when linked with gdb.
Date: Sat, 28 Mar 2015 07:13:00 -0000	[thread overview]
Message-ID: <20150328071342.GJ30239@vapier> (raw)
In-Reply-To: <1426626170-21401-7-git-send-email-jiri@gaisler.se>

[-- Attachment #1: Type: text/plain, Size: 4232 bytes --]

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 == 0 && f1open) {
>  	tcsetattr(0, TCSANOW, &ioc1);
> -    if (!ifd2)
> +        tcflush(ifd1, TCIFLUSH);

8 spaces -> 1 tab

> +    }
> +    if (ifd2 == 0 && f1open) {
>  	tcsetattr(0, TCSANOW, &ioc2);
> +        tcflush(ifd2, TCIFLUSH);

8 spaces -> 1 tab

> +        if (callback && !callback->isatty(callback, ifd1)) {
> +            tty_setup = 0;
> +        }

drop the braces

>  	if (sis_verbose)
>  	    printf("serial port A on stdin/stdout\n");
>          if (!dumbio) {
>              tcgetattr(ifd1, &ioc1);
> +            if (tty_setup) {
>              iocold1 = ioc1;
>              ioc1.c_lflag &= ~(ICANON | ECHO);
>              ioc1.c_cc[VMIN] = 0;
>              ioc1.c_cc[VTIME] = 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 = ioc2;
>              ioc2.c_lflag &= ~(ICANON | ECHO);
>              ioc2.c_cc[VMIN] = 0;
>              ioc2.c_cc[VTIME] = 0;
>          }
> +        }

need to fix indentation

> -        if (!dumbio && ofd2 == 1) setbuf(f2out, NULL);
> +	if (!dumbio && tty_setup && ofd2 == 1) setbuf(f2out, NULL);

uncuddle while you're here

> @@ -1066,6 +1083,9 @@ read_uart(addr)
>  	    if (f1open) {
>  	        anum = DO_STDIO_READ(ifd1, aq, UARTBUF);
>  	    }
> +      else {
> +          anum = 0;
> +      }

drop the braces

> @@ -1098,6 +1118,9 @@ read_uart(addr)
>  	    if (f2open) {
>  		bnum = DO_STDIO_READ(ifd2, bq, UARTBUF);
>  	    }
> +	    else {
> +		bnum = 0;
> +	    }

drop the braces

> @@ -1130,6 +1153,9 @@ read_uart(addr)
>  	    if (f1open) {
>  	        anum = DO_STDIO_READ(ifd1, aq, UARTBUF);
>              }
> +	    else {
> +		anum = 0;
> +	    }

drop the braces

> @@ -1142,6 +1168,9 @@ read_uart(addr)
>  	    if (f2open) {
>  		bnum = DO_STDIO_READ(ifd2, bq, UARTBUF);
>  	    }
> +	    else {
> +		bnum = 0;
> +	    }

drop the braces

> @@ -1182,8 +1211,12 @@ write_uart(addr, data)
>  	    if (wnuma < UARTBUF)
>  	        wbufa[wnuma++] = c;
>  	    else {
> -	        while (wnuma)
> +	        while (wnuma) {
> +              if (ofd1 == 1 && callback)
> +                  wnuma -= callback->write_stdout(callback, wbufa, wnuma);
> +              else

needs tabs for indenting


> @@ -1206,8 +1239,12 @@ write_uart(addr, data)
>  	    if (wnumb < UARTBUF)
>  		wbufb[wnumb++] = c;
>  	    else {
> -		while (wnumb)
> +          while (wnumb) {
> +              if (ofd1 == 1 && callback)
> +                  wnumb -= callback->write_stdout(callback, wbufb, wnumb);
> +              else
>  		    wnumb -= 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 == 1 && callback) {
> +            wnuma -= callback->write_stdout(callback, wbufa, wnuma);
> +            callback->flush_stdout(callback);
> +        }
> +        else

8 spaces -> 1 tab

>  	wnuma -= fwrite(wbufa, 1, wnuma, f1out);
> -    while (wnumb && f2open)
> +    }
> +    while (wnumb && f2open) {
> +        if (ofd2 == 1 && callback) {
> +            wnuma -= 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 
the new code.

> +            while (callback->write_stdout(callback, &uarta_sreg, 1) != 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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-03-28  7:13 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17 21:03 [PATCH v4 00/13] Update of the SPARC SIS simulator Jiri Gaisler
2015-03-17 21:03 ` [PATCH v4 02/13] sim/erc32: Removed type mismatch compiler warnings Jiri Gaisler
2015-03-17 22:59   ` Mike Frysinger
2015-03-17 21:03 ` [PATCH v4 10/13] sim/erc32: Add support for LEON2 processor emulation Jiri Gaisler
2015-03-28  7:21   ` Mike Frysinger
2015-03-17 21:03 ` [PATCH v4 11/13] sim/erc32: Updated documentation Jiri Gaisler
2015-03-28  7:17   ` Mike Frysinger
2015-03-17 21:03 ` [PATCH v4 05/13] sim/erc32: Fix a few compiler warnings Jiri Gaisler
2015-03-28  7:06   ` Mike Frysinger
2015-03-17 21:03 ` [PATCH v4 09/13] sim/erc32: Add support for LEON3 processor emulation Jiri Gaisler
2015-03-17 21:03 ` [PATCH v4 03/13] sim/erc32: Switched emulated memory to host endian order Jiri Gaisler
2015-03-22 22:46   ` Mike Frysinger
2015-03-23  9:01     ` Jiri Gaisler
2015-03-28  7:41       ` Mike Frysinger
2015-03-28  8:21         ` Jiri Gaisler
2015-03-24  9:39     ` Jiri Gaisler
2015-03-27 10:26     ` Jiri Gaisler
2015-03-17 21:03 ` [PATCH v4 04/13] sim/erc32: Use memory_iread() function for instruction fetching Jiri Gaisler
2015-03-28  7:01   ` Mike Frysinger
2015-03-17 21:03 ` [PATCH v4 12/13] sim/erc32: Add data watchpoint support Jiri Gaisler
2015-03-28  7:16   ` Mike Frysinger
2015-03-17 21:03 ` [PATCH v4 01/13] sim/erc32: Added -v command line switch for verbose output Jiri Gaisler
2015-03-17 22:56   ` Mike Frysinger
2015-03-17 21:03 ` [PATCH v4 07/13] sim/erc32: Access memory subsystem through struct memsys Jiri Gaisler
2015-03-28  7:15   ` Mike Frysinger
2015-03-17 21:03 ` [PATCH v4 06/13] sim/erc32: Use gdb callback for UART I/O when linked with gdb Jiri Gaisler
2015-03-28  7:13   ` Mike Frysinger [this message]
2015-03-17 21:04 ` [PATCH v4 13/13] Add watchpoint support to gdb simulator interface Jiri Gaisler
2015-03-28  7:19   ` Mike Frysinger
2015-03-30 20:51     ` Jiri Gaisler
2015-03-17 21:04 ` [PATCH v4 08/13] sim/erc32: Move local extern declarations into sis.h Jiri Gaisler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150328071342.GJ30239@vapier \
    --to=vapier@gentoo.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jiri@gaisler.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox