This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/3] (patch 2/4, v2) [nto] Implement TARGET_OBJECT_AUXV.
- From: Pedro Alves <palves at redhat dot com>
- To: Aleksandar Ristovski <aristovski at qnx dot com>, gdb-patches at sourceware dot org
- Date: Tue, 20 Oct 2015 16:20:18 +0100
- Subject: Re: [PATCH 2/3] (patch 2/4, v2) [nto] Implement TARGET_OBJECT_AUXV.
- Authentication-results: sourceware.org; auth=none
- References: <56263FED dot 3050602 at redhat dot com> <1445351294-18179-1-git-send-email-aristovski at qnx dot com> <1445351294-18179-3-git-send-email-aristovski at qnx dot com>
Does this result in any visible improvement? I assume that
at least, "info auxv" now works [1] [2]. It'd be really nice to have a
blurb in the commit log mentioning what motivated this.
[1] - BTW, if you enable gdb.base/auxv.exp on NTO, does it pass?
On 10/20/2015 03:28 PM, Aleksandar Ristovski wrote:
> gdb/ChangeLog:
>
> * nto-procfs.c (sys/auxv.h): Include.
> (procfs_xfer_partial): Implement TARGET_OBJECT_AUXV.
> * gdb/nto-tdep.c (nto_read_auxv_from_initial_stack): New function.
> * gdb/nto-tdep.h (nto_read_auxv_from_initial_stack): New declaration.
Drop the "gdb/" in the file paths.
> @@ -885,6 +887,40 @@ procfs_xfer_partial (struct target_ops *ops, enum target_object object,
> {
> case TARGET_OBJECT_MEMORY:
> return procfs_xfer_memory (readbuf, writebuf, offset, len, xfered_len);
> + case TARGET_OBJECT_AUXV:
> + if (readbuf != NULL)
> + {
> + int err;
> + CORE_ADDR initial_stack;
> + debug_process_t procinfo;
> + /* For 32-bit architecture, size of auxv_t is 8 bytes. */
> + const unsigned int sizeof_auxv_t = sizeof (auxv_t);
> + const unsigned int sizeof_tempbuf = 20 * sizeof_auxv_t;
> + int tempread;
> + gdb_byte *const tempbuf = alloca (sizeof_tempbuf);
> +
> + if (tempbuf == NULL)
> + return TARGET_XFER_E_IO;
> +
> + err = devctl (ctl_fd, DCMD_PROC_INFO, &procinfo,
> + sizeof procinfo, 0);
> + if (err != EOK)
> + return TARGET_XFER_E_IO;
> +
> + /* Similar as in the case of a core file, we read auxv from
> + initial_stack. */
Hmm, where's this "similar" you refer to? AFAICS, for cores, BFD
extracts it from the NT_AUVX note.
> + initial_stack = procinfo.initial_stack;
> +
> + /* procfs is always 'self-hosted', no byte-order manipulation. */
Double-space after period.
Otherwise looks OK.
Thanks,
Pedro Alves