Latest news from debugging JWLINK battle field SEGFAULT in my latest post was caused by
DEBUG output function called with argument
name = NULL I simply commented it out , see line731 ( in my heavily checkpointed version) :
objorl.cstatic orl_return ProcSymbol( orl_symbol_handle symhdl )
/******************************************************/
{
... ...
name = ORLSymbolGetName( symhdl );
DEBUG((DBG_OLD," -------------------- ProcSymbol checkpoint 3 "));
//DEBUG((DBG_OLD, "objorl.ProcSymbol(%s) enter", name )); !!! - NB - !!!
if( type & ORL_SYM_TYPE_FILE ) {
if( !(CurrMod->modinfo & MOD_GOT_NAME) ) {
CurrMod->modinfo |= MOD_GOT_NAME;
_LnkFree( CurrMod->name );
CurrMod->name = AddStringStringTable( &PermStrings, name );
}
return( ORL_OKAY );
}
With my fingers crossed I ran it again in hope it'll work till the very happy end ... but what I saw was a new , now REAL bug .
See
...
ObjPass1(): exit, file = test.o, module = test.c
DoPass1(test.o) exit
ProcObjFiles exit
ResolveUndefined enter
searching libraries
LibFind( puts_, 0 )
ProcLibFile( puts_ ) enter, mod=test.c, calling SearchLib()
SearchLib( puts_ ): sym found in lib, module pos=0000005c
ProcLibFile( puts_ ): symbol found in puts.o, modinfo=00000300
ObjPass1(): enter, file = libtest.lib, module = puts.o
- ObjPass1(): checkpoint 1
- ObjPass1(): checkpoint 2
- ObjPass1(): checkpoint 3
- ObjPass1(): checkpoint 4
- ObjPass1(): checkpoint 5 CurrMod->name = puts.o
objorl.ORLPass1(): CurrMod=puts.o
objorl.ORLPass1(): checkpoint 1
---- InitFile entry
---- InitFile exit
------ ORLFileInit entry
-------- ORLFileInit ORL_ELF case entry
---------- ORLFileInit checkpoint 1
---------- ORLFileInit checkpoint 2
---------- ORLFileInit checkpoint 3
------------ ElfFileInit entry
------------ ElfFileInit checkpoint 1
------------ ElfFileInit checkpoint 2
------------ ElfFileInit checkpoint 3
------------ ElfFileInit checkpoint 4
------------ ElfFileInit checkpoint 5
------------ ElfFileInit checkpoint 6
------------- ElfLoadFileStructure entry
--------------- ElfLoadFileStructure checkpoint 1
--------------- ElfLoadFileStructure checkpoint 2
--------------- ElfLoadFileStructure checkpoint 3
--------------- ElfLoadFileStructure checkpoint 4
--------------- e_hdr64->e_shoff = 20302020 m e_hdr64->e_ehsize = 20202020
--------------- ElfLoadFileStructure checkpoint 6
--------------- ElfLoadFileStructure checkpoint 7 shoff = 540024864, ehsize= 538976288
--------------- ElfLoadFileStructure checkpoint 8
--------------- ElfLoadFileStructure checkpoint 9
--------------- ElfLoadFileStructure checkpoint 10 , contents_size1 = 540016640
Segmentation fault
To reach the place of interest in GDB debugging session you should execute the following sequence of commands ( NOTE: your paths may vary):
gdb --args ../JWLINK/OWLinuxD/jwlink. form elf file test.o lib libtest name testD
symbol-file ../JWLINK/OWLinuxD/jwlink.sym
b main
run
b ElfLoadFileStructure //(in elfload.c )
c // continue till the first hit with
test.o b 559 // ( breakpoint at line 559)
c
print *e_hdr64 // (dump ELF header read from file)
all looks good here :
$3 = {e_ident = 0x80d77d0 "\177ELF\002\001\001", e_type = 1, e_machine = 62, e_version = 1, e_entry = 0, e_phoff = 0,
e_shoff = 304, e_flags = 0, e_ehsize = 64, e_phentsize = 0, e_phnum = 0, e_shentsize = 64, e_shnum = 12, e_shstrndx = 9}
c // - continue till the second hit of ElfLoadFileStructure with
libtest.lib file
c //- till line 559
print *e_hdr64 (dump ELF header read from file)
$2 = {
e_ident = 0x80d7998 "!<arch>\n/", ' ' <repeats 15 times>, "1455639231 0 0 0 24 \245\275\275\275\031",
e_type = 8224, e_machine = 8224, e_version = 538976288, e_entry = 3618980083482833969, e_phoff = 2314885599537934643,
e_shoff = 2314885530819502112, e_flags = 538976304, e_ehsize = 8224, e_phentsize = 8224, e_phnum = 13362,
e_shentsize = 8224, e_shnum = 8224, e_shstrndx = 8224}
It looks completely no good ! Function
_ClientRead( elf_file_hnd, sizeof( Elf64_Ehdr ) ) reads ELF headers from the start of
libtest.lib !
elfload.c if( elf_file_hnd->flags & ORL_FILE_FLAG_64BIT_MACHINE ) {
printf(" --------------- ElfLoadFileStructure checkpoint 4 \n");
e_hdr64 = _ClientRead( elf_file_hnd, sizeof( Elf64_Ehdr ) );
New version with added checkpoints attached . If all will go well next December I may ( or may not , who knows) be able to fix it myself
