Changeset 40eab9f in mainline for kernel/generic/src/debug/util.c


Ignore:
Timestamp:
2023-11-03T18:47:41Z (7 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, topic/msim-upgrade, topic/simplify-dev-export
Children:
b1397ab
Parents:
dcd8214
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-11-03 18:46:22)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-11-03 18:47:41)
Message:

Print symbol names and line numbers in stacktraces for init tasks

Only useful in select few situations, but useful nonetheless.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/debug/util.c

    rdcd8214 r40eab9f  
    3333#include <debug/names.h>
    3434
    35 /*
    36  * These declarations cause global definitions for the functions to be emitted
    37  * in this compilation unit, so if the compiler decides not to inline some of
    38  * them, only one external copy exists. See C99 inline rules.
    39  */
    40 extern inline uint8_t read_byte(const uint8_t **, const uint8_t *);
    41 extern inline uint16_t read_uint16(const uint8_t **, const uint8_t *);
    42 extern inline uint32_t read_uint24(const uint8_t **, const uint8_t *);
    43 extern inline uint32_t read_uint32(const uint8_t **, const uint8_t *);
    44 extern inline uint64_t read_uint64(const uint8_t **, const uint8_t *);
    45 extern inline uint64_t read_uint(const uint8_t **, const uint8_t *, unsigned);
    46 extern inline uint64_t read_uleb128(const uint8_t **, const uint8_t *);
    47 extern inline int64_t read_sleb128(const uint8_t **, const uint8_t *);
    48 extern inline void skip_leb128(const uint8_t **, const uint8_t *);
    49 extern inline uint64_t read_initial_length(const uint8_t **, const uint8_t *, unsigned *);
    50 extern inline const char *read_string(const uint8_t **, const uint8_t *);
    51 extern inline void skip_string(const uint8_t **, const uint8_t *);
    52 extern inline void safe_increment(const uint8_t **, const uint8_t *, ptrdiff_t);
    53 
    54 extern inline void skip_format(const uint8_t **, const uint8_t *, unsigned);
    55 extern inline void skip_formatted_entry(const uint8_t **, const uint8_t *,
    56     const uint8_t *, const uint8_t *, unsigned);
    57 extern inline void skip_formatted_list(const uint8_t **, const uint8_t *,
    58     unsigned, const uint8_t *, const uint8_t *, unsigned);
    59 
    6035bool skip_data(unsigned form, const uint8_t **const data,
    6136    const uint8_t *data_end, unsigned width)
     
    159134}
    160135
    161 void print_formatted_list(const char *name,
     136void print_formatted_list(debug_sections_t *scs, const char *name,
    162137    const uint8_t *data, const uint8_t *const data_end,
    163138    const uint8_t *format, const uint8_t *format_end,
     
    175150
    176151                        DEBUGF("%s:%s:", dw_lnct_name(lnct), dw_form_name(form));
    177                         print_formed_data(form, &data, data_end, width);
     152                        print_formed_data(scs, form, &data, data_end, width);
    178153                        DEBUGF("\n");
    179154                }
     
    196171}
    197172
    198 void print_formed_data(unsigned form, const uint8_t **const data,
     173void print_formed_data(debug_sections_t *scs, unsigned form, const uint8_t **const data,
    199174    const uint8_t *data_end, unsigned width)
    200175{
     
    210185        case DW_FORM_strp_sup:
    211186                offset = read_uint(data, data_end, width);
    212                 if (offset >= debug_str_size)
     187                if (offset >= scs->debug_str_size)
    213188                        DEBUGF("<out of range>");
    214189                else
    215                         DEBUGF("\"%s\"", debug_str + offset);
     190                        DEBUGF("\"%s\"", scs->debug_str + offset);
    216191                break;
    217192
    218193        case DW_FORM_line_strp:
    219194                offset = read_uint(data, data_end, width);
    220                 if (offset >= debug_line_str_size)
     195                if (offset >= scs->debug_line_str_size)
    221196                        DEBUGF("<out of range>");
    222197                else
    223                         DEBUGF("\"%s\"", debug_line_str + offset);
     198                        DEBUGF("\"%s\"", scs->debug_line_str + offset);
    224199                break;
    225200
Note: See TracChangeset for help on using the changeset viewer.