njn | ea27e46 | 2005-05-31 02:38:09 +0000 | [diff] [blame] | 1 | |
| 2 | /*--------------------------------------------------------------------*/ |
| 3 | /*--- Debug info. pub_core_debuginfo.h ---*/ |
| 4 | /*--------------------------------------------------------------------*/ |
| 5 | |
| 6 | /* |
| 7 | This file is part of Valgrind, a dynamic binary instrumentation |
| 8 | framework. |
| 9 | |
sewardj | 4d474d0 | 2008-02-11 11:34:59 +0000 | [diff] [blame] | 10 | Copyright (C) 2000-2008 Julian Seward |
njn | ea27e46 | 2005-05-31 02:38:09 +0000 | [diff] [blame] | 11 | jseward@acm.org |
| 12 | |
| 13 | This program is free software; you can redistribute it and/or |
| 14 | modify it under the terms of the GNU General Public License as |
| 15 | published by the Free Software Foundation; either version 2 of the |
| 16 | License, or (at your option) any later version. |
| 17 | |
| 18 | This program is distributed in the hope that it will be useful, but |
| 19 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 | General Public License for more details. |
| 22 | |
| 23 | You should have received a copy of the GNU General Public License |
| 24 | along with this program; if not, write to the Free Software |
| 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 26 | 02111-1307, USA. |
| 27 | |
| 28 | The GNU General Public License is contained in the file COPYING. |
| 29 | */ |
| 30 | |
| 31 | #ifndef __PUB_CORE_DEBUGINFO_H |
| 32 | #define __PUB_CORE_DEBUGINFO_H |
| 33 | |
| 34 | //-------------------------------------------------------------------- |
| 35 | // PURPOSE: This module deals with reading debug info and symbol tables |
| 36 | // to get file and function names, line numbers, variable types, and |
| 37 | // to help stack unwinding. |
njn | ea27e46 | 2005-05-31 02:38:09 +0000 | [diff] [blame] | 38 | //-------------------------------------------------------------------- |
| 39 | |
| 40 | #include "pub_tool_debuginfo.h" |
| 41 | |
sewardj | f98e1c0 | 2008-10-25 16:22:41 +0000 | [diff] [blame] | 42 | /* Initialise the entire module. Must be called first of all. */ |
| 43 | extern void VG_(di_initialise) ( void ); |
| 44 | |
sewardj | 811469c | 2006-10-17 01:36:37 +0000 | [diff] [blame] | 45 | /* LINUX: Notify the debuginfo system about a new mapping, or the |
| 46 | disappearance of such, or a permissions change on an existing |
| 47 | mapping. This is the way new debug information gets loaded. If |
| 48 | allow_SkFileV is True, it will try load debug info if the mapping |
| 49 | at 'a' belongs to Valgrind; whereas normally (False) it will not do |
| 50 | that. This allows us to carefully control when the thing will read |
sewardj | 9c606bd | 2008-09-18 18:12:50 +0000 | [diff] [blame] | 51 | symbols from the Valgrind executable itself. |
| 52 | |
| 53 | If a call to VG_(di_notify_mmap) causes debug info to be read, then |
| 54 | the returned ULong is an abstract handle which can later be used to |
| 55 | refer to the debuginfo read as a result of this specific mapping, |
| 56 | in later queries to m_debuginfo. In this case the handle value |
| 57 | will be one or above. If the returned value is zero, no debug info |
| 58 | was read. */ |
sewardj | 811469c | 2006-10-17 01:36:37 +0000 | [diff] [blame] | 59 | #if defined(VGO_linux) |
sewardj | 9c606bd | 2008-09-18 18:12:50 +0000 | [diff] [blame] | 60 | extern ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV ); |
sewardj | f72cced | 2005-11-08 00:45:47 +0000 | [diff] [blame] | 61 | |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 62 | extern void VG_(di_notify_munmap)( Addr a, SizeT len ); |
sewardj | f72cced | 2005-11-08 00:45:47 +0000 | [diff] [blame] | 63 | |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 64 | extern void VG_(di_notify_mprotect)( Addr a, SizeT len, UInt prot ); |
sewardj | 811469c | 2006-10-17 01:36:37 +0000 | [diff] [blame] | 65 | #endif |
| 66 | |
| 67 | #if defined(VGO_aix5) |
| 68 | /* AIX5: Very similar, except packaged more neatly. The supplied |
| 69 | parameters describe a code segment and its associated data segment, |
| 70 | that have recently been mapped in -- so we need to read debug info |
| 71 | for it -- or conversely, have recently been dumped, in which case |
sewardj | 9c606bd | 2008-09-18 18:12:50 +0000 | [diff] [blame] | 72 | the relevant debug info has to be unloaded. |
| 73 | |
| 74 | The returned ULong has the same meaning as documented for |
| 75 | VG_(di_notify_mmap) just above. */ |
| 76 | extern ULong VG_(di_aix5_notify_segchange)( |
| 77 | Addr code_start, |
| 78 | Word code_len, |
| 79 | Addr data_start, |
| 80 | Word data_len, |
| 81 | UChar* file_name, |
| 82 | UChar* mem_name, |
| 83 | Bool is_mainexe, |
| 84 | Bool acquire |
| 85 | ); |
sewardj | 811469c | 2006-10-17 01:36:37 +0000 | [diff] [blame] | 86 | #endif |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 87 | |
sewardj | 9c606bd | 2008-09-18 18:12:50 +0000 | [diff] [blame] | 88 | extern void VG_(di_discard_ALL_debuginfo)( void ); |
| 89 | |
sewardj | eadcd86 | 2006-04-04 15:12:44 +0000 | [diff] [blame] | 90 | extern Bool VG_(get_fnname_nodemangle)( Addr a, |
| 91 | Char* fnname, Int n_fnname ); |
njn | ea27e46 | 2005-05-31 02:38:09 +0000 | [diff] [blame] | 92 | |
sewardj | eadcd86 | 2006-04-04 15:12:44 +0000 | [diff] [blame] | 93 | /* Use DWARF2/3 CFA information to do one step of stack unwinding. */ |
| 94 | extern Bool VG_(use_CF_info) ( /*MOD*/Addr* ipP, |
| 95 | /*MOD*/Addr* spP, |
| 96 | /*MOD*/Addr* fpP, |
| 97 | Addr min_accessible, |
| 98 | Addr max_accessible ); |
njn | ea27e46 | 2005-05-31 02:38:09 +0000 | [diff] [blame] | 99 | |
sewardj | 40c186c | 2006-01-17 01:54:16 +0000 | [diff] [blame] | 100 | /* ppc64-linux only: find the TOC pointer (R2 value) that should be in |
| 101 | force at the entry point address of the function containing |
| 102 | guest_code_addr. Returns 0 if not known. */ |
| 103 | extern Addr VG_(get_tocptr) ( Addr guest_code_addr ); |
njn | ea27e46 | 2005-05-31 02:38:09 +0000 | [diff] [blame] | 104 | |
sewardj | 0c95e94 | 2006-01-18 04:23:10 +0000 | [diff] [blame] | 105 | /* This is only available to core... don't demangle C++ names, but do |
| 106 | do Z-demangling, match anywhere in function, and don't show |
| 107 | offsets. */ |
| 108 | extern |
| 109 | Bool VG_(get_fnname_Z_demangle_only) ( Addr a, Char* buf, Int nbuf ); |
| 110 | |
sewardj | 811469c | 2006-10-17 01:36:37 +0000 | [diff] [blame] | 111 | /* Map a function name to its entry point and toc pointer. Is done by |
| 112 | sequential search of all symbol tables, so is very slow. To |
| 113 | mitigate the worst performance effects, you may specify a soname |
| 114 | pattern, and only objects matching that pattern are searched. |
| 115 | Therefore specify "*" to search all the objects. On TOC-afflicted |
| 116 | platforms, a symbol is deemed to be found only if it has a nonzero |
| 117 | TOC pointer. */ |
| 118 | extern |
| 119 | Bool VG_(lookup_symbol_SLOW)(UChar* sopatt, UChar* name, Addr* pEnt, Addr* pToc); |
| 120 | |
njn | ea27e46 | 2005-05-31 02:38:09 +0000 | [diff] [blame] | 121 | #endif // __PUB_CORE_DEBUGINFO_H |
| 122 | |
| 123 | /*--------------------------------------------------------------------*/ |
| 124 | /*--- end ---*/ |
| 125 | /*--------------------------------------------------------------------*/ |