1 /* 2 * 3 * honggfuzz - architecture dependent code 4 * ----------------------------------------- 5 * 6 * Author: Robert Swiecki <swiecki@google.com> 7 * 8 * Copyright 2010-2018 by Google Inc. All Rights Reserved. 9 * 10 * Licensed under the Apache License, Version 2.0 (the "License"); you may 11 * not use this file except in compliance with the License. You may obtain 12 * a copy of the License at 13 * 14 * http://www.apache.org/licenses/LICENSE-2.0 15 * 16 * Unless required by applicable law or agreed to in writing, software 17 * distributed under the License is distributed on an "AS IS" BASIS, 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 19 * implied. See the License for the specific language governing 20 * permissions and limitations under the License. 21 * 22 */ 23 24 #ifndef _HF_LINUX_UNWIND_H_ 25 #define _HF_LINUX_UNWIND_H_ 26 27 #include <linux/limits.h> 28 #include <sys/types.h> 29 30 /* String buffer size for function names in stack traces produced from libunwind */ 31 #define _HF_FUNC_NAME_SZ 256 // Should be alright for mangled C++ procs too 32 33 #define _HF_MAX_FUNCS 80 34 typedef struct { 35 void* pc; 36 37 /* If ASan custom parsing, function not available without symbolication */ 38 char func[_HF_FUNC_NAME_SZ]; 39 40 /* 41 * If libuwind proc maps is used to retrieve map name 42 * If ASan custom parsing it's retrieved from generated report file 43 */ 44 char mapName[PATH_MAX]; 45 46 /* 47 * If libunwind + bfd symbolizer, line is actual symbol file line 48 * If libunwind + custom (e.g. Android), line is offset from function symbol 49 * If ASan custom parsing, line is offset from matching map load base address 50 */ 51 size_t line; 52 } funcs_t; 53 54 extern size_t arch_unwindStack(pid_t pid, funcs_t* funcs); 55 extern char* arch_btContainsSymbol( 56 size_t symbolsListSz, char** symbolsList, size_t num_frames, funcs_t* funcs); 57 58 #endif 59