dwarfHandle.h

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 
00031 #if !defined(DWARF_HANDLE_H_)
00032 #define DWARF_HANDLE_H_
00033 
00034 #include "libdwarf.h"
00035 #include "dyntypes.h"
00036 #include <map>
00037 #include <string>
00038 
00039 namespace Dyninst {
00040 class Elf_X;
00041 
00042 namespace Dwarf {
00043 class DwarfFrameParser;
00044 
00045 typedef boost::shared_ptr<DwarfFrameParser> DwarfFrameParserPtr;
00046 
00047 class DwarfHandle {
00048   public:
00049    typedef DwarfHandle* ptr;
00050   private:
00051    DwarfFrameParserPtr sw;
00052    typedef enum {
00053       dwarf_status_uninitialized,
00054       dwarf_status_error,
00055       dwarf_status_ok
00056    } dwarf_status_t;
00057    dwarf_status_t init_dwarf_status;
00058 
00059    Dwarf_Debug dbg_file_data;
00060    Dwarf_Debug file_data;
00061    Dwarf_Debug *line_data;
00062    Dwarf_Debug *type_data;
00063    Dwarf_Debug *frame_data;
00064 
00065    Elf_X *file;
00066    Elf_X *dbg_file;
00067    Dwarf_Handler err_func;
00068    Dwarf_Ptr err_data;
00069    bool init_dbg();
00070    void locate_dbg_file();
00071    bool hasFrameData(Elf_X *elfx);
00072    std::string filename;
00073    std::string debug_filename;
00074    static std::map<std::string, DwarfHandle::ptr> all_dwarf_handles;
00075    static Dwarf_Handler defaultErrFunc;
00076    static void defaultDwarfError(Dwarf_Error err, Dwarf_Ptr arg);
00077 
00078    DwarfHandle(std::string filename_, Elf_X *file_, Dwarf_Handler err_func_, Dwarf_Ptr err_data_);
00079   public:
00080    ~DwarfHandle();
00081 
00082    static DwarfHandle::ptr createDwarfHandle(std::string filename_, Elf_X *file_, 
00083                                              Dwarf_Handler err_func_ = defaultErrFunc, Dwarf_Ptr err_data_ = NULL);
00084 
00085    Elf_X *origFile();
00086    Elf_X *debugLinkFile();
00087    Dwarf_Debug *line_dbg();
00088    Dwarf_Debug *type_dbg();
00089    Dwarf_Debug *frame_dbg();
00090    DwarfFrameParserPtr frameParser();
00091 };
00092 
00093 }
00094 }
00095 
00096 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 12 Jul 2013 for SymtabAPI by  doxygen 1.6.1