⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bfdreflect.h

📁 java 反射机制详解示例,实现类属性及方法修改
💻 H
字号:
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -