libctf, include: debuggability improvements

When --enable-libctf-hash-debugging is on, make ctf_set_errno and
ctf_set_typed_errno into real functions, not inlines, so you can
drop breakpoints on them.  Since we are breaking API, also move
ECTF_NEXT_END to the start of the _CTF_ERRORS array, so you can
check for real (non-ECTF_NEXT_END) errors in breakpooints on those
functions by checking for err > 1000.
This commit is contained in:
Nick Alcock
2025-04-24 14:20:28 +01:00
parent 2ef9554023
commit 7bcd444b9c
3 changed files with 30 additions and 3 deletions

View File

@@ -90,6 +90,10 @@ ctf_assert_internal (ctf_dict_t *fp, const char *file, size_t line,
return expr;
}
/* Un-inline these functions if debugging, so you can drop breakpoints on the
setting of any error anywhere by the library. */
#ifndef ENABLE_LIBCTF_HASH_DEBUGGING
static inline int
ctf_set_errno (ctf_dict_t *fp, int err)
{
@@ -105,7 +109,10 @@ ctf_set_typed_errno (ctf_dict_t *fp, int err)
fp->ctf_errno = err;
return CTF_ERR;
}
#else
extern int ctf_set_errno (ctf_dict_t *fp, int err);
extern ctf_id_t ctf_set_typed_errno (ctf_dict_t *fp, int err);
#endif
#ifdef __cplusplus
}