diff options
author | Vladimir Mezentsev <vladimir.mezentsev@oracle.com> | 2023-03-05 17:35:53 -0800 |
---|---|---|
committer | Vladimir Mezentsev <vladimir.mezentsev@oracle.com> | 2023-03-07 09:56:19 -0800 |
commit | 74f1d7f4a3183bca13058dde29f5559d480a1b51 (patch) | |
tree | 3c9e830cbc6c2fd17b55b1629e3a251a06d7451d /gprofng/src/DwarfLib.h | |
parent | 5fc6b6d44cd63651c2902cbfc5b9734a55aaa617 (diff) | |
download | gdb-74f1d7f4a3183bca13058dde29f5559d480a1b51.zip gdb-74f1d7f4a3183bca13058dde29f5559d480a1b51.tar.gz gdb-74f1d7f4a3183bca13058dde29f5559d480a1b51.tar.bz2 |
gprofng: read Dwarf 5
gprofng reads Dwarf to find function names, sources, and line numbers.
gprofng skips other debug information.
I fixed three places in gprofng Dwarf reader:
- parsing the compilation unit header.
- parsing the line number table header.
- parsing new DW_FORMs.
Tested on aarch64-linux/x86_64-linux.
gprofng/ChangeLog
2023-03-05 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
PR gprofng/30195
gprofng/src/Dwarf.cc: Support Dwarf-5.
gprofng/src/DwarfLib.cc: Likewise.
gprofng/src/Dwarf.h: Likewise.
gprofng/src/DwarfLib.h: Likewise.
gprofng/src/collctrl.cc: Don't read freed memory.
Diffstat (limited to 'gprofng/src/DwarfLib.h')
-rw-r--r-- | gprofng/src/DwarfLib.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gprofng/src/DwarfLib.h b/gprofng/src/DwarfLib.h index d359c75..6baecac 100644 --- a/gprofng/src/DwarfLib.h +++ b/gprofng/src/DwarfLib.h @@ -61,8 +61,10 @@ public: uint64_t ReadLength (); SLEB128 GetSLEB128 (); ULEB128 GetULEB128 (); - char *GetString (uint64_t *lenp); + char *GetString (); char *GetData (uint64_t len); + uint32_t Get_24 (); + uint64_t get_value (int dw_form); void dump (char *msg); inline uint32_t @@ -84,6 +86,8 @@ public: bool fmt64; bool addr32; bool need_swap_endian; + int address_size; + int segment_selector_size; // DWARF 5 private: bool isCopy; @@ -132,7 +136,7 @@ public: class DwrLineRegs { public: - DwrLineRegs (DwrSec *_secp, char *dirName); + DwrLineRegs (Dwarf *_dwarf, DwrSec *_secp, char *dirName); ~DwrLineRegs (); char *getPath (int fn); Vector<DwrLine *> *get_lines (); @@ -146,7 +150,9 @@ private: void DoSpecialOpcode (int opcode); void EmitLine (); void reset (); + Vector <DwrFileName *> *read_file_names_dwarf5 (); + Dwarf *dwarf; char *fname; uint64_t dir_index; uint64_t timestamp; @@ -167,7 +173,7 @@ private: bool basic_block; bool end_sequence; Vector<DwrLine *> *lines; - Vector<char *> *include_directories; + Vector<DwrFileName *> *dir_names; Dwarf_Small *standard_opcode_length; DwrSec *debug_lineSec; uint64_t header_length; @@ -269,6 +275,7 @@ public: static char *at2str (int tag); static char *form2str (int tag); static char *tag2str (int tag); + static char *lnct2str (int ty); uint64_t cu_header_offset; uint64_t cu_offset; @@ -302,6 +309,7 @@ private: uint64_t stmt_list_offset; // offset in .debug_line section (DW_AT_stmt_list) char *comp_dir; // compilation directory (DW_AT_comp_dir) Module *module; + int unit_type; Dwarf_Half version; Dwarf_Small address_size; Dwr_Tag dwrTag; |