asar coverage - build #197


src/asar/
File: src/asar/addr2line.h
Date: 2024-01-31 09:19:03
Lines:
1/3
33.3%
Functions:
0/2
0.0%
Branches:
0/0
-%

Line Branch Exec Source
1 #pragma once
2
3 //////////////////////////////////////////////////////////////////////////
4 // Class to store address-to-line mappings for richer symbolic information
5 //
6 // During assembly, included files and information about generated asm
7 // should be added to this, and then read back during symbol file
8 // generation
9
10 #include "autoarray.h"
11 #include "libstr.h"
12 #include <cstdint>
13
14 class AddressToLineMapping
15 {
16 public:
17
18 struct AddrToLineInfo
19 {
20 int fileIdx;
21 int line;
22 int addr;
23 };
24
25 // resets the mapping to initial state
26 void reset();
27
28 // Adds information of what source file and line number an output rom address is at
29 void includeMapping(const char* filename, int line, int addr);
30
31 367 struct FileInfo
32 {
33 string filename;
34 uint32_t fileCrc;
35 };
36 const autoarray<FileInfo>& getFileList() const { return m_fileList; }
37 const autoarray<AddrToLineInfo>& getAddrToLineInfo() const { return m_addrToLineInfo; }
38
39 private:
40
41 // Helper to add file to list, and get the index of that file
42 int getFileIndex(const char* filename);
43
44 autoarray<FileInfo> m_fileList;
45 // parallel list of crcs of the filenames in fileList, to speed up lookups
46 autoarray<uint32_t> m_filenameCrcs;
47
48
49 autoarray<AddrToLineInfo> m_addrToLineInfo;
50 };
51
52 extern AddressToLineMapping addressToLineMapping;
53