parseDwarf.C

Go to the documentation of this file.
00001 /*
00002  * See the dyninst/COPYRIGHT file for copyright information.
00003  * 
00004  * We provide the Paradyn Tools (below described as "Paradyn")
00005  * on an AS IS basis, and do not warrant its validity or performance.
00006  * We reserve the right to update, modify, or discontinue this
00007  * software at any time.  We shall have no obligation to supply such
00008  * updates or modifications or any other form of support to you.
00009  * 
00010  * By your use of Paradyn, you understand and agree that we (or any
00011  * other person or entity with proprietary rights in Paradyn) are
00012  * under no obligation to provide either maintenance services,
00013  * update services, notices of latent defects, or correction of
00014  * defects for Paradyn.
00015  * 
00016  * This library is free software; you can redistribute it and/or
00017  * modify it under the terms of the GNU Lesser General Public
00018  * License as published by the Free Software Foundation; either
00019  * version 2.1 of the License, or (at your option) any later version.
00020  * 
00021  * This library is distributed in the hope that it will be useful,
00022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00024  * Lesser General Public License for more details.
00025  * 
00026  * You should have received a copy of the GNU Lesser General Public
00027  * License along with this library; if not, write to the Free Software
00028  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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 //  This is a newer feature of libdwarf (which has been causing some other 
00055 //  compilation problems locally) -- so we just fudge it for the moment
00056 #define DW_FRAME_CFA_COL3               1036
00057 /* Use this to get the cfa. */
00058 extern "C" {
00059 int dwarf_get_fde_info_for_cfa_reg3(
00060         Dwarf_Fde /*fde*/,
00061         Dwarf_Addr       /*pc_requested*/, 
00062         Dwarf_Small  *   /*value_type*/, 
00063         Dwarf_Signed *   /*offset_relevant*/,
00064         Dwarf_Signed *    /*register*/,  
00065         Dwarf_Signed *    /*offset_or_block_len*/,
00066         Dwarf_Ptr   *    /*block_ptr */,
00067         Dwarf_Addr*      /*row_pc_out*/,
00068         Dwarf_Error*     /*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 } /* end parseDwarfTypes() */
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 &reg_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 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 12 Jul 2013 for SymtabAPI by  doxygen 1.6.1