/***********************************************************************
***********************************************************************/
-LIBGOBLIN_API
-int
- LibGoblin_AllocBinInfo(
- int i_pgid,
- const char *pstr_filename )
-{
- LibGoblin_ProgramInfo *p_pginfo = NULL;
- LibGoblin_BinaryInfo *p_binfo = NULL;
-
- p_pginfo = ProgInfo_GetProgInfo( i_pgid );
-
- p_binfo = BinaryInfo_AllocBinInfo( p_pginfo, pstr_filename, -1 );
- if( NULL == p_binfo ) {
- return -0x01;
- }
-
- return p_binfo->i_id;
-}
-
-
-/***********************************************************************
-***********************************************************************/
-LIBGOBLIN_API
-int
- LibGoblin_FreeBinInfo(
- int i_binfoid )
-{
- int i_result;
- LibGoblin_BinaryInfo *p_binfo = NULL;
-
- p_binfo = BinaryInfo_GetBinInfo( i_binfoid );
- if( NULL == p_binfo ) {
- return -0x01;
- }
-
- i_result = BinaryInfo_FreeBinInfo( p_binfo );
- if( 0x00 != i_result ) {
- return -0x02;
- }
-
- return i_result;
-}
-
-
-/***********************************************************************
-***********************************************************************/
+#define FUNCID_LibGoblin_AllocProgInfo 0x11
LIBGOBLIN_API_PROGINFO
int
LibGoblin_AllocProgInfo(
p_pginfo = ProgInfo_AllocProgInfo();
if( NULL == p_pginfo ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x01 ),
+ LOCATION( FUNCID_LibGoblin_AllocProgInfo ),
+ errno, (QWord)p_pginfo, (QWord)0x00, __LINE__ );
return -0x01;
}
i_result = ObjectInfo_Init( p_pginfo, 0 );
if( 0x00 != i_result ) {
ProgInfo_FreeProgInfo( p_pginfo ); // None use return value.
+
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x02 ),
+ LOCATION( FUNCID_LibGoblin_AllocProgInfo ),
+ errno, (QWord)i_result, (QWord)0x00, __LINE__ );
return -0x02;
}
/***********************************************************************
***********************************************************************/
+#define FUNCID_LibGoblin_FreeProgInfo 0x12
LIBGOBLIN_API_PROGINFO
int
LibGoblin_FreeProgInfo(
p_pginfo = ProgInfo_GetProgInfo( i_pgid );
if( NULL == p_pginfo ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x01 ),
+ LOCATION( FUNCID_LibGoblin_FreeProgInfo ),
+ errno, (QWord)p_pginfo, (QWord)0x00, __LINE__ );
return -0x01;
}
assert( p_pginfo->i_id == i_pgid );
i_result = ProgInfo_FreeProgInfo( p_pginfo );
if( 0x00 != i_result ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x02 ),
+ LOCATION( FUNCID_LibGoblin_FreeProgInfo ),
+ errno, (QWord)i_result, (QWord)0x00, __LINE__ );
return -0x02;
}
i_err = LibFileType_Init();
if( 0x00 != i_err ) {
LibBrownie_Error_SetErrorInfo(
- DRD64_ERROR( DRD64_ERROR_PTN_LIBCALL, 0x01, 0x01 ),
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x01 ),
LOCATION( FUNCID_LibGoblin_Init ),
errno, (QWord)i_err, (QWord)0x00, __LINE__ );
return i_err;
i_err = ProgInfo_Init();
if( 0x00 != i_err ) {
LibBrownie_Error_SetErrorInfo(
- DRD64_ERROR( DRD64_ERROR_PTN_LIBCALL, 0x01, 0x02 ),
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x02 ),
LOCATION( FUNCID_LibGoblin_Init ),
errno, (QWord)i_err, (QWord)0x00, __LINE__ );
return i_err;
i_err = BinaryInfo_Init();
if( 0x00 != i_err ) {
LibBrownie_Error_SetErrorInfo(
- DRD64_ERROR( DRD64_ERROR_PTN_LIBCALL, 0x01, 0x03 ),
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x03 ),
LOCATION( FUNCID_LibGoblin_Init ),
errno, (QWord)i_err, (QWord)0x00, __LINE__ );
return i_err;
i_err = BinaryInfo_Term();
if( 0x00 != i_err ) {
LibBrownie_Error_SetErrorInfo(
- DRD64_ERROR( DRD64_ERROR_PTN_LIBCALL, 0x01, 0x01 ),
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x01 ),
LOCATION( FUNCID_LibGoblin_Term ),
errno, (QWord)i_err, (QWord)0x00, __LINE__ );
return i_err;
i_err = ProgInfo_Term();
if( 0x00 != i_err ) {
LibBrownie_Error_SetErrorInfo(
- DRD64_ERROR( DRD64_ERROR_PTN_LIBCALL, 0x01, 0x02 ),
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x02 ),
LOCATION( FUNCID_LibGoblin_Term ),
errno, (QWord)i_err, (QWord)0x00, __LINE__ );
return i_err;
i_err = LibFileType_Term();
if( 0x00 != i_err ) {
LibBrownie_Error_SetErrorInfo(
- DRD64_ERROR( DRD64_ERROR_PTN_LIBCALL, 0x01, 0x03 ),
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x03 ),
LOCATION( FUNCID_LibGoblin_Term ),
errno, (QWord)i_err, (QWord)0x00, __LINE__ );
return i_err;
/*--------------------------------------------------------------------*/
void Test_ReadBinary_File_test00_001( void )
{
- int i_binfoid;
int i_result;
LibGoblin_BinaryInfo *p_binfo;
i_result = LibGoblin_Init();
CU_ASSERT( 0x00 == i_result );
- i_binfoid = LibGoblin_AllocBinInfo( -1, "dwarftest" );
- CU_ASSERT( 0x00 == i_binfoid );
-
- p_binfo = BinaryInfo_GetBinInfo( i_binfoid );
+ p_binfo = BinaryInfo_AllocBinInfo( NULL, "dwarftest", -1 );
CU_ASSERT( NULL != p_binfo );
i_result = BinaryInfo_SetProgramPath( p_binfo, NULL, "../testdata" );
i_result = ReadBinary_FreeBinary( p_binfo );
CU_ASSERT( 0x00 == i_result );
- i_result = LibGoblin_FreeBinInfo( i_binfoid );
+ i_result = BinaryInfo_FreeBinInfo( p_binfo );
CU_ASSERT( 0x00 == i_result );
i_result = LibGoblin_Term();
/*--------------------------------------------------------------------*/
void Test_ReadBinary_File_test00_002( void )
{
- int i_binfoid;
int i_result;
LibGoblin_BinaryInfo *p_binfo;
i_result = LibGoblin_Init();
CU_ASSERT( 0x00 == i_result );
- i_binfoid = LibGoblin_AllocBinInfo( -1, "dwarftest" );
- CU_ASSERT( 0x00 == i_binfoid );
-
- p_binfo = BinaryInfo_GetBinInfo( i_binfoid );
+ p_binfo = BinaryInfo_AllocBinInfo( NULL, "dwarftest", -1 );
CU_ASSERT( NULL != p_binfo );
i_result = BinaryInfo_SetProgramPath( p_binfo,
i_result = ReadBinary_FreeBinary( p_binfo );
CU_ASSERT( 0x00 == i_result );
- i_result = LibGoblin_FreeBinInfo( i_binfoid );
+ i_result = BinaryInfo_FreeBinInfo( p_binfo );
CU_ASSERT( 0x00 == i_result );
i_result = LibGoblin_Term();
/*--------------------------------------------------------------------*/
void Test_ReadBinary_Memory_test00_001( void )
{
- int i_binfoid;
int i_result;
int i_fd;
ssize_t sz_read;
i_result = LibGoblin_Init();
CU_ASSERT( 0x00 == i_result );
- i_binfoid = LibGoblin_AllocBinInfo( -1, "dwarftest" );
- CU_ASSERT( 0x00 == i_binfoid );
-
- p_binfo = BinaryInfo_GetBinInfo( i_binfoid );
+ p_binfo = BinaryInfo_AllocBinInfo( NULL, "dwarftest", -1 );
CU_ASSERT( NULL != p_binfo );
i_result = BinaryInfo_SetProgramPath( p_binfo, NULL, "../testdata" );
free( pb_data );
close( i_fd );
- i_result = LibGoblin_FreeBinInfo( i_binfoid );
+ i_result = BinaryInfo_FreeBinInfo( p_binfo );
CU_ASSERT( 0x00 == i_result );
i_result = LibGoblin_Term();