MCPcopy Create free account
hub / github.com/GJDuck/e9patch / parseSymbol

Function parseSymbol

src/e9tool/e9action.cpp:82–109  ·  view source on GitHub ↗

* Parse a symbolic value. */

Source from the content-addressed store, hash-verified

80 * Parse a symbolic value.
81 */
82static intptr_t parseSymbol(Parser &parser, const char *symbol)
83{
84 bool end = false;
85 if (parser.peekToken() == '.')
86 {
87 parser.getToken();
88 switch (parser.getToken())
89 {
90 case TOKEN_START:
91 break;
92 case TOKEN_END:
93 end = true; break;
94 default:
95 parser.unexpectedToken();
96 }
97 }
98 intptr_t val = getELFObject(parser.elf, symbol, end);
99 if (val == -1)
100 {
101 warning("symbol \"%s\" is undefined and therefore has value 0x0",
102 symbol);
103 return 0x0;
104 }
105 else if (val == INTPTR_MIN)
106 warning("failed to match \"%s\" against any section or symbol name",
107 symbol);
108 return val;
109}
110
111/*
112 * Parse a memory operand.

Callers 1

parseMatchArgFunction · 0.70

Calls 4

warningFunction · 0.85
peekTokenMethod · 0.80
getTokenMethod · 0.80
unexpectedTokenMethod · 0.80

Tested by

no test coverage detected