parseDwarf.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <map>
00031
00032 #include "elf.h"
00033 #include "libelf.h"
00034 #include "dwarf.h"
00035 #include "libdwarf.h"
00036 #include "dwarf/h/dwarfExprParser.h"
00037 #include "dwarf/h/dwarfFrameParser.h"
00038
00039 #include "Symtab.h"
00040 #include "Type.h"
00041 #include "Function.h"
00042 #include "Module.h"
00043 #include "symtabAPI/src/Object.h"
00044 #include "Collections.h"
00045 #include "common/h/pathName.h"
00046 #include "Variable.h"
00047 #include "Type-mem.h"
00048 #include <stdarg.h>
00049 #include "dynutil/h/Annotatable.h"
00050 #include "annotations.h"
00051 #include "debug.h"
00052
00053 #ifndef DW_FRAME_CFA_COL3
00054
00055
00056 #define DW_FRAME_CFA_COL3 1036
00057
00058 extern "C" {
00059 int dwarf_get_fde_info_for_cfa_reg3(
00060 Dwarf_Fde ,
00061 Dwarf_Addr ,
00062 Dwarf_Small * ,
00063 Dwarf_Signed * ,
00064 Dwarf_Signed * ,
00065 Dwarf_Signed * ,
00066 Dwarf_Ptr * ,
00067 Dwarf_Addr* ,
00068 Dwarf_Error* )
00069 {
00070 fprintf(stderr, "%s[%d]: WARNING: inside dummy dwarf functions\n", FILE__, __LINE__);
00071 return 0;
00072 }
00073 }
00074 #endif
00075
00076 std::map<Dwarf_Off, fieldListType*> enclosureMap;
00077
00078 using namespace Dyninst;
00079 using namespace Dyninst::SymtabAPI;
00080
00081 void setSymtabError(SymtabError new_err);
00082
00083 std::string convertCharToString(char *ptr)
00084 {
00085 std::string str;
00086 if (ptr)
00087 str = ptr;
00088 else
00089 str = "";
00090 return str;
00091 }
00092
00093 extern void pd_dwarf_handler( Dwarf_Error, Dwarf_Ptr );
00094
00095 void Object::parseDwarfTypes( Symtab *)
00096 {
00097 assert(0);
00098 }
00099
00100 bool Object::hasFrameDebugInfo()
00101 {
00102 dwarf->frame_dbg();
00103 assert(dwarf->frameParser());
00104 return dwarf->frameParser()->hasFrameDebugInfo();
00105 }
00106
00107 bool Object::getRegValueAtFrame(Address pc,
00108 Dyninst::MachRegister reg,
00109 Dyninst::MachRegisterVal ®_result,
00110 MemRegReader *reader)
00111 {
00112 Dwarf::FrameErrors_t frame_error = Dwarf::FE_No_Error;
00113 bool result;
00114
00115 dwarf->frame_dbg();
00116 result = dwarf->frameParser()->getRegValueAtFrame(pc, reg, reg_result, reader, frame_error);
00117 setSymtabError((SymtabError) frame_error);
00118 return result;
00119 }
00120