• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef KEY_THREAD_DUMP_INFO_H
17 #define KEY_THREAD_DUMP_INFO_H
18 #include <csignal>
19 #include <string>
20 #include "dfx_process.h"
21 #include "dfx_dump_request.h"
22 #include "dump_info.h"
23 #include "unwinder.h"
24 #include "dump_info_factory.h"
25 
26 namespace OHOS {
27 namespace HiviewDFX {
28 class KeyThreadDumpInfo : public DumpInfo {
29 public:
30     void Print(DfxProcess& process, const ProcessDumpRequest& request, Unwinder& unwinder) override;
31     int UnwindStack(DfxProcess& process, const ProcessDumpRequest& request, Unwinder& unwinder) override;
32     void Symbolize(DfxProcess& process, Unwinder& unwinder) override;
CreateInstance()33     static std::shared_ptr<DumpInfo> CreateInstance() { return std::make_shared<KeyThreadDumpInfo>(); }
34 private:
35     bool GetKeyThreadStack(DfxProcess& process, Unwinder& unwinder);
36     void UnwindThreadByParseStackIfNeed(std::shared_ptr<DfxThread> thread, std::shared_ptr<DfxMaps> maps);
37     std::string unwindFailTip_;
38 };
39 }
40 }
41 #endif