Skip to content

replace .dump with DWARF v5 .debug_* sections for merged-format ELFs - #376

Draft
sayyanna wants to merge 2 commits into
Xilinx:main-gefrom
sayyanna:dwarf_5
Draft

replace .dump with DWARF v5 .debug_* sections for merged-format ELFs#376
sayyanna wants to merge 2 commits into
Xilinx:main-gefrom
sayyanna:dwarf_5

Conversation

@sayyanna

@sayyanna sayyanna commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Problem solved by the commit

Replaces the non-standard JSON .dump ELF section with standard DWARF v5
.debug_* sections for merged-format AIE config ELFs (abi_version=0x21,
.target directive present). Legacy per-page ELFs continue using .dump
unchanged.
Motivation: .dump is a proprietary JSON blob not understood by any
standard 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 .dump size.

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::dwarf5 namespace); consumed by both writer and reader
  • src/cpp/encoder/aie2ps/dwarf_writer.h/.cpp — emits .debug_abbrev,
    .debug_str, .debug_line, .debug_info from the Debug/Function/
    Line objects already produced by the encoder
  • src/cpp/tools/dwarf_reader.h/.cpp — parses the above sections;
    provides find_row(col, page_idx, offset) and get_all_rows()

Modified files

  • common/code_section.hdebug = 5 enum value (no SHF_ALLOC,
    no PT_LOAD segment)
  • elf/elfwriter.cppcode_section::debug branch; group-ELF suffix
    appended to section names (.debug_info.0, etc.)
  • encoder/encoder.h — virtual set_cu_name() no-op on base class
  • encoder/aie2ps/aie2ps_encoder.h/.cppm_cu_name member;
    set_cu_name() override; DWARF path gated on
    use_merged_ctrltext_sections(); legacy .dump path unchanged
  • analyzer/transform_manager.hget_elfio() const accessor
  • tools/debug_tools.h/.cpp — DWARF fallback in get_dump_section();
    tries .dump first, falls back to dwarf_reader, throws if both absent
  • tools/trace_probe.cpp — 3-pass DWARF path in
    write_trace_probes_from_dwarf(): pass 1 conflict detection, pass 2
    line 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 line
  • src/cpp/CMakeLists.txt — registers dwarf_writer.cpp,
    dwarf_reader.cpp
  • test/aie2ps-ctrlcode/decode_opcode/CMakeLists.txt — expected values
    updated 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_page

Risks (if any) associated the changes in the commit

None

Backward compatibility

  • Legacy ELFs (no .target): .dump emitted as before; no DWARF
  • New merged ELFs: .debug_* emitted; no .dump
  • Consumers: .dump-first fallback to DWARF; old JSON callers unaffected

What has been tested and how, request additional testing if necessary

  • aie2ps_decode_opcode_assemble ctest 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

Signed-off-by: Sri Latha Ayyannagari <SriLatha.Ayyannagari@amd.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 25 out of 65. Check the log or trigger a new build to see more.


// ── 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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) ────────────────────────────────────────────────

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: unknown type name 'size_t'; did you mean 'std::size_t'? [clang-diagnostic-error]

Suggested change
// ── 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) {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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";
                                                    ^

Comment thread src/cpp/encoder/aie2ps/dwarf_writer.cpp Outdated
do {
uint8_t byte = v & 0x7F;
v >>= 7;
if (v != 0) byte |= 0x80;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 0xFF is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]

<uint8_t>((v >> 16) & 0xFF);
                      ^

Comment thread src/cpp/encoder/aie2ps/dwarf_writer.cpp Outdated
do {
uint8_t byte = v & 0x7F;
v >>= 7;
if (v != 0) byte |= 0x80;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 0xFF is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]

) & 0xFF);
    ^

Comment thread src/cpp/encoder/aie2ps/dwarf_writer.cpp Outdated

void dwarf_writer::append_sleb128(std::vector<uint8_t>& buf, int64_t v)
{
bool more = true;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: avoid do-while loops [cppcoreguidelines-avoid-do-while]

 uint64_t v)
                 ^

Signed-off-by: Sri Latha Ayyannagari <SriLatha.Ayyannagari@amd.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

{
struct vec_streambuf : std::streambuf {
std::vector<uint8_t>& buf;
explicit vec_streambuf(std::vector<uint8_t>& b) : buf(b) {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use auto when initializing with a cast to avoid duplicating the type name [hicpp-use-auto]

Suggested change
// 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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use auto when initializing with a cast to avoid duplicating the type name [hicpp-use-auto]

Suggested change
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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use auto when initializing with a cast to avoid duplicating the type name [hicpp-use-auto]

Suggested change
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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use auto when initializing with a cast to avoid duplicating the type name [hicpp-use-auto]

Suggested change
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';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use auto when initializing with a cast to avoid duplicating the type name [hicpp-use-auto]

Suggested change
stream << "ELF File: " << filename << '\n';
;
2_t page32 = static_cast<uint32_t>(page_index);
_t page32 = staauto<uint32_t>(page_index);

@sayyanna
sayyanna marked this pull request as draft September 9, 2026 22:17
@larry9523

larry9523 commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

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

@larry9523

Copy link
Copy Markdown
Collaborator

Another important issue is we need to update libdtrace parser part. Otherwise, we will break the dtrace functionalities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants