#define LIBGOBLIN_API extern
#endif
LIBGOBLIN_API
+ int LibGoblin_AnalyzeProgram( int i_pgid );
+LIBGOBLIN_API
int LibGoblin_GetUnresolv_ObjectFilePath( int i_pgid, LibGoblin_ObjectFilePath *p_objpath );
LIBGOBLIN_API
int LibGoblin_SetPathAndLoad_ObjectFilePath( LibGoblin_ObjectFilePath *p_objpath );
drd64_libgoblin_readbin.o \
drd64_libgoblin_loadprog.o \
drd64_libgoblin_symwork.o \
+ drd64_libgoblin_objinfo.o \
drd64_libgoblin_addrinfo.o \
drd64_libgoblin_section.o \
drd64_libgoblin_elf.o \
drd64_libgoblin_readbin.h \
drd64_libgoblin_loadprog.h \
drd64_libgoblin_symwork.h \
+ drd64_libgoblin_objinfo.h \
drd64_libgoblin_addrinfo.h \
drd64_libgoblin_section.h \
drd64_libgoblin_elf.h \
drd64_libgoblin_symwork.o: drd64_libgoblin_symwork.c $(HEADER)
$(CC) -c -o drd64_libgoblin_symwork.o $(FLAGS_DEBUG) \
drd64_libgoblin_symwork.c
+drd64_libgoblin_objinfo.o: drd64_libgoblin_objinfo.c $(HEADER)
+ $(CC) -c -o drd64_libgoblin_objinfo.o $(FLAGS_DEBUG) \
+ drd64_libgoblin_objinfo.c
drd64_libgoblin_addrinfo.o: drd64_libgoblin_addrinfo.c $(HEADER)
$(CC) -c -o drd64_libgoblin_addrinfo.o $(FLAGS_DEBUG) \
drd64_libgoblin_addrinfo.c
#include"drd64_libgoblin_loadprog.h"
#include"drd64_libgoblin_symwork.h"
#include"drd64_libgoblin_section.h"
+#include"drd64_libgoblin_objinfo.h"
#include"drd64_libgoblin_addrinfo.h"
#include"drd64_libgoblin_elf.h"
#include"drd64_libgoblin_elf_dynver.h"
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
int
- LibGoblin_AddrInfo_Set_Symtab(
+ AddrInfo_Set_Symtab(
LibGoblin_BinaryInfo *p_binfo,
LibGoblin_AddressInfo *p_addr,
LibGoblin_SymbolWorkInfo *p_syminfo )
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
int
- LibGoblin_AddrInfo_Move_AddrInfo(
+ AddrInfo_Move_AddrInfo(
LibGoblin_BinaryInfo *p_binfo,
LibGoblin_AddressInfo *p_addr,
LibGoblin_SymbolWorkInfo *p_syminfo )
----------------------------------------------------------------------*/
LIBGOBLIN_ADDRINFO_EXTERN
int
- LibGoblin_AddrInfo_SyncSymbolWorkTable(
+ AddrInfo_SyncSymbolWorkTable(
LibGoblin_BinaryInfo *p_binfo,
LibGoblin_SymbolWorkTable *p_symworktbl )
{
p_syminfo = p_symworktbl->p_symwork + (p_symworktbl->dw_max_symwork - 1);
for( dw_cnt = p_symworktbl->dw_max_symwork; dw_cnt > 0; dw_cnt--, p_syminfo--, p_addr-- ) {
if( LIBGOBLIN_SYMWORKINFO_TYPE_SYMTAB == GET_SYMWORKINFO_TYPE(p_syminfo->dw_type) ) {
- i_result = LibGoblin_AddrInfo_Set_Symtab( p_binfo, p_addr, p_syminfo );
+ i_result = AddrInfo_Set_Symtab( p_binfo, p_addr, p_syminfo );
}
else if( LIBGOBLIN_SYMWORKINFO_TYPE_DWARF
== GET_SYMWORKINFO_TYPE(p_syminfo->dw_type) ) {
}
else if( LIBGOBLIN_SYMWORKINFO_TYPE_ADDRTBL
== GET_SYMWORKINFO_TYPE(p_syminfo->dw_type) ) {
- i_result = LibGoblin_AddrInfo_Move_AddrInfo( p_binfo, p_addr, p_syminfo );
+ i_result = AddrInfo_Move_AddrInfo( p_binfo, p_addr, p_syminfo );
}
}
----------------------------------------------------------------------*/
LIBGOBLIN_ADDRINFO_EXTERN
int
- LibGoblin_AddrInfo_AllocAddrInfo(
+ AddrInfo_AllocAddrInfo(
LibGoblin_BinaryInfo *p_binfo,
DWord dw_initsymbols )
{
----------------------------------------------------------------------*/
LIBGOBLIN_ADDRINFO_EXTERN
int
- LibGoblin_AddrInfo_FreeAddrInfo(
+ AddrInfo_FreeAddrInfo(
LibGoblin_BinaryInfo *p_binfo )
{
assert( NULL != p_binfo );
#define LIBGOBLIN_CalcAddrInfoAllocs(m) ((((m) / LIBGOBLIN_ADDRINFO_ALLOC_UNITS) + 2) * LIBGOBLIN_ADDRINFO_ALLOC_UNITS)
LIBGOBLIN_ADDRINFO_EXTERN
- int LibGoblin_AddrInfo_SyncSymbolWorkTable(
+ int AddrInfo_SyncSymbolWorkTable(
LibGoblin_BinaryInfo *p_binfo, LibGoblin_SymbolWorkTable *p_symworktbl );
LIBGOBLIN_ADDRINFO_EXTERN
- int LibGoblin_AddrInfo_AllocAddrInfo( LibGoblin_BinaryInfo *p_binfo, DWord dw_initsymbols );
+ int AddrInfo_AllocAddrInfo( LibGoblin_BinaryInfo *p_binfo, DWord dw_initsymbols );
LIBGOBLIN_ADDRINFO_EXTERN
- int LibGoblin_AddrInfo_FreeAddrInfo( LibGoblin_BinaryInfo *p_binfo );
+ int AddrInfo_FreeAddrInfo( LibGoblin_BinaryInfo *p_binfo );
#endif /* DRD64_HEADER_XXX */
***********************************************************************/
LIBGOBLIN_API
int
+ LibGoblin_AnalyzeProgram(
+ int i_pgid )
+{
+ int i_result;
+ LibGoblin_ProgramInfo *p_pginfo;
+
+ p_pginfo = ProgInfo_GetProgInfo( i_pgid );
+ if( NULL == p_pginfo ) {
+ return -0x01;
+ }
+
+ i_result = ELF_ReadELF_Phase2( p_pginfo->p_binfo[LIBGOBLIN_BINFO_FILE_EXEC] );
+ if( 0x00 != i_result ) {
+ return -0x02;
+ }
+
+ return i_result;
+}
+
+
+/***********************************************************************
+***********************************************************************/
+LIBGOBLIN_API
+int
LibGoblin_GetUnresolv_ObjectFilePath(
int i_pgid,
LibGoblin_ObjectFilePath *p_objpath )
if( NULL == p_binfo ) { return 0x01; }
- i_result = LibGoblin_AddrInfo_FreeAddrInfo( p_binfo );
+ i_result = AddrInfo_FreeAddrInfo( p_binfo );
if( 0x00 != i_result ) {
return -0x02;
}
assert( NULL != p_bin );
/* Get .debug_abbrev section Info */
- pb_data_abbrev = LibGoblin_Elf_GetSection(
+ pb_data_abbrev = ELF_GetSection(
&qw_size_abbrev, p_bin,
LIBGOBLIN_SECTION_ID_DEBUG_ABBREV );
if( NULL == pb_data_abbrev ) { return 0x00; }
assert( NULL != p_dwarf );
/* Get .debug_abbrev section Info */
- pb_data = LibGoblin_Elf_GetSection(
+ pb_data = ELF_GetSection(
&qw_size_abbrev, p_bin,
LIBGOBLIN_SECTION_ID_DEBUG_ABBREV );
if( NULL == pb_data ) { return 0x01; }
assert( NULL != p_src );
/* Get .debug_abbrev section Info */
- pb_data = LibGoblin_Elf_GetSection(
+ pb_data = ELF_GetSection(
&qw_size_abbrev, p_bin,
LIBGOBLIN_SECTION_ID_DEBUG_ABBREV );
if( NULL == pb_data ) { return 0x01; }
assert( NULL != p_src );
/* Get .debug_abbrev section Info */
- pb_data = LibGoblin_Elf_GetSection(
+ pb_data = ELF_GetSection(
&qw_size_info, p_bin,
LIBGOBLIN_SECTION_ID_DEBUG_INFO );
if( NULL == pb_data ) { return 0x01; }
assert( NULL != p_src );
/* Get .debug_abbrev section Info */
- pb_data = LibGoblin_Elf_GetSection(
+ pb_data = ELF_GetSection(
&qw_size, p_bin,
LIBGOBLIN_SECTION_ID_DEBUG_LINE );
if( NULL == pb_data ) { return 0x01; }
----------------------------------------------------------------------*/
LIBGOBLIN_ELF_EXTERN
int
- LibGoblin_IsElf(
+ ELF_IsElf(
Byte *p_data )
{
----------------------------------------------------------------------*/
LIBGOBLIN_ELF_EXTERN
Byte *
- LibGoblin_Elf_GetSection(
+ ELF_GetSection(
QWord *qw_secsize,
LibGoblin_BinaryInfo *p_binfo,
Byte b_secid )
----------------------------------------------------------------------*/
LIBGOBLIN_ELF_EXTERN
int
- LibGoblin_Elf_ReadELF_Phase1(
+ ELF_ReadELF_Phase1(
LibGoblin_BinaryInfo *p_binfo )
{
int i_result = 0x00;
----------------------------------------------------------------------*/
LIBGOBLIN_ELF_EXTERN
int
- LibGoblin_Elf_ReadELF_Phase2(
+ ELF_ReadELF_Phase2(
LibGoblin_BinaryInfo *p_binfo )
{
int i_result;
return i_result;
}
- i_result = LibGoblin_AddrInfo_AllocAddrInfo( p_binfo, t_symwork.dw_max_symwork );
+ i_result = AddrInfo_AllocAddrInfo( p_binfo, t_symwork.dw_max_symwork );
if( 0x00 != i_result ) {
return i_result;
}
LibGoblin_Debug_SymWork_PrintWorkTable( &t_symwork, 0x02 );
- i_result = LibGoblin_AddrInfo_SyncSymbolWorkTable( p_binfo, &t_symwork );
+ i_result = AddrInfo_SyncSymbolWorkTable( p_binfo, &t_symwork );
if( 0x00 != i_result ) {
return i_result;
}
LIBGOBLIN_ELF_EXTERN
- int LibGoblin_IsElf( Byte *p_data );
+ int ELF_IsElf( Byte *p_data );
LIBGOBLIN_ELF_EXTERN
- Byte *LibGoblin_Elf_GetSection(
+ Byte *ELF_GetSection(
QWord *qw_secsize, LibGoblin_BinaryInfo *p_bin, Byte b_secid );
LIBGOBLIN_ELF_EXTERN
- int LibGoblin_Elf_ReadELF_Phase1( LibGoblin_BinaryInfo *p_binfo );
+ int ELF_ReadELF_Phase1( LibGoblin_BinaryInfo *p_binfo );
LIBGOBLIN_ELF_EXTERN
- int LibGoblin_Elf_ReadELF_Phase2( LibGoblin_BinaryInfo *p_binfo );
+ int ELF_ReadELF_Phase2( LibGoblin_BinaryInfo *p_binfo );
#endif /* DRD64_HEADER_LIBGOBLIN_BINFO */
return -0x04;
}
- i_result = LibGoblin_Elf_ReadELF_Phase1( p_binfo );
+ i_result = ELF_ReadELF_Phase1( p_binfo );
if( 0x00 != i_result ) {
return -0x05;
}
}
i_result = LoadProg_LoadBinaryInfo( p_binfo );
+ if( 0x00 != i_result ) {
+ return -0x03;
+ }
return i_result;
}
--- /dev/null
+/*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64
+
+ D r . D e a m o n 6 4
+ for INTEL64(R), AMD64(R)
+
+ Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/
+
+/* File Info -----------------------------------------------------------
+File: drd64_.c
+Function:
+Comment:
+----------------------------------------------------------------------*/
+
+#define DRD64_SRC_LIBGOBLIN_OBJINFO
+#include"drd64_libgoblin.h"
+
+
+/*----------------------------------------------------------------------
+----------------------------------------------------------------------*/
+LIBGOBLIN_OBJINFO_EXTERN
+LibGoblin_ObjectInfo *
+ ObjectInfo_GetObjectInfo(
+ LibGoblin_ProgramInfo *p_pginfo,
+ int i_oid )
+{
+ assert( NULL != p_pginfo );
+
+ if(( p_pginfo->i_max_objinfo <= i_oid ) || ( 0 > i_oid ))
+ { return NULL; }
+
+ return OBJINFO(p_pginfo, i_oid);
+}
+
+
+/*----------------------------------------------------------------------
+----------------------------------------------------------------------*/
+void
+ ObjectInfo_ClearObjectInfo(
+ LibGoblin_ObjectInfo *p_objinfo )
+{
+ assert( NULL != p_objinfo );
+
+ memset( p_objinfo, 0x00, sizeof( LibGoblin_ObjectInfo ) );
+
+ p_objinfo->i_id = -0x01;
+
+ return;
+}
+
+
+/*----------------------------------------------------------------------
+----------------------------------------------------------------------*/
+LIBGOBLIN_OBJINFO_EXTERN
+LibGoblin_ObjectInfo *
+ ObjectInfo_AllocObjectInfo(
+ LibGoblin_ProgramInfo *p_pginfo )
+{
+ int i_cnt;
+ int i_id_now;
+ LibGoblin_ObjectInfo *p_objinfo_base;
+ LibGoblin_ObjectInfo *p_objinfo_now;
+
+ assert( NULL != p_pginfo );
+
+ p_objinfo_now = NULL;
+ i_id_now = -1;
+
+ // Search Non-used ObjectInfo ---
+ if( p_pginfo->i_now_objinfo < p_pginfo->i_max_objinfo ) {
+ for( i_cnt = 0; i_cnt < p_pginfo->i_max_objinfo; i_cnt++ ) {
+
+ if( -1 == OBJINFO(p_pginfo, i_cnt)->i_id ) {
+ p_objinfo_now = OBJINFO(p_pginfo, i_cnt);
+ i_id_now = i_cnt;
+ p_pginfo->i_now_objinfo++;
+ break;
+ }
+ }
+ }
+ else if( p_pginfo->i_now_objinfo == p_pginfo->i_alloc_objinfo ) {
+
+ p_objinfo_base = realloc( p_pginfo->p_objinfo,
+ sizeof( LibGoblin_ObjectInfo ) *
+ (p_pginfo->i_alloc_objinfo + LIBGOBLIN_OBJINFO_UNITS) );
+ if( NULL == p_objinfo_base ) {
+ return NULL;
+ }
+
+ for( i_cnt = p_pginfo->i_alloc_objinfo;
+ i_cnt < (p_pginfo->i_alloc_objinfo + LIBGOBLIN_OBJINFO_UNITS); i_cnt++ ) {
+ ObjectInfo_ClearObjectInfo( p_objinfo_base + i_cnt );
+ }
+
+ p_pginfo->p_objinfo = p_objinfo_base;
+ p_pginfo->i_alloc_objinfo += LIBGOBLIN_OBJINFO_UNITS;
+
+ p_objinfo_now = OBJINFO(p_pginfo, p_pginfo->i_now_objinfo);
+ i_id_now = p_pginfo->i_now_objinfo++;
+
+ if( i_id_now == p_pginfo->i_max_objinfo )
+ { p_pginfo->i_max_objinfo++; }
+ }
+ else {
+ p_objinfo_now = OBJINFO(p_pginfo, p_pginfo->i_now_objinfo);
+ i_id_now = p_pginfo->i_now_objinfo++;
+
+ if( i_id_now == p_pginfo->i_max_objinfo )
+ { p_pginfo->i_max_objinfo++; }
+ }
+
+ assert( NULL != p_objinfo_now );
+
+ ObjectInfo_ClearObjectInfo( p_objinfo_now );
+ p_objinfo_now->i_id = i_id_now;
+
+ return p_objinfo_now;
+}
+
+
+/*----------------------------------------------------------------------
+----------------------------------------------------------------------*/
+LIBGOBLIN_OBJINFO_EXTERN
+int
+ ObjectInfo_FreeObjectInfo(
+ LibGoblin_ProgramInfo *p_pginfo,
+ LibGoblin_ObjectInfo *p_objinfo )
+{
+ int i_objid;
+
+ assert( NULL != p_pginfo );
+
+ if( NULL == p_objinfo ) { return 0x01; }
+
+ i_objid = p_objinfo->i_id;
+ ObjectInfo_ClearObjectInfo( p_objinfo );
+
+ if( p_pginfo->i_max_objinfo == (i_objid + 1) )
+ { p_pginfo->i_max_objinfo--; }
+ p_pginfo->i_now_objinfo--;
+ if( 0 == p_pginfo->i_now_objinfo )
+ { p_pginfo->i_max_objinfo = 0; }
+
+ return 0x00;
+}
+
+
+/*----------------------------------------------------------------------
+----------------------------------------------------------------------*/
+LIBGOBLIN_OBJINFO_EXTERN
+int
+ ObjectInfo_Init(
+ LibGoblin_ProgramInfo *p_pginfo,
+ int i_init_objnums )
+{
+ int i_cnt;
+ int i_items;
+ LibGoblin_ObjectInfo *p_objinfo;
+
+ assert( NULL != p_pginfo );
+
+ if( 0 != p_pginfo->i_max_objinfo ) {
+ return -0x01;
+ }
+
+ if( 0 == i_init_objnums )
+ { i_items = LIBGOBLIN_OBJINFO_UNITS * LIBGOBLIN_OBJINFO_INITALLOCRATE; }
+ else
+ { i_items = (( i_init_objnums / LIBGOBLIN_OBJINFO_UNITS ) + 2) * LIBGOBLIN_OBJINFO_UNITS; }
+
+ p_pginfo->p_objinfo = malloc( sizeof( LibGoblin_ObjectInfo ) * i_items );
+ if( NULL == p_pginfo->p_objinfo ) {
+ return -0x02;
+ }
+
+ for( i_cnt = 0; i_cnt < LIBGOBLIN_OBJINFO_UNITS; i_cnt++ ) {
+ p_objinfo = OBJINFO(p_pginfo, i_cnt);
+ ObjectInfo_ClearObjectInfo( p_objinfo );
+ }
+
+ p_pginfo->i_alloc_objinfo = LIBGOBLIN_OBJINFO_UNITS;
+ p_pginfo->i_max_objinfo = 0;
+ p_pginfo->i_now_objinfo = 0;
+
+ return 0x00;
+}
+
+
+/*----------------------------------------------------------------------
+----------------------------------------------------------------------*/
+LIBGOBLIN_OBJINFO_EXTERN
+int
+ ObjectInfo_Term(
+ LibGoblin_ProgramInfo *p_pginfo )
+{
+ LibGoblin_ObjectInfo *p_objinfo;
+
+ assert( NULL != p_pginfo );
+
+ if( 0 < p_pginfo->i_now_objinfo ) {
+ for( ; p_pginfo->i_now_objinfo >= 0; p_pginfo->i_now_objinfo-- ) {
+ p_objinfo = OBJINFO(p_pginfo, p_pginfo->i_now_objinfo);
+ ObjectInfo_FreeObjectInfo( p_pginfo, p_objinfo );
+ }
+ }
+
+ free( p_pginfo->p_objinfo );
+
+ p_pginfo->p_objinfo = NULL;
+ p_pginfo->i_alloc_objinfo = 0;
+ p_pginfo->i_max_objinfo = 0;
+ p_pginfo->i_now_objinfo = 0;
+
+ return 0x00;
+}
+
+
+/* EOF of drd64_.c ----------------------------------- */
--- /dev/null
+/*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64
+
+ D r . D e a m o n 6 4
+ for INTEL64(R), AMD64(R)
+
+ Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/
+
+/* File Info -----------------------------------------------------------
+File: drd64_.h
+Function: Header
+Comment:
+----------------------------------------------------------------------*/
+
+#ifndef DRD64_HEADER_LIBGOBLIN_OBJINFO
+#define DRD64_HEADER_LIBGOBLIN_OBJINFO
+
+#include"drd64_libgoblin.h"
+
+#ifdef DRD64_SRC_LIBGOBLIN_OBJINFO
+ #define LIBGOBLIN_OBJINFO_EXTERN
+#else
+ #define LIBGOBLIN_OBJINFO_EXTERN extern
+#endif
+
+#if defined DRD64_SRC_LIBGOBLIN_OBJINFO
+ #define LIBGOBLIN_OBJINFO_INTERNALFUNC
+#elif defined DRD64_SRC_TEST_LIBGOBLIN_OBJINFO
+ #define LIBGOBLIN_OBJINFO_INTERNALFUNC
+#endif
+
+
+#define LIBGOBLIN_OBJINFO_UNITS 2048
+#define LIBGOBLIN_OBJINFO_INITALLOCRATE 4
+
+#ifdef DRD64_SRC_LIBGOBLIN_OBJINFO
+
+#endif
+
+#define OBJINFO(p,n) ((LibGoblin_ObjectInfo *)((p)->p_objinfo + (n)))
+
+LIBGOBLIN_OBJINFO_EXTERN
+ LibGoblin_ObjectInfo *ObjectInfo_GetObjectInfo( LibGoblin_ProgramInfo *p_pginfo, int i_bid );
+LIBGOBLIN_OBJINFO_EXTERN
+ LibGoblin_ObjectInfo *ObjectInfo_AllocObjectInfo( LibGoblin_ProgramInfo *p_pginfo );
+LIBGOBLIN_OBJINFO_EXTERN
+ int ObjectInfo_FreeObjectInfo( LibGoblin_ProgramInfo *p_pginfo, LibGoblin_ObjectInfo *p_binfo );
+LIBGOBLIN_OBJINFO_EXTERN
+ int ObjectInfo_Init( LibGoblin_ProgramInfo *p_pginfo, int i_init_objnums );
+LIBGOBLIN_OBJINFO_EXTERN
+ int ObjectInfo_Term( LibGoblin_ProgramInfo *p_pginfo );
+
+
+#ifdef LIBGOBLIN_OBJINFO_INTERNALFUNC
+ void ObjectInfo_ClearObjectInfo( LibGoblin_ObjectInfo *p_binfo );
+#endif
+
+
+#endif /* DRD64_HEADER_LIBGOBLIN_OBJINFO */
+
+/* EOF of drd64_.h ----------------------------------- */
/*=====================================================================*/
typedef struct {
- Ptr ptr_address;
- char *pstr_name;
- DWord dw_size;
- DWord dw_srcid;
+ Ptr ptr_address; // Object Address
+ DWord dw_size; // Object Size (Address Range)
+ char *pstr_name; // Object Name (Param./Func./etc...)
+ //DWord dw_srcid; // SourceInfo struct ID
DWord dw_next;
Byte b_elf_flags;
- Word w_secid;
+ Word w_secid; // SectionInfo ItemIndex belong with this object.
} LibGoblin_AddressInfo;
/*=====================================================================*/
+typedef struct {
+ int i_id;
+
+ Ptr ptr_address; // Object Address
+ DWord dw_size; // Object Size (Address Range)
+ char *pstr_name; // Object Name (Param./Func./etc...)
+ //DWord dw_srcid; // SourceInfo struct ID
+ DWord dw_next;
+ Byte b_elf_flags;
+ Word w_secid; // SectionInfo ItemIndex belong with this object.
+
+} LibGoblin_ObjectInfo;
+
+
+/*=====================================================================*/
+typedef struct {
+ Ptr ptr_address;
+ LibGoblin_ObjectInfo *p_objinfo;
+} LibGoblin_AddressTable;
+
+/*=====================================================================*/
+typedef struct {
+ int i_srcid;
+ char str_filename[DRD64_MAX_PATH];
+ char str_localpath[DRD64_MAX_PATH];
+} LibGoblin_SourceInfo;
+
+
+/*=====================================================================*/
typedef struct {
int i_id;
int i_refcount;
int i_num_binfo;
LibGoblin_BinaryInfo *p_binfo[LIBGOBLIN_BINFO_MAXFILES];
- int i_opened_bid;
+ /* Address Table Info. */
+ LibGoblin_AddressInfo *p_addrinfo;
+ DWord dw_alloc_addrinfo;
+ DWord dw_max_addrinfo;
+ // Object Table ---
+ LibGoblin_ObjectInfo *p_objinfo;
+ int i_alloc_objinfo;
+ int i_max_objinfo;
+ int i_now_objinfo;
+
} LibGoblin_ProgramInfo;
{ goto goto_Test_LibGoblin_LoadProg_API_LoadProgram_test00_001_post; }
}
+ i_result = LibGoblin_AnalyzeProgram( i_pgid );
+ CU_ASSERT( 0x00 == i_result );
+
i_result = LibGoblin_FreeProgInfo( i_pgid );
CU_ASSERT( 0x00 == i_result );