bfdreflect.h

来自「java 反射机制详解示例,实现类属性及方法修改」· C头文件 代码 · 共 65 行

H
65
字号
#ifndef __BFDREFLECT_H__
#define __BFDREFLECT_H__

#include <stdio.h>
#include <string.h>
#include <bfd.h>
#include <libiberty.h>
#include <unistd.h>

extern "C" { 
#include "debug.h"
#include "budbg.h"
#include "bucomm.h"
}

#include "reflect.h"

class RTTIStackFrameMethodType :  RTTIMethodType { 
  public:
    void invoke(void* result, void* obj, void* parameters[]);

  protected:
    friend class RTTIBfdRepository;

    void calculateFrameSize();

    void* methodAddress;
    int   frameSize;
};

class RTTIBfdRepository : public RTTIRepository { 
  public:
    virtual bool load(char const* filePath);

    static RTTIRepository* getInstance() { 
	return &theRepository;
    }
    
    RTTIBfdRepository() {
	constructorName = "__base_ctor";
    }
    
    ~RTTIBfdRepository();

    void setConstructorName(char const* name) {
	constructorName = name;
    }
    
  protected:
    static RTTIBfdRepository theRepository;

    int       getVisibility(enum debug_visibility visibility);
    bool      readBFD(bfd* abfd);
    bool      loadBFD(bfd* abfd);
    int       getTypeQualifiers(debug_type* type);
    RTTIType* getType(debug_type* type);
    void      loadClass(debug_type* type);
    void      readClass(debug_type* type);

    PTR  handle;
    char const* constructorName;
};

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?