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 |
|
|
|
13 |
|
|
class AddressToLineMapping |
14 |
|
|
{ |
15 |
|
|
public: |
16 |
|
|
|
17 |
|
|
struct AddrToLineInfo |
18 |
|
|
{ |
19 |
|
|
int fileIdx; |
20 |
|
|
int line; |
21 |
|
|
int addr; |
22 |
|
|
}; |
23 |
|
|
|
24 |
|
|
// resets the mapping to initial state |
25 |
|
|
void reset(); |
26 |
|
|
|
27 |
|
|
// Adds information of what source file and line number an output rom address is at |
28 |
|
|
void includeMapping(const char* filename, int line, int addr); |
29 |
|
|
|
30 |
|
1197 |
struct FileInfo |
31 |
|
|
{ |
32 |
|
|
string filename; |
33 |
|
|
uint32_t fileCrc; |
34 |
|
|
}; |
35 |
|
91 |
const autoarray<FileInfo>& getFileList() const { return m_fileList; } |
36 |
|
91 |
const autoarray<AddrToLineInfo>& getAddrToLineInfo() const { return m_addrToLineInfo; } |
37 |
|
|
|
38 |
|
|
private: |
39 |
|
|
|
40 |
|
|
// Helper to add file to list, and get the index of that file |
41 |
|
|
int getFileIndex(const char* filename); |
42 |
|
|
|
43 |
|
|
autoarray<FileInfo> m_fileList; |
44 |
|
|
// parallel list of crcs of the filenames in fileList, to speed up lookups |
45 |
|
|
autoarray<uint32_t> m_filenameCrcs; |
46 |
|
|
|
47 |
|
|
|
48 |
|
|
autoarray<AddrToLineInfo> m_addrToLineInfo; |
49 |
|
|
}; |
50 |
|
|
|
51 |
|
|
extern AddressToLineMapping addressToLineMapping; |
52 |
|
|
|