Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Stan Cox <scox@redhat.com>
To: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [RFC][PATCH v3] Consolidate gdbserver global variables
Date: Tue, 29 May 2018 20:46:00 -0000	[thread overview]
Message-ID: <bc7113cb-af99-441d-0f99-2b18706398a5@redhat.com> (raw)
In-Reply-To: <5a41d41f-a0ce-2941-c759-fb1854a1792c@redhat.com>



On 05/25/2018 10:31 AM, Pedro Alves wrote:

> You mean, without the change, we trigger a warning?  What
> does it look like?  If we do, then we'll need to address it
> somehow, of course, given -Werror.

This is vanilla upstream gdb, no patches, with gcc 7.3.1 on F27

../../../src/gdb/gdbserver/server.c: In function ‘int 
handle_qxfer_btrace_conf(const char*, gdb_byte*, const gdb_byte*, 
ULONGEST, LONGEST)’:
../../../src/gdb/gdbserver/server.c:1966:7: warning: ‘result’ may be 
used uninitialized in this function [-Wmaybe-uninitialized]
        if (result != 0)
        ^~
../../../src/gdb/gdbserver/server.c: In function ‘int 
handle_qxfer_btrace(const char*, gdb_byte*, const gdb_byte*, ULONGEST, 
LONGEST)’:
../../../src/gdb/gdbserver/server.c:1895:7: warning: ‘result’ may be 
used uninitialized in this function [-Wmaybe-uninitialized]
        if (result != 0)
        ^~
The source is an assignment in a TRY/CATCH
       TRY
         {
           result = target_read_btrace_conf (thread->btrace, &cache);
           if (result != 0)
             memcpy (own_buf, cache.buffer, cache.used_size);
         }
       CATCH (exception, RETURN_MASK_ERROR)
         {
           sprintf (own_buf, "E.%s", exception.message);
           result = -1;
         }
       END_CATCH

       if (result != 0)
         return -3;

> This "static" here made me notice that there is more global
> state stored as function local static variables that should
> be moved to client_state.  E.g.,:
> That can be done as follow up.

Will do

> remote_debug controls whether to print debug output to gdbserver'
> own terminal, so I'm thinking that it should probably remain
> a global.

Ah yes; I'll do that.


  reply	other threads:[~2018-05-29 19:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07 22:03 [RFC][PATCH] " Stan Cox
2018-01-31  3:41 ` Stan Cox
2018-04-23 17:58   ` Pedro Alves
2018-05-03 15:06     ` [RFC][PATCH v2] " Stan Cox
2018-05-04 14:14       ` Pedro Alves
2018-05-07 19:17         ` Frank Ch. Eigler
2018-05-25 14:31           ` Pedro Alves
2018-05-08 20:58         ` [RFC][PATCH v3] " Stan Cox
2018-05-25 15:01           ` Pedro Alves
2018-05-29 20:46             ` Stan Cox [this message]
2018-05-30 14:30               ` Pedro Alves
2018-06-08 16:11           ` Tom Tromey
2018-06-08 16:46             ` Stan Cox
2018-06-08 16:52               ` Tom Tromey
2018-07-10  1:14           ` Sergio Durigan Junior

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=bc7113cb-af99-441d-0f99-2b18706398a5@redhat.com \
    --to=scox@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /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