This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC][PATCH v3] Consolidate gdbserver global variables
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.