dwarfHandle.h
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
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