1' Copyright (c) 2021-2022 Huawei Device Co., Ltd. 2' Licensed under the Apache License, Version 2.0 (the "License"); 3' you may not use this file except in compliance with the License. 4' You may obtain a copy of the License at 5' 6' http://www.apache.org/licenses/LICENSE-2.0 7' 8' Unless required by applicable law or agreed to in writing, software 9' distributed under the License is distributed on an "AS IS" BASIS, 10' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11' See the License for the specific language governing permissions and 12' limitations under the License. 13 14@startuml 15 16title Print Stacktraces at Safepoints 17 18skinparam monochrome true 19 20ManagedThread -> stacktrace.cpp: GetStacktrace 21stacktrace.cpp -> ManagedThread: stacktrace (array of function call instruction addresses) 22ManagedThread -> StackPrinter: Print the stacktrace 23StackPrinter -> "~/proc~/self~/maps": ReadVma (read used libraries and associated addresses) 24"~/proc~/self~/maps" -> StackPrinter: Array of VMA (virtual memory area) 25StackPrinter -> StackPrinter: For each address, find the corresponding VMA and determine the library file 26StackPrinter -> libdwarf: Read debug info from the library file 27libdwarf -> StackPrinter: Debug info 28StackPrinter -> libdwarf: Get function name, source file and line number 29libdwarf -> StackPrinter: mangled function name (non-human readable), source file and line number 30StackPrinter -> "libstdc++": Demangle function name (Get human readable function name) 31"libstdc++" -> StackPrinter: human readable function name 32StackPrinter -> "output stream": Print 33@enduml 34