Changeset 001957b6 in mainline
- Timestamp:
- 2023-10-26T20:20:55Z (13 months ago)
- Branches:
- master, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0373af9
- Parents:
- 2fbb42f
- Location:
- kernel/generic
- Files:
-
- 7 edited
- 18 moved
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/debug/constants.h
r2fbb42f r001957b6 45 45 46 46 enum { 47 #include " ../debug/constants/dw_ut.h"47 #include "constants/dw_ut.inc" 48 48 49 49 DW_UT_lo_user = 0x80, … … 52 52 53 53 enum { 54 #include " ../debug/constants/dw_tag.h"54 #include "constants/dw_tag.inc" 55 55 56 56 DW_TAG_lo_user = 0x4080, … … 59 59 60 60 enum { 61 #include " ../debug/constants/dw_at.h"61 #include "constants/dw_at.inc" 62 62 63 63 DW_AT_lo_user = 0x2000, … … 66 66 67 67 enum { 68 #include " ../debug/constants/dw_form.h"68 #include "constants/dw_form.inc" 69 69 }; 70 70 71 71 enum { 72 #include " ../debug/constants/dw_op.h"72 #include "constants/dw_op.inc" 73 73 74 74 DW_OP_lo_user = 0xe0, … … 77 77 78 78 enum { 79 #include " ../debug/constants/dw_lle.h"79 #include "constants/dw_lle.inc" 80 80 }; 81 81 82 82 enum { 83 #include " ../debug/constants/dw_ate.h"83 #include "constants/dw_ate.inc" 84 84 85 85 DW_ATE_lo_user = 0x80, … … 88 88 89 89 enum { 90 #include " ../debug/constants/dw_ds.h"90 #include "constants/dw_ds.inc" 91 91 }; 92 92 93 93 enum { 94 #include " ../debug/constants/dw_end.h"94 #include "constants/dw_end.inc" 95 95 96 96 DW_END_lo_user = 0x40, … … 99 99 100 100 enum { 101 #include " ../debug/constants/dw_access.h"101 #include "constants/dw_access.inc" 102 102 }; 103 103 104 104 enum { 105 #include " ../debug/constants/dw_vis.h"105 #include "constants/dw_vis.inc" 106 106 }; 107 107 108 108 enum { 109 #include " ../debug/constants/dw_virtuality.h"109 #include "constants/dw_virtuality.inc" 110 110 }; 111 111 112 112 enum { 113 #include " ../debug/constants/dw_lang.h"113 #include "constants/dw_lang.inc" 114 114 115 115 DW_LANG_lo_user = 0x8000, … … 122 122 123 123 enum { 124 #include " ../debug/constants/dw_id.h"124 #include "constants/dw_id.inc" 125 125 }; 126 126 127 127 enum { 128 #include " ../debug/constants/dw_cc.h"128 #include "constants/dw_cc.inc" 129 129 130 130 DW_CC_lo_user = 0x40, … … 133 133 134 134 enum { 135 #include " ../debug/constants/dw_lns.h"135 #include "constants/dw_lns.inc" 136 136 }; 137 137 138 138 enum { 139 #include " ../debug/constants/dw_lne.h"139 #include "constants/dw_lne.inc" 140 140 141 141 DW_LNE_lo_user = 0x80, … … 144 144 145 145 enum { 146 #include " ../debug/constants/dw_lnct.h"146 #include "constants/dw_lnct.inc" 147 147 148 148 DW_LNCT_lo_user = 0x2000, -
kernel/generic/include/debug/line.h
r2fbb42f r001957b6 92 92 static inline struct debug_line_program debug_line_program_create(const uint8_t *program, 93 93 const uint8_t *const program_end, 94 94 const struct debug_line_program_header *hdr) 95 95 { 96 96 return (struct debug_line_program) { -
kernel/generic/src/debug/line.c
r2fbb42f r001957b6 195 195 case DW_LNS_advance_pc: 196 196 arg = read_uleb128(&program, program_end); 197 DEBUGF("%s(%" PRIu64")\n", opname, arg);197 DEBUGF("%s(%" PRIu64 ")\n", opname, arg); 198 198 lp->op_advance += arg; 199 199 break; … … 267 267 case DW_LNE_set_discriminator: 268 268 uint64_t arg = read_uleb128(&program, program_end); 269 DEBUGF("%s:%zu(%" PRIu64")\n", opname, length, arg);269 DEBUGF("%s:%zu(%" PRIu64 ")\n", opname, length, arg); 270 270 break; 271 271 … … 369 369 370 370 print_format("directory_entry_format", 371 371 hdr->v5.directory_entry_format, hdr->v5.directory_entry_format_end); 372 372 373 373 FIELD(v5.directories_count, PRIu64, read_uleb128(&data, data_end)); … … 375 375 hdr->v5.directories = data; 376 376 skip_formatted_list(&data, data_end, hdr->v5.directories_count, 377 377 hdr->v5.directory_entry_format, hdr->v5.directory_entry_format_end, width); 378 378 hdr->v5.directories_end = data; 379 379 380 380 print_formatted_list("directories", hdr->v5.directories, hdr->v5.directories_end, 381 381 hdr->v5.directory_entry_format, hdr->v5.directory_entry_format_end, width); 382 382 383 383 FIELD(v5.file_name_entry_format_count, "u", read_byte(&data, data_end)); … … 388 388 389 389 print_format("file_name_entry_format", 390 390 hdr->v5.file_name_entry_format, hdr->v5.file_name_entry_format_end); 391 391 392 392 FIELD(v5.file_names_count, PRIu64, read_uleb128(&data, data_end)); … … 394 394 hdr->v5.file_names = data; 395 395 skip_formatted_list(&data, data_end, hdr->v5.file_names_count, 396 396 hdr->v5.file_name_entry_format, hdr->v5.file_name_entry_format_end, width); 397 397 hdr->v5.file_names_end = data; 398 398 399 399 print_formatted_list("file_names", hdr->v5.file_names, hdr->v5.file_names_end, 400 400 hdr->v5.file_name_entry_format, hdr->v5.file_name_entry_format_end, width); 401 401 } 402 402 } … … 655 655 656 656 /* 657 if (!lp.end_sequence) {658 659 660 }661 */657 * if (!lp.end_sequence) { 658 * debug_line_program_skip_to_sequence_end(&lp); 659 * assert(lp.truncated || lp.end_sequence); 660 * } 661 */ 662 662 } 663 663 } … … 666 666 } 667 667 668 static bool get_info(const struct debug_line_program_header *hdr, uintptr_t addr, int op_index, int *file, int *line, int *column) { 668 static bool get_info(const struct debug_line_program_header *hdr, uintptr_t addr, int op_index, int *file, int *line, int *column) 669 { 669 670 struct debug_line_program lp = debug_line_program_create( 670 671 hdr->header_end, hdr->unit_end, hdr); 671 672 672 673 int last_file = 0; … … 735 736 return true; 736 737 } 737 -
kernel/generic/src/debug/names.c
r2fbb42f r001957b6 35 35 36 36 static const char *const dw_ut_names[] = { 37 #include <debug/constants/dw_ut.h>37 #include <debug/constants/dw_ut.inc> 38 38 }; 39 39 40 40 static const char *const dw_tag_names[] = { 41 #include <debug/constants/dw_tag.h>41 #include <debug/constants/dw_tag.inc> 42 42 }; 43 43 44 44 static const char *const dw_at_names[] = { 45 #include <debug/constants/dw_at.h>45 #include <debug/constants/dw_at.inc> 46 46 }; 47 47 48 48 static const char *const dw_form_names[] = { 49 #include <debug/constants/dw_form.h>49 #include <debug/constants/dw_form.inc> 50 50 }; 51 51 52 52 static const char *const dw_op_names[] = { 53 #include <debug/constants/dw_op.h>53 #include <debug/constants/dw_op.inc> 54 54 }; 55 55 56 56 static const char *const dw_lle_names[] = { 57 #include <debug/constants/dw_lle.h>57 #include <debug/constants/dw_lle.inc> 58 58 }; 59 59 60 60 static const char *const dw_ate_names[] = { 61 #include <debug/constants/dw_ate.h>61 #include <debug/constants/dw_ate.inc> 62 62 }; 63 63 64 64 static const char *const dw_ds_names[] = { 65 #include <debug/constants/dw_ds.h>65 #include <debug/constants/dw_ds.inc> 66 66 }; 67 67 68 68 static const char *const dw_end_names[] = { 69 #include <debug/constants/dw_end.h>69 #include <debug/constants/dw_end.inc> 70 70 }; 71 71 72 72 static const char *const dw_access_names[] = { 73 #include <debug/constants/dw_access.h>73 #include <debug/constants/dw_access.inc> 74 74 }; 75 75 76 76 static const char *const dw_vis_names[] = { 77 #include <debug/constants/dw_vis.h>77 #include <debug/constants/dw_vis.inc> 78 78 }; 79 79 80 80 static const char *const dw_virtuality_names[] = { 81 #include <debug/constants/dw_virtuality.h>81 #include <debug/constants/dw_virtuality.inc> 82 82 }; 83 83 84 84 static const char *const dw_lang_names[] = { 85 #include <debug/constants/dw_lang.h>85 #include <debug/constants/dw_lang.inc> 86 86 }; 87 87 88 88 static const char *const dw_id_names[] = { 89 #include <debug/constants/dw_id.h>89 #include <debug/constants/dw_id.inc> 90 90 }; 91 91 92 92 static const char *const dw_cc_names[] = { 93 #include <debug/constants/dw_cc.h>93 #include <debug/constants/dw_cc.inc> 94 94 }; 95 95 96 96 static const char *const dw_lns_names[] = { 97 #include <debug/constants/dw_lns.h>97 #include <debug/constants/dw_lns.inc> 98 98 }; 99 99 100 100 static const char *const dw_lne_names[] = { 101 #include <debug/constants/dw_lne.h>101 #include <debug/constants/dw_lne.inc> 102 102 }; 103 103 104 104 static const char *const dw_lnct_names[] = { 105 #include <debug/constants/dw_lnct.h>105 #include <debug/constants/dw_lnct.inc> 106 106 }; 107 107 -
kernel/generic/src/debug/stacktrace.c
r2fbb42f r001957b6 125 125 static bool 126 126 resolve_kernel_address(uintptr_t addr, int op_index, 127 128 129 127 const char **symbol, uintptr_t *symbol_addr, 128 const char **filename, const char **dirname, 129 int *line, int *column) 130 130 { 131 131 *symbol_addr = 0; -
kernel/generic/src/debug/util.c
r2fbb42f r001957b6 33 33 #include <debug/names.h> 34 34 35 /* These declarations cause global definitions for the functions to be emitted 35 /* 36 * These declarations cause global definitions for the functions to be emitted 36 37 * in this compilation unit, so if the compiler decides not to inline some of 37 38 * them, only one external copy exists. See C99 inline rules. … … 186 187 187 188 void print_block(const uint8_t **const data, 188 189 const uint8_t *data_end, unsigned bytes) 189 190 { 190 191 while (bytes > 0 && *data < data_end) { … … 196 197 197 198 void print_formed_data(unsigned form, const uint8_t **const data, 198 199 const uint8_t *data_end, unsigned width) 199 200 { 200 201 size_t len; … … 266 267 uint64_t data1 = read_uint64(data, data_end); 267 268 uint64_t data2 = read_uint64(data, data_end); 268 DEBUGF("0x%016" PRIx64"%016"PRIx64, data2, data1);269 DEBUGF("0x%016" PRIx64 "%016" PRIx64, data2, data1); 269 270 break; 270 271 -
kernel/generic/src/debug/util.h
r2fbb42f r001957b6 54 54 } 55 55 56 /* Casting to these structures allows us to read unaligned integers safely. */ 57 struct u16 { 58 uint16_t val; 59 } __attribute__((packed)); 60 61 struct u32 { 62 uint32_t val; 63 } __attribute__((packed)); 64 65 struct u64 { 66 uint64_t val; 67 } __attribute__((packed)); 68 56 69 inline uint16_t read_uint16(const uint8_t **data, const uint8_t *data_end) 57 70 { 58 /* Casting to these structures allows us to read unaligned integers safely. */59 struct u16 {60 uint16_t val;61 } __attribute__((packed));62 63 71 if (*data + 2 > data_end) { 64 72 /* Safe exit path for malformed input. */ … … 92 100 inline uint32_t read_uint32(const uint8_t **data, const uint8_t *data_end) 93 101 { 94 struct u32 {95 uint32_t val;96 } __attribute__((packed));97 98 102 if (*data + 4 > data_end) { 99 103 /* Safe exit path for malformed input. */ … … 109 113 inline uint64_t read_uint64(const uint8_t **data, const uint8_t *data_end) 110 114 { 111 struct u64 {112 uint64_t val;113 } __attribute__((packed));114 115 115 if (*data + 8 > data_end) { 116 116 /* Safe exit path for malformed input. */
Note:
See TracChangeset
for help on using the changeset viewer.