From 9a262cf7038bb05e78b383c35bc11c1082eed3bd Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Thu, 1 Dec 2005 16:36:33 +0000 Subject: [PATCH] added array_len() and array_descr() functions is debug builds to be called from debugger [r7022] --- ir/adt/array.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ir/adt/array.c b/ir/adt/array.c index 1402432f0..25692d49d 100644 --- a/ir/adt/array.c +++ b/ir/adt/array.c @@ -181,3 +181,25 @@ _arr_resize (void *elts, int nelts, size_t eltsize) return dp->v.elts; } + +#ifdef DEBUG_libfirm +/** + * This function returns the length of a flexible array. + * Do NOT use is in code, use ARR_LEN() macro! + * This function is intended to be called from a debugger. + */ +int array_len(void *arr) { + return ARR_LEN(arr); +} + +/** + * This function returns the array descriptor of a flexible array. + * Do NOT use is in code!. + * This function is intended to be called from a debugger. + */ +_arr_descr *array_descr(void *arr) { + if (! arr) + return NULL; + return ((_arr_descr *)(void *)((char *)(arr) - _ARR_ELTS_OFFS)); +} +#endif /* DEBUG_libfirm */ -- 2.20.1