From: Luis Machado <luis.machado@arm.com>
To: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix various procfs.c compilation errors
Date: Wed, 16 Nov 2022 19:04:55 +0000 [thread overview]
Message-ID: <65dc9aec-b868-5988-e9b5-5f460d38f6d2@arm.com> (raw)
In-Reply-To: <ydda64r7xig.fsf@CeBiTec.Uni-Bielefeld.DE>
On 11/16/22 15:02, Rainer Orth wrote:
> procfs.c has accumulated several compilation errors lately (some of them
> new with GCC 12), which are fixed by this patch:
>
> * auxv_parse gets:
>
> /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:144:7: error: ‘int procfs_target::auxv_parse(gdb_byte**, gdb_byte*, CORE_ADDR*, CORE_ADDR*)’ marked ‘override’, but does not override
> 144 | int auxv_parse (gdb_byte **readptr,
> | ^~~~~~~~~~
>
> Obviouly, procfs.c was missed in the auxv_parse constification.
>
> * dead_procinfo has:
>
> /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c: In function ‘void dead_procinfo(procinfo*, const char*, int)’:
> /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:563:11: warning: the address of ‘procinfo::pathname’ will never be NULL [-Waddress]
> 563 | if (pi->pathname)
> | ~~~~^~~~~~~~
> /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:238:8: note: ‘procinfo::pathname’ declared here
> 238 | char pathname[MAX_PROC_NAME_SIZE]; /* Pathname to /proc entry */
> | ^~~~~~~~
>
> The warning is correct, so the code can lose support for the NULL
> pathname case.
>
> * create_inferior has this ugly warning:
>
> /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c: In member function ‘virtual void procfs_target::create_inferior(const char*, const std::string&, char**, int)’:
> /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:2815:19: warning: ‘char* std::strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
> 2815 | strncpy (tryname, p, len);
> | ~~~~~~~~^~~~~~~~~~~~~~~~~
> /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:2814:26: note: length computed here
> 2814 | len = strlen (p);
> | ~~~~~~~^~~
>
> It seems that this is another case of GCC PR middle-end/88059, which
> Martin Sebor refuses to fix. So I'm using the hack suggested in the
> PR to use memcpy instead of strncpy.
>
> * find_memory_regions_callback fails with
>
> /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c: In function ‘int find_memory_regions_callback(prmap*, find_memory_region_ftype, void*)’:
> /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:3167:18: error: too few arguments to function
> 3167 | return (*func) ((CORE_ADDR) map->pr_vaddr,
> | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> 3168 | map->pr_size,
> | ~~~~~~~~~~~~~
> 3169 | (map->pr_mflags & MA_READ) != 0,
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 3170 | (map->pr_mflags & MA_WRITE) != 0,
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 3171 | (map->pr_mflags & MA_EXEC) != 0,
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 3172 | 1, /* MODIFIED is unknown, pass it as true. */
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 3173 | data);
> | ~~~~~
>
> Again, procfs.c was overlooked when adding the new memory_tagged arg.
> Unfortunately, it wasn't even documented in gdb/defs.h when it was
> added in
>
Sorry, that was an oversight. I failed to updated all the hooks. I think there was a BSD one that got fixed after the following commit was pushed.
> commit 68cffbbd4406b4efe1aa6e18460b1d7ca02549f1
> Author: Luis Machado <luis.machado@arm.com>
> Date: Thu Mar 31 11:42:35 2022 +0100
>
> [AArch64] MTE corefile support
>
> With those changes, procfs.c compiles again. Together with the hack
> from the Solaris gdbsupport breakage reported in PR build/29791, I was
> able to build and test gdb on both amd64-pc-solaris2.11 and
> sparcv9-sun-solaris2.11.
>
> Will commit the patch soon.
>
> Rainer
>
next prev parent reply other threads:[~2022-11-16 19:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-16 15:02 Rainer Orth
2022-11-16 15:53 ` Simon Marchi
2022-11-17 9:46 ` Rainer Orth
2022-11-16 17:30 ` Tom Tromey
2022-11-17 9:48 ` Rainer Orth
2022-11-16 19:04 ` Luis Machado [this message]
2022-11-17 9:50 ` Rainer Orth
2022-11-17 10:08 ` Luis Machado
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=65dc9aec-b868-5988-e9b5-5f460d38f6d2@arm.com \
--to=luis.machado@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=ro@CeBiTec.Uni-Bielefeld.DE \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).