[PATCH] readelf: Pull advance_pc() in file scope
From: Timm Bäder Make advance_pc() a static function so we can get rid of another nested function. Rename it to run_advance_pc() and use a local advance_pc() macro to pass all the local variables. This is similar to what the equivalent code in libdw/dwarf_getsrclines.c is doing. Signed-off-by: Timm Bäder --- src/readelf.c | 26 +++--- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/readelf.c b/src/readelf.c index b9740455..c44d06d1 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -8373,6 +8373,23 @@ print_form_data (Dwarf *dbg, int form, const unsigned char *readp, return readp; } +/* Only used via run_advance_pc() macro */ +static inline void +run_advance_pc (unsigned int op_advance, +unsigned int minimum_instr_len, +unsigned int max_ops_per_instr, +unsigned int *op_addr_advance, +Dwarf_Word *address, +unsigned int *op_index) +{ + const unsigned int advanced_op_index = (*op_index) + op_advance; + + *op_addr_advance = minimum_instr_len * (advanced_op_index + / max_ops_per_instr); + *address = *address + *op_addr_advance; + *op_index = advanced_op_index % max_ops_per_instr; +} + static void print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr, Dwarf *dbg) @@ -8763,13 +8780,8 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr, /* Apply the "operation advance" from a special opcode or DW_LNS_advance_pc (as per DWARF4 6.2.5.1). */ unsigned int op_addr_advance; - inline void advance_pc (unsigned int op_advance) - { - op_addr_advance = minimum_instr_len * ((op_index + op_advance) - / max_ops_per_instr); - address += op_addr_advance; - op_index = (op_index + op_advance) % max_ops_per_instr; - } +#define advance_pc(op_advance) run_advance_pc(op_advance, minimum_instr_len, \ + max_ops_per_instr, &op_addr_advance, &address, &op_index) if (max_ops_per_instr == 0) { -- 2.26.3
readelf: Pull advance_pc() in file scope
Giving this another shot since pulling all the parsing code into libdwP.h seems a bit overkill (and potentially buggy of course). The downside is that run_advance_pc() takes 6 arguments instead of the 4 that it takes in libdwarf_getsrclines.c
[Bug debuginfod/27571] debuginfod client cache should consist of 444 perm files
https://sourceware.org/bugzilla/show_bug.cgi?id=27571 Frank Ch. Eigler changed: What|Removed |Added Assignee|unassigned at sourceware dot org |alizhang at redhat dot com -- You are receiving this mail because: You are on the CC list for the bug.
[Bug debuginfod/27531] Support retry of failed downloads
https://sourceware.org/bugzilla/show_bug.cgi?id=27531 Frank Ch. Eigler changed: What|Removed |Added Assignee|unassigned at sourceware dot org |alizhang at redhat dot com Status|WAITING |NEW --- Comment #12 from Frank Ch. Eigler --- Would suggest implementing this via a new $DEBUGINFOD_RETRY=number environment variable, defaulting to 0. If greater or equal to 1, after an *intermittent error* type curl result (not a final one like 200 success or a 404 not found), retry the $DEBUGINFOD_URLS loop up to $number of times. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug debuginfod/25628] client should cache negative results
https://sourceware.org/bugzilla/show_bug.cgi?id=25628 Frank Ch. Eigler changed: What|Removed |Added Assignee|amerey at redhat dot com |alizhang at redhat dot com --- Comment #3 from Frank Ch. Eigler --- Suggest implementing this via: - map a 404 result code to an empty 000-permission file in the debuginfod client cache - when querying for a buildid, if the cache includes such a 000-permission file, check its fstat - if the fstat mtime is older than the configuration parameter from the file .cache/cache_miss_s, then unlink the 000 file and proceed with a new query - if the fstat mtime is newer, then the 000 file is fresh, so return a 404/ENOENT equivalent to the debuginfod client application - a good default for cache_miss_s could be 600 (10 minutes) -- You are receiving this mail because: You are on the CC list for the bug.
[Bug debuginfod/26125] during debuginfod cache cleanup, try harder to rmdir empty dirs
https://sourceware.org/bugzilla/show_bug.cgi?id=26125 Frank Ch. Eigler changed: What|Removed |Added Severity|normal |critical Assignee|unassigned at sourceware dot org |alizhang at redhat dot com --- Comment #8 from Frank Ch. Eigler --- Suggest implementation during cache cleanup, - post-order traversal (files aged/deleted first), fstat buildid directories - if mtime age is greater than maxage_s, attempt one rmdir (that rmdir will fail for nonempty directories, which is fine) During download, always attempt the mkdir(target_cache_dir), independently of checking whether it already exists (i.e., drop stat(target_cache_dir,...), and ignore the errno==EEXIST case as normal. -- You are receiving this mail because: You are on the CC list for the bug.