BUILD: tools: make resolve_sym_name() return a const

Originally it was made to return a void* because some comparisons in the
code where it was used required a lot of casts. But now we don't need
that anymore. And having it non-const breaks the build on NetBSD 9 as
reported in issue #728.

So let's switch to const and adjust debug.c to accomodate this.
This commit is contained in:
Willy Tarreau 2020-07-05 20:26:04 +02:00
parent 4c442b08b3
commit 0c439d8956
3 changed files with 3 additions and 3 deletions

View File

@ -996,7 +996,7 @@ int dump_text_line(struct buffer *out, const char *buf, int bsize, int len,
void dump_addr_and_bytes(struct buffer *buf, const char *pfx, const void *addr, int n);
void dump_hex(struct buffer *out, const char *pfx, const void *buf, int len, int unsafe);
int may_access(const void *ptr);
void *resolve_sym_name(struct buffer *buf, const char *pfx, void *addr);
const void *resolve_sym_name(struct buffer *buf, const char *pfx, void *addr);
const char *get_exec_path();
#if defined(USE_BACKTRACE)

View File

@ -98,7 +98,7 @@ void ha_thread_dump(struct buffer *buf, int thr, int calling_tid)
struct buffer bak;
void *callers[100];
int j, nptrs;
void *addr;
const void *addr;
int dump = 0;
nptrs = my_backtrace(callers, sizeof(callers)/sizeof(*callers));

View File

@ -4426,7 +4426,7 @@ static int dladdr_and_size(const void *addr, Dl_info *dli, size_t *size)
* The symbol's base address is returned, or NULL when unresolved, in order to
* allow the caller to match it against known ones.
*/
void *resolve_sym_name(struct buffer *buf, const char *pfx, void *addr)
const void *resolve_sym_name(struct buffer *buf, const char *pfx, void *addr)
{
const struct {
const void *func;