summaryrefslogtreecommitdiff
path: root/other/Kermit/include/SymbolTable.hpp
diff options
context:
space:
mode:
authorRoot THC2026-02-24 12:42:47 +0000
committerRoot THC2026-02-24 12:42:47 +0000
commitc9cbeced5b3f2bdd7407e29c0811e65954132540 (patch)
treeaefc355416b561111819de159ccbd86c3004cf88 /other/Kermit/include/SymbolTable.hpp
parent073fe4bf9fca6bf40cef2886d75df832ef4b6fca (diff)
initial
Diffstat (limited to 'other/Kermit/include/SymbolTable.hpp')
-rw-r--r--other/Kermit/include/SymbolTable.hpp113
1 files changed, 113 insertions, 0 deletions
diff --git a/other/Kermit/include/SymbolTable.hpp b/other/Kermit/include/SymbolTable.hpp
new file mode 100644
index 0000000..b0f8aa3
--- /dev/null
+++ b/other/Kermit/include/SymbolTable.hpp
@@ -0,0 +1,113 @@
1/*
2 * SymbolTable.hpp:
3 * a container for "on-demand" symbol address fetching
4 * written by palmers / teso
5 */
6#ifndef __SYMBOL_TABLE_C
7#define __SYMBOL_TABLE_C
8
9#include <SymbolFingp.hpp>
10#include <SystemMap.hpp>
11#include <DevMemPatt.hpp>
12#include <rwKernel.hpp>
13#include <list>
14#include <string>
15#include <iostream>
16#include <fstream>
17#include <algorithm>
18#include <iterator>
19
20#define DEFAULTDUMP "SymbolTableDump"
21#define DEFAULTSYSTEMMAP "System.map"
22
23typedef struct
24 {
25 string Name;
26 unsigned int Address;
27 } zzSym;
28typedef list<zzSym *> zzSymList;
29
30
31/**
32 * A container class for "on-demand" symbol address fetching.
33 */
34class SymbolTable
35{
36private:
37 SymbolFingp *fing;
38 DevMemPatt *patt;
39 SystemMap exported;
40 SystemMap mapp;
41 SystemMap rest;
42 string dump_file;
43
44 bool createObjects (rwKernel *);
45 bool loadFiles (string, string);
46
47public:
48/**
49 * List of name, address pairs.
50 */
51 zzSymList symList;
52
53/**
54 * Construct a SymbolTable object and load configuration from default files.
55 */
56 SymbolTable ();
57
58/**
59 * Construct a SymbolTable object and load configuration from defined files.
60 * @param res file name of restore file.
61 * @param sys System.map file to load.
62 */
63 SymbolTable (string res, string sys);
64
65/**
66 * Construct a SymbolTable object and use the referenced rwKernel object in all
67 * member attributes and methods.
68 */
69 SymbolTable (rwKernel *);
70
71/**
72 * Foo.
73 */
74 ~SymbolTable ();
75
76/**
77 * Define the file written to on saveCache ().
78 * @see saveCache()
79 */
80 void setSaveFile (string);
81
82/**
83 * get the address of a known symbol.
84 * @return If the symbol is unknow zero is returned.
85 * (hey, would you call 0x00000000?). Else, the address
86 * of the symbol.
87 */
88 unsigned int getSymbol (string);
89
90/**
91 * Find a symbol. This will try all available methods to
92 * find a symbol and cache the address, name pair (zero
93 * if search was not successfull).
94 * @return true on success.
95 */
96 bool findSymbol (string);
97
98/**
99 * add a symbol, address pair to the cache.
100 */
101 void addSymbolToCache (string, unsigned int);
102
103/**
104 * flush the address cache.
105 */
106 void clearCache ();
107
108/**
109 * save the cache to a file (human readable, System.map style).
110 */
111 bool saveCache ();
112};
113#endif /* __SYMBOL_TABLE_C */