tag:blogger.com,1999:blog-4647272498333643717.post8798214876927154003..comments2014-02-10T02:36:32.876-08:00Comments on My Stuff: How can I call main() functionBhushanhttp://www.blogger.com/profile/06045051297685729399noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-4647272498333643717.post-46093397396493855252013-05-22T02:22:46.800-07:002013-05-22T02:22:46.800-07:00Hello Mr Bhushan,
I am interested in a program th...Hello Mr Bhushan,<br /><br />I am interested in a program that should be able to run stand alone <br />but should also be integrated as a library into a larger program. <br />Precisely, it is some sort of debugger, dbx and gdb and their clients <br />serve as the prototypes of the approach. In contrast to dbx and gdb <br />the client will not run as separate process. The client is <br />the program that should be able to run stand alone as well <br />should be callable from the debugger, and I have no control about the <br />design of the client (at best I can force the creation of a shared<br />library instead of an executable). <br /><br />So I'm very interested in the work you did (in fact it seems to be <br />rather singular, a Google search did not offer more proposals). <br />The Sun version works very well but not the Linux version, <br />probably your version from 2008 did not follow all developments of Linux. <br /><br />Here is the output when running your example on a <br />"Linux ubuntu 3.8.0-21-generic x86_64" platform:<br /><i>bash: ./func.so: Accessing a corrupted shared library</i><br /><br />And this is the output of "readelf -l func.so":<br /><i><br />Elf file type is DYN (Shared object file)<br />Entry point 0x7e0<br />There are 9 program headers, starting at offset 64<br /><br />Program Headers:<br /> Type Offset VirtAddr PhysAddr<br /> FileSiz MemSiz Flags Align<br /> PHDR 0x0000000000000040 0x0000000000000040 0x0000000000000040<br /> 0x00000000000001f8 0x00000000000001f8 R E 8<br /> INTERP 0x0000000000000830 0x0000000000000830 0x0000000000000830<br /> 0x0000000000000013 0x0000000000000013 R 10<br /> [Requesting program interpreter: /lib/ld-linux.so.2]<br /> LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000<br /> 0x00000000000008ec 0x00000000000008ec R E 200000<br /> LOAD 0x0000000000000e00 0x0000000000200e00 0x0000000000200e00<br /> 0x0000000000000248 0x0000000000000250 RW 200000<br /> DYNAMIC 0x0000000000000e18 0x0000000000200e18 0x0000000000200e18<br /> 0x00000000000001c0 0x00000000000001c0 RW 8<br /> NOTE 0x0000000000000238 0x0000000000000238 0x0000000000000238<br /> 0x0000000000000024 0x0000000000000024 R 4<br /> GNU_EH_FRAME 0x0000000000000844 0x0000000000000844 0x0000000000000844<br /> 0x0000000000000024 0x0000000000000024 R 4<br /> GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000<br /> 0x0000000000000000 0x0000000000000000 RW 8<br /> GNU_RELRO 0x0000000000000e00 0x0000000000200e00 0x0000000000200e00<br /> 0x0000000000000200 0x0000000000000200 R 1<br /><br /> Section to Segment mapping:<br /> Segment Sections...<br /> 00 <br /> 01 .interp <br /> 02 .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .interp .eh_frame_hdr .eh_frame <br /> 03 .init_array .fini_array .jcr .dynamic .got .got.plt .data .bss <br /> 04 .dynamic <br /> 05 .note.gnu.build-id <br /> 06 .eh_frame_hdr <br /> 07 <br /> 08 .init_array .fini_array .jcr .dynamic .got <br /></i><br /><br />So what can I do to make the example (and then my program) running? <br />Unfortunately, my working place is the Linux machine <br />(I can use the Sun as guest only) and my knowledge of the ELF syntax <br />and semantics is very poor. <br /> <br />With regards<br />Wolfgang Jansen<br />wojahttps://www.blogger.com/profile/01288326618337546199noreply@blogger.com