From: Aaron Merey <amerey@redhat.com>
To: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Cc: elfutils-devel@sourceware.org
Subject: Re: [PATCH] Getter and setter for Dwfl's offline_next_address
Date: Fri, 15 Mar 2024 13:27:45 -0400 [thread overview]
Message-ID: <CAJDtP-SQOjpnVv4gtSL9ZF7For+tNj2FfK2NXFp7dZ=jPE0cnw@mail.gmail.com> (raw)
In-Reply-To: <20240306192249.242130-1-yakoyoku@gmail.com>
Hi Martin,
On Wed, Mar 6, 2024 at 2:23 PM Martin Rodriguez Reboredo
<yakoyoku@gmail.com> wrote:
>
> diff --git a/tests/dwfl-offline-address.c b/tests/dwfl-offline-address.c
> new file mode 100644
> index 00000000..9a33b95a
> --- /dev/null
> +++ b/tests/dwfl-offline-address.c
> @@ -0,0 +1,43 @@
> +#include <config.h>
> +#include <assert.h>
> +#include <inttypes.h>
> +#include <sys/types.h>
> +#include <stdio.h>
> +#include <stdio_ext.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <locale.h>
> +#include <argp.h>
> +#include ELFUTILS_HEADER(dwfl)
> +#include <dwarf.h>
> +#include "system.h"
> +
> +#define OFFLINE_REDZONE 0x10000
> +
> +static const Dwfl_Callbacks offline_callbacks =
> + {
> + .find_debuginfo = INTUSE(dwfl_standard_find_debuginfo),
> + .section_address = INTUSE(dwfl_offline_section_address),
> + };
> +
> +int
> +main (int argc, char **argv)
> +{
> + Dwfl *dwfl = dwfl_begin (&offline_callbacks);
> + assert (dwfl != NULL);
> +
> + if (dwfl_get_offline_next_address (dwfl) != OFFLINE_REDZONE)
> + {
> + dwfl_end (dwfl);
> + return 1;
> + }
> +
> + int result = 0;
> + dwfl_set_offline_next_address (dwfl, 0);
> + if (dwfl_get_offline_next_address (dwfl) != 0)
> + result = 1;
> +
> + dwfl_end (dwfl);
> +
> + return result;
> +}
This test needs to be run under a testrun command in a tests/run-*.sh script
in order to have the result recorded by 'make check'.
Also there are a few places in libdwfl/ and src/ where we manually set
dwfl->offline_next_address. We could use the setter here instead.
Aaron
next prev parent reply other threads:[~2024-03-15 17:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 19:22 Martin Rodriguez Reboredo
2024-03-15 17:27 ` Aaron Merey [this message]
2024-03-20 22:52 ` Mark Wielaard
2024-03-24 14:11 ` Martin Rodriguez Reboredo
2024-03-24 17:08 ` Mark Wielaard
2024-03-24 19:17 ` Martin Rodriguez Reboredo
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='CAJDtP-SQOjpnVv4gtSL9ZF7For+tNj2FfK2NXFp7dZ=jPE0cnw@mail.gmail.com' \
--to=amerey@redhat.com \
--cc=elfutils-devel@sourceware.org \
--cc=yakoyoku@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).