MCPcopy Create free account
hub / github.com/aliasIsolation/aliasIsolation / show_stack

Function show_stack

src/crashHandler/crashHandler.cpp:192–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190};
191
192void show_stack(std::ostream &os, HANDLE hThread, CONTEXT& c) {
193 HANDLE process = GetCurrentProcess();
194
195 DWORD offset_from_symbol=0;
196 IMAGEHLP_LINE64 line = {0};
197
198 //SymHandler handler(process, g_symSearchPath.c_str(), true);
199 SymHandler handler(process);
200
201 sym_options(SYMOPT_LOAD_LINES | SYMOPT_UNDNAME);
202
203 void *base = load_modules_symbols(process, GetCurrentProcessId());
204
205 STACKFRAME64 s = init_stack_frame(c);
206
207 line.SizeOfStruct = sizeof line;
208
209 IMAGE_NT_HEADERS *h = ImageNtHeader(base);
210 DWORD image_type = h->FileHeader.Machine;
211
212 for (int frame_number = 0;; ++frame_number) {
213 if (frame_number > 0)
214 {
215 if (!StackWalk64(image_type, process, hThread, &s, &c, NULL, SymFunctionTableAccess64, SymGetModuleBase64, NULL))
216 {
217 return;
218 }
219 }
220
221 if (s.AddrPC.Offset != 0) {
222 os << symbol(process, s.AddrPC.Offset).undecorated_name();
223
224 if (SymGetLineFromAddr64( process, s.AddrPC.Offset, &offset_from_symbol, &line ) )
225 os << " " << line.FileName << " (" << line.LineNumber << ")";
226
227 os << std::endl;
228 }
229 }
230}
231
232class get_mod_info {
233 HANDLE process;

Callers 1

FilterFunction · 0.85

Calls 5

sym_optionsFunction · 0.85
load_modules_symbolsFunction · 0.85
init_stack_frameFunction · 0.85
symbolClass · 0.85
undecorated_nameMethod · 0.80

Tested by

no test coverage detected