Skip to content

Commit

Permalink
Fix frames to skip
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Oct 22, 2024
1 parent 406fd5c commit cfcce23
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/xtd.core/src/xtd/diagnostics/stack_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,26 @@ std::vector<stack_frame> stack_frame::get_stack_frames(const string& str, xtd::s
}
}

auto frames_to_skip = {
"decltype",
"int xtd::startup::internal_safe_run",
"int xtd::startup::safe_run",
"long std::_",
"std::_",
"std::invoke",
"void std::_",
"xtd::delegate<",
"xtd::startup::internal_safe_run",
"xtd::startup::run",
"xtd::startup::safe_run",
};

auto stack_frames = std::vector<stack_frame> {};
if (call_stack.size() == 0) return stack_frames;
for (auto index = skip_frames_before_str; index < call_stack.size(); ++index) {
auto [file, line, column, method, offset] = call_stack[index];
auto skip = false;
for (auto starting_str : {"xtd::startup::run", "int xtd::startup::internal_safe_run", "int xtd::startup::safe_run", "decltype", "std::_", "std::invoke", "void std::_", "long std::_", "xtd::delegate<"})
for (auto starting_str : frames_to_skip)
if (string {method}.starts_with(starting_str)) skip = true;
if (skip) continue;
stack_frames.emplace_back(stack_frame(need_file_info ? file : "", need_file_info ? line : 0, method, need_file_info ? column : 0, offset));
Expand Down

0 comments on commit cfcce23

Please sign in to comment.