replace .dump with DWARF v5 .debug_* sections for merged-format ELFs - #376
replace .dump with DWARF v5 .debug_* sections for merged-format ELFs#376sayyanna wants to merge 2 commits into
Conversation
Signed-off-by: Sri Latha Ayyannagari <SriLatha.Ayyannagari@amd.com>
|
|
||
| // ── Column name prefix used in DW_AT_name for DW_TAG_module DIEs ───────── | ||
| inline constexpr char COLUMN_PREFIX[] = "column "; | ||
| inline constexpr size_t COLUMN_PREFIX_LEN = 7; |
There was a problem hiding this comment.
warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays]
nline constexpr char COLUMN_PREFIX[] = "column ";
^| inline constexpr char COLUMN_PREFIX[] = "column "; | ||
| inline constexpr size_t COLUMN_PREFIX_LEN = 7; | ||
|
|
||
| // ── Unit types (Table 7.2) ──────────────────────────────────────────────── |
There was a problem hiding this comment.
warning: unknown type name 'size_t'; did you mean 'std::size_t'? [clang-diagnostic-error]
| // ── Unit types (Table 7.2) ──────────────────────────────────────────────── | |
| mn ";std::size_t |
Additional context
/usr/include/x86_64-linux-gnu/c++/13/bits/c++config.h:307: 'std::size_t' declared here
typedef __SIZE_TYPE__ size_t;
^| { | ||
| struct vec_streambuf : std::streambuf { | ||
| std::vector<uint8_t>& buf; | ||
| explicit vec_streambuf(std::vector<uint8_t>& b) : buf(b) {} |
There was a problem hiding this comment.
warning: Method called on moved-from object 'debug_info' of type 'std::vector' [clang-analyzer-cplusplus.Move]
log_info() << "DWARF .debug_info size: " << ds.debug_info.size() << " bytes\n";
^Additional context
src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:112: Taking false branch
if (get_log_level() >= log_level::info)
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:115: Assuming field 'm_dump_flag' is not equal to full
if (m_dump_flag == asm_dump_flag::full) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:115: Taking false branch
if (m_dump_flag == asm_dump_flag::full) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:123: Assuming field 'm_dump_flag' is not equal to disable
if (m_dump_flag != asm_dump_flag::disable) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:123: Taking true branch
if (m_dump_flag != asm_dump_flag::disable) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:124: Assuming the condition is true
if (use_merged_ctrltext_sections()) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:124: Taking true branch
if (use_merged_ctrltext_sections()) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:128: Assuming the condition is false
const std::string cu_name = m_cu_name.empty() ? "aiebu" : m_cu_name;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:128: '?' condition is false
const std::string cu_name = m_cu_name.empty() ? "aiebu" : m_cu_name;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:143: Calling 'operator()'
push_dbg(".debug_info", ds.debug_info);
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:134: Assuming the condition is false
if (data.empty()) return;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:134: Taking false branch
if (data.empty()) return;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:136: Calling 'section_writer::set_data'
w->set_data(data);
^src/cpp/common/writer.h:99: Object 'debug_info' of type 'std::vector' is left in a valid but unspecified state after move
m_data = std::move(data);
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:136: Returning from 'section_writer::set_data'
w->set_data(data);
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:143: Returning from 'operator()'
push_dbg(".debug_info", ds.debug_info);
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:145: Method called on moved-from object 'debug_info' of type 'std::vector'
log_info() << "DWARF .debug_info size: " << ds.debug_info.size() << " bytes\n";
^| struct vec_streambuf : std::streambuf { | ||
| std::vector<uint8_t>& buf; | ||
| explicit vec_streambuf(std::vector<uint8_t>& b) : buf(b) {} | ||
| std::streamsize xsputn(const char* s, std::streamsize n) override { |
There was a problem hiding this comment.
warning: Method called on moved-from object 'debug_line' of type 'std::vector' [clang-analyzer-cplusplus.Move]
log_info() << "DWARF .debug_line size: " << ds.debug_line.size() << " bytes\n";
^Additional context
src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:112: Taking false branch
if (get_log_level() >= log_level::info)
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:115: Assuming field 'm_dump_flag' is not equal to full
if (m_dump_flag == asm_dump_flag::full) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:115: Taking false branch
if (m_dump_flag == asm_dump_flag::full) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:123: Assuming field 'm_dump_flag' is not equal to disable
if (m_dump_flag != asm_dump_flag::disable) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:123: Taking true branch
if (m_dump_flag != asm_dump_flag::disable) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:124: Assuming the condition is true
if (use_merged_ctrltext_sections()) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:124: Taking true branch
if (use_merged_ctrltext_sections()) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:128: Assuming the condition is false
const std::string cu_name = m_cu_name.empty() ? "aiebu" : m_cu_name;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:128: '?' condition is false
const std::string cu_name = m_cu_name.empty() ? "aiebu" : m_cu_name;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:142: Calling 'operator()'
push_dbg(".debug_line", ds.debug_line);
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:134: Assuming the condition is false
if (data.empty()) return;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:134: Taking false branch
if (data.empty()) return;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:136: Calling 'section_writer::set_data'
w->set_data(data);
^src/cpp/common/writer.h:99: Object 'debug_line' of type 'std::vector' is left in a valid but unspecified state after move
m_data = std::move(data);
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:136: Returning from 'section_writer::set_data'
w->set_data(data);
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:142: Returning from 'operator()'
push_dbg(".debug_line", ds.debug_line);
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:146: Method called on moved-from object 'debug_line' of type 'std::vector'
log_info() << "DWARF .debug_line size: " << ds.debug_line.size() << " bytes\n";
^| std::vector<uint8_t>& buf; | ||
| explicit vec_streambuf(std::vector<uint8_t>& b) : buf(b) {} | ||
| std::streamsize xsputn(const char* s, std::streamsize n) override { | ||
| buf.insert(buf.end(), reinterpret_cast<const uint8_t*>(s), |
There was a problem hiding this comment.
warning: Method called on moved-from object 'debug_str' of type 'std::vector' [clang-analyzer-cplusplus.Move]
log_info() << "DWARF .debug_str size: " << ds.debug_str.size() << " bytes\n";
^Additional context
src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:112: Taking false branch
if (get_log_level() >= log_level::info)
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:115: Assuming field 'm_dump_flag' is not equal to full
if (m_dump_flag == asm_dump_flag::full) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:115: Taking false branch
if (m_dump_flag == asm_dump_flag::full) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:123: Assuming field 'm_dump_flag' is not equal to disable
if (m_dump_flag != asm_dump_flag::disable) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:123: Taking true branch
if (m_dump_flag != asm_dump_flag::disable) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:124: Assuming the condition is true
if (use_merged_ctrltext_sections()) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:124: Taking true branch
if (use_merged_ctrltext_sections()) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:128: Assuming the condition is false
const std::string cu_name = m_cu_name.empty() ? "aiebu" : m_cu_name;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:128: '?' condition is false
const std::string cu_name = m_cu_name.empty() ? "aiebu" : m_cu_name;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:141: Calling 'operator()'
push_dbg(".debug_str", ds.debug_str);
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:134: Assuming the condition is false
if (data.empty()) return;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:134: Taking false branch
if (data.empty()) return;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:136: Calling 'section_writer::set_data'
w->set_data(data);
^src/cpp/common/writer.h:99: Object 'debug_str' of type 'std::vector' is left in a valid but unspecified state after move
m_data = std::move(data);
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:136: Returning from 'section_writer::set_data'
w->set_data(data);
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:141: Returning from 'operator()'
push_dbg(".debug_str", ds.debug_str);
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:147: Method called on moved-from object 'debug_str' of type 'std::vector'
log_info() << "DWARF .debug_str size: " << ds.debug_str.size() << " bytes\n";
^| do { | ||
| uint8_t byte = v & 0x7F; | ||
| v >>= 7; | ||
| if (v != 0) byte |= 0x80; |
There was a problem hiding this comment.
warning: 0xFF is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
<uint8_t>((v >> 16) & 0xFF);
^| do { | ||
| uint8_t byte = v & 0x7F; | ||
| v >>= 7; | ||
| if (v != 0) byte |= 0x80; |
There was a problem hiding this comment.
warning: 16 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
<uint8_t>((v >> 16) & 0xFF);
^| if (v != 0) byte |= 0x80; | ||
| buf.push_back(byte); | ||
| } while (v != 0); | ||
| } |
There was a problem hiding this comment.
warning: 24 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
24) & 0xFF);
^| } while (v != 0); | ||
| } | ||
|
|
||
| void dwarf_writer::append_sleb128(std::vector<uint8_t>& buf, int64_t v) |
There was a problem hiding this comment.
warning: 0xFF is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
) & 0xFF);
^|
|
||
| void dwarf_writer::append_sleb128(std::vector<uint8_t>& buf, int64_t v) | ||
| { | ||
| bool more = true; |
There was a problem hiding this comment.
warning: avoid do-while loops [cppcoreguidelines-avoid-do-while]
uint64_t v)
^Signed-off-by: Sri Latha Ayyannagari <SriLatha.Ayyannagari@amd.com>
| { | ||
| struct vec_streambuf : std::streambuf { | ||
| std::vector<uint8_t>& buf; | ||
| explicit vec_streambuf(std::vector<uint8_t>& b) : buf(b) {} |
There was a problem hiding this comment.
warning: Method called on moved-from object 'debug_info' of type 'std::vector' [clang-analyzer-cplusplus.Move]
log_info() << "DWARF .debug_info size: " << ds.debug_info.size() << " bytes\n";
^Additional context
src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:112: Taking false branch
if (get_log_level() >= log_level::info)
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:115: Assuming field 'm_dump_flag' is not equal to full
if (m_dump_flag == asm_dump_flag::full) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:115: Taking false branch
if (m_dump_flag == asm_dump_flag::full) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:123: Assuming field 'm_dump_flag' is not equal to disable
if (m_dump_flag != asm_dump_flag::disable) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:123: Taking true branch
if (m_dump_flag != asm_dump_flag::disable) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:124: Assuming the condition is true
if (use_merged_ctrltext_sections()) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:124: Taking true branch
if (use_merged_ctrltext_sections()) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:128: Assuming the condition is false
const std::string cu_name = m_cu_name.empty() ? "aiebu" : m_cu_name;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:128: '?' condition is false
const std::string cu_name = m_cu_name.empty() ? "aiebu" : m_cu_name;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:144: Object 'debug_info' of type 'std::vector' is left in a valid but unspecified state after move
push_dbg(".debug_info", std::move(ds.debug_info));
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:146: Method called on moved-from object 'debug_info' of type 'std::vector'
log_info() << "DWARF .debug_info size: " << ds.debug_info.size() << " bytes\n";
^| struct vec_streambuf : std::streambuf { | ||
| std::vector<uint8_t>& buf; | ||
| explicit vec_streambuf(std::vector<uint8_t>& b) : buf(b) {} | ||
| std::streamsize xsputn(const char* s, std::streamsize n) override { |
There was a problem hiding this comment.
warning: Method called on moved-from object 'debug_line' of type 'std::vector' [clang-analyzer-cplusplus.Move]
log_info() << "DWARF .debug_line size: " << ds.debug_line.size() << " bytes\n";
^Additional context
src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:112: Taking false branch
if (get_log_level() >= log_level::info)
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:115: Assuming field 'm_dump_flag' is not equal to full
if (m_dump_flag == asm_dump_flag::full) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:115: Taking false branch
if (m_dump_flag == asm_dump_flag::full) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:123: Assuming field 'm_dump_flag' is not equal to disable
if (m_dump_flag != asm_dump_flag::disable) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:123: Taking true branch
if (m_dump_flag != asm_dump_flag::disable) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:124: Assuming the condition is true
if (use_merged_ctrltext_sections()) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:124: Taking true branch
if (use_merged_ctrltext_sections()) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:128: Assuming the condition is false
const std::string cu_name = m_cu_name.empty() ? "aiebu" : m_cu_name;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:128: '?' condition is false
const std::string cu_name = m_cu_name.empty() ? "aiebu" : m_cu_name;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:143: Object 'debug_line' of type 'std::vector' is left in a valid but unspecified state after move
push_dbg(".debug_line", std::move(ds.debug_line));
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:147: Method called on moved-from object 'debug_line' of type 'std::vector'
log_info() << "DWARF .debug_line size: " << ds.debug_line.size() << " bytes\n";
^| std::vector<uint8_t>& buf; | ||
| explicit vec_streambuf(std::vector<uint8_t>& b) : buf(b) {} | ||
| std::streamsize xsputn(const char* s, std::streamsize n) override { | ||
| buf.insert(buf.end(), reinterpret_cast<const uint8_t*>(s), |
There was a problem hiding this comment.
warning: Method called on moved-from object 'debug_str' of type 'std::vector' [clang-analyzer-cplusplus.Move]
log_info() << "DWARF .debug_str size: " << ds.debug_str.size() << " bytes\n";
^Additional context
src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:112: Taking false branch
if (get_log_level() >= log_level::info)
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:115: Assuming field 'm_dump_flag' is not equal to full
if (m_dump_flag == asm_dump_flag::full) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:115: Taking false branch
if (m_dump_flag == asm_dump_flag::full) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:123: Assuming field 'm_dump_flag' is not equal to disable
if (m_dump_flag != asm_dump_flag::disable) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:123: Taking true branch
if (m_dump_flag != asm_dump_flag::disable) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:124: Assuming the condition is true
if (use_merged_ctrltext_sections()) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:124: Taking true branch
if (use_merged_ctrltext_sections()) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:128: Assuming the condition is false
const std::string cu_name = m_cu_name.empty() ? "aiebu" : m_cu_name;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:128: '?' condition is false
const std::string cu_name = m_cu_name.empty() ? "aiebu" : m_cu_name;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:142: Object 'debug_str' of type 'std::vector' is left in a valid but unspecified state after move
push_dbg(".debug_str", std::move(ds.debug_str));
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:148: Method called on moved-from object 'debug_str' of type 'std::vector'
log_info() << "DWARF .debug_str size: " << ds.debug_str.size() << " bytes\n";
^| explicit vec_streambuf(std::vector<uint8_t>& b) : buf(b) {} | ||
| std::streamsize xsputn(const char* s, std::streamsize n) override { | ||
| buf.insert(buf.end(), reinterpret_cast<const uint8_t*>(s), | ||
| reinterpret_cast<const uint8_t*>(s) + n); |
There was a problem hiding this comment.
warning: Method called on moved-from object 'debug_abbrev' of type 'std::vector' [clang-analyzer-cplusplus.Move]
log_info() << "DWARF .debug_abbrev size: " << ds.debug_abbrev.size() << " bytes\n";
^Additional context
src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:112: Taking false branch
if (get_log_level() >= log_level::info)
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:115: Assuming field 'm_dump_flag' is not equal to full
if (m_dump_flag == asm_dump_flag::full) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:115: Taking false branch
if (m_dump_flag == asm_dump_flag::full) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:123: Assuming field 'm_dump_flag' is not equal to disable
if (m_dump_flag != asm_dump_flag::disable) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:123: Taking true branch
if (m_dump_flag != asm_dump_flag::disable) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:124: Assuming the condition is true
if (use_merged_ctrltext_sections()) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:124: Taking true branch
if (use_merged_ctrltext_sections()) {
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:128: Assuming the condition is false
const std::string cu_name = m_cu_name.empty() ? "aiebu" : m_cu_name;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:128: '?' condition is false
const std::string cu_name = m_cu_name.empty() ? "aiebu" : m_cu_name;
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:141: Object 'debug_abbrev' of type 'std::vector' is left in a valid but unspecified state after move
push_dbg(".debug_abbrev", std::move(ds.debug_abbrev));
^src/cpp/encoder/aie2ps/aie2ps_encoder.cpp:149: Method called on moved-from object 'debug_abbrev' of type 'std::vector'
log_info() << "DWARF .debug_abbrev size: " << ds.debug_abbrev.size() << " bytes\n";
^| // DW_AT_name DW_FORM_strp | ||
| // Abbrev 2: DW_TAG_module, has_children | ||
| // DW_AT_name DW_FORM_strp | ||
| // DW_AT_stmt_list DW_FORM_sec_offset |
There was a problem hiding this comment.
warning: use auto when initializing with a cast to avoid duplicating the type name [hicpp-use-auto]
| // DW_AT_stmt_list DW_FORM_sec_offset | |
| return it->second; | |
| _t offseautoic_cast<uint32_t>(m_str_buf.size()); |
| const uint8_t* program_start = p + header_length; | ||
| if (program_start > stmt_end) return; | ||
|
|
||
| uint8_t min_inst_len = 0; p = read_u8(p, min_inst_len); |
There was a problem hiding this comment.
warning: 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
line_data + line_size;
^|
|
||
| // Parse DWARF v5 prologue tables and collect file names. | ||
| std::vector<std::string> filenames; | ||
| if (p < program_start) { |
There was a problem hiding this comment.
warning: use auto when initializing with a cast to avoid duplicating the type name [hicpp-use-auto]
| if (p < program_start) { | |
| ne_base_u);auto |
| // Special opcode | ||
| if (line_range == 0) break; // guard against degenerate prologue | ||
| const auto adjusted = static_cast<uint8_t>(opcode - opcode_base); | ||
| const auto line_inc = static_cast<int32_t>(line_base) + static_cast<int32_t>(adjusted % line_range); |
There was a problem hiding this comment.
warning: use auto when initializing with a cast to avoid duplicating the type name [hicpp-use-auto]
| const auto line_inc = static_cast<int32_t>(line_base) + static_cast<int32_t>(adjusted % line_range); | |
| t auto opcode_idx = static_cast<size_t>(opcode - 1U); |
| const dwarf_reader* dr = get_dwarf_reader(); | ||
| const uint32_t offset32 = static_cast<uint32_t>(pc); | ||
| const uint32_t page32 = static_cast<uint32_t>(page_index); | ||
| const dwarf_debug_row row = dr->find_row(uc_index, page32, offset32); |
There was a problem hiding this comment.
warning: use auto when initializing with a cast to avoid duplicating the type name [hicpp-use-auto]
| const dwarf_debug_row row = dr->find_row(uc_index, page32, offset32); | |
| ;auto |
| const uint32_t page32 = static_cast<uint32_t>(page_index); | ||
| const dwarf_debug_row row = dr->find_row(uc_index, page32, offset32); | ||
|
|
||
| stream << "ELF File: " << filename << '\n'; |
There was a problem hiding this comment.
warning: use auto when initializing with a cast to avoid duplicating the type name [hicpp-use-auto]
| stream << "ELF File: " << filename << '\n'; | |
| ; | |
| 2_t page32 = static_cast<uint32_t>(page_index); | |
| _t page32 = staauto<uint32_t>(page_index); |
|
We can not use .debug_info.0. It has to be .debug_info to be compatible with GNU Binutils and llvm tool. Please attach output from llvm-dwarfdump --debug-* and readelf --debug-dump=*. Also, make sure llvm-dwarfdump --verify is happy |
|
Another important issue is we need to update libdtrace parser part. Otherwise, we will break the dtrace functionalities. |
Problem solved by the commit
Replaces the non-standard JSON
.dumpELF section with standard DWARF v5.debug_*sections for merged-format AIE config ELFs (abi_version=0x21,.targetdirective present). Legacy per-page ELFs continue using.dumpunchanged.
Motivation:
.dumpis a proprietary JSON blob not understood by anystandard tooling. DWARF v5 sections are readable by
llvm-dwarfdump,gdb,objdump --dwarf, and any DWARF-aware debugger or profiler.DWARF section size is much less than
.dumpsize.How problem was solved, alternative solutions (if any) and why they were rejected
New files
src/cpp/common/dwarf_constants.h— shared DWARF v5 encoding constants(
aiebu::dwarf5namespace); consumed by both writer and readersrc/cpp/encoder/aie2ps/dwarf_writer.h/.cpp— emits.debug_abbrev,.debug_str,.debug_line,.debug_infofrom theDebug/Function/Lineobjects already produced by the encodersrc/cpp/tools/dwarf_reader.h/.cpp— parses the above sections;provides
find_row(col, page_idx, offset)andget_all_rows()Modified files
common/code_section.h—debug = 5enum value (noSHF_ALLOC,no
PT_LOADsegment)elf/elfwriter.cpp—code_section::debugbranch; group-ELF suffixappended to section names (
.debug_info.0, etc.)encoder/encoder.h— virtualset_cu_name()no-op on base classencoder/aie2ps/aie2ps_encoder.h/.cpp—m_cu_namemember;set_cu_name()override; DWARF path gated onuse_merged_ctrltext_sections(); legacy.dumppath unchangedanalyzer/transform_manager.h—get_elfio() constaccessortools/debug_tools.h/.cpp— DWARF fallback inget_dump_section();tries
.dumpfirst, falls back todwarf_reader, throws if both absenttools/trace_probe.cpp— 3-pass DWARF path inwrite_trace_probes_from_dwarf(): pass 1 conflict detection, pass 2line probes, pass 3 annotation probes (joined on address)
tools/opcode_information.cpp— ISA binary walk for opcode name/args,supplemented by
dwarf_reader.find_row()for source file and linesrc/cpp/CMakeLists.txt— registersdwarf_writer.cpp,dwarf_reader.cpptest/aie2ps-ctrlcode/decode_opcode/CMakeLists.txt— expected valuesupdated for DWARF path (ISA walk decimal arg format; full source path)
DWARF structure produced
DW_TAG_compile_unit ← one per kernel:instance ("DPU:dpu")
DW_TAG_module ← one per column
DW_AT_stmt_list → .debug_line offset
DW_TAG_label ← one per annotated instruction
DW_AT_low_pc, DW_AT_name, DW_AT_const_value, DW_AT_description
Address encoding:
lowpc = page_index × 0x2000 + byte_offset_in_pageRisks (if any) associated the changes in the commit
None
Backward compatibility
.target):.dumpemitted as before; no DWARF.debug_*emitted; no.dump.dump-first fallback to DWARF; old JSON callers unaffectedWhat has been tested and how, request additional testing if necessary
aie2ps_decode_opcode_assemblectest passes; verifies opcode name,args (ISA walk), source file and line (DWARF reader)
Documentation impact (if any)
Yes, need to update the document with dwarf information