be/src/util/stack_util.cpp
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #include "util/stack_util.h" |
19 | | |
20 | | #include "common/stack_trace.h" |
21 | | #include "util/mem_info.h" |
22 | | #include "util/pretty_printer.h" |
23 | | |
24 | | namespace doris { |
25 | | |
26 | 80.8M | std::string get_stack_trace(int start_pointers_index, std::string dwarf_location_info_mode) { |
27 | 80.8M | #ifndef BE_TEST |
28 | 80.8M | if (!config::enable_stacktrace) { |
29 | 0 | return "no enable stacktrace"; |
30 | 0 | } |
31 | 80.8M | #endif |
32 | 80.8M | if (dwarf_location_info_mode.empty()) { |
33 | 483 | dwarf_location_info_mode = config::dwarf_location_info_mode; |
34 | 483 | } |
35 | | |
36 | 80.8M | return "\n" + StackTrace().toString(start_pointers_index, dwarf_location_info_mode); |
37 | 80.8M | } |
38 | | |
39 | | } // namespace doris |