Bug 3650 - lib/elf bindings need note section reading capability
Summary: lib/elf bindings need note section reading capability
Status: RESOLVED FIXED
Alias: None
Product: frysk
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Phil Muldoon
URL:
Keywords:
Depends on:
Blocks: 2243 3651
  Show dependency treegraph
 
Reported: 2006-12-04 23:19 UTC by Phil Muldoon
Modified: 2007-10-15 08:19 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Muldoon 2006-12-04 23:19:26 UTC
The note writing is basically stuffing large amounts of data (various
structures) into an Elf Data structure. The Elf Data structure contains a void
pointer that points to this data.

In reading the .note section data back, routines are needed to read this data
and propogate the data back somehow. As they data changes per architecture (ie
GP registers), need to figure out how to do this in Java.
Comment 1 Phil Muldoon 2007-02-13 21:35:55 UTC
2007-02-12  Phil Muldoon  <pmuldoon@redhat.com>
	
	* Elf.java (getRawData): New. Return raw elf data.
	* cni/Elf.cxx (elf_get_raw_data): Return raw byte data.
	
	* tests/TestElf.java (testElfCorePrpsNotes): New.Test Prpsinfo notes.
	(testElfCorePrstatusNotes): New. Test Prstatus notes.
	(testElfCorePrAuxvNotes): New. Test Auxv notes.
	
	* cni/ElfPrpsinfo.cxx (getNoteData): New. Parse raw note
	data and find relevant note section.
	* cni/ElfPrAuxv.cxx (getNoteData): Ditto
	* cni/ElfPrstatus.cxx (getNoteData): Ditto
	* cni/ElfData.cxx (elf_data_create_native): New. Create underlying
	native data structures.
	
	* ElfPrstatus.java (ElfPrstatus): New Constructor.
	(getRawCoreRegisters): New.
	(getThreadData): New.
	(getPrCurSig): Rename.
	* ElfPrpsinfo.java (ElfPrpsinfo): New Constructor.
	* ElfPrAuxv.java (ElfPrAuxv): New Constructor.
	(getAuxvBuffer): Return auxv data in raw form.
	* ElfData.java (ElfData): New constructor to take raw byte[] data
	and package into an ElfData class.
	(setBuffer): Take a size argument.
Comment 2 Phil Muldoon 2007-10-15 08:19:46 UTC
2007-10-11  Phil Muldoon  <pmuldoon@redhat.com>

	* ChangeLog.elf: New. Recreate pre-refactor ChangeLog
	entries from frysk-imports/lib/elf/ChangeLog.
	* ChangeLog.dw: New. Recreate pre-refactor ChangeLog
	entries from frysk-imports/lib/dw/ChangeLog.

2007-10-05  Phil Muldoon  <pmuldoon@redhat.com>

	* ElfPrpsinfo.java (ElfPrpsinfo): Take size hint parameter
	for 32 on 64.
	* ElfPrstatus.java (ElfPrstatus): Ditto
	* cni/ElfPrpsinfo.cxx (ElfPrpsinfo::getEntrySize): Use size
	parameter to decide wordsize.
	(ElfPrpsinfo::fillMemRegion): Use size parameter to define what
	structure to use, regardless of native wordsize.
	(ElfPrpsinfo): Split structures into 32 and 64 bit structures
	to deal with 32 on 64.
	* cni/ElfPrstatus.cxx (ElfPrstatus::getEntrySize): Use size
	parameter to decide wordsize.
	(ElfPrstatus::fillMemRegion): Use size parameter to define what
	structure to use, regardless of native wordsize.
	(ElfPrstatus): Split structures into 32 and 64 bit structures
	to deal with 32 on 64. Redefine several system structures locally
	to negate long usage.


2007-08-13  Phil Muldoon  <pmuldoon@redhat.com>

	* ElfNhdrType.java:Add NT_PRXFPREG constant.


2007-08-09  Phil Muldoon  <pmuldoon@redhat.com>

	* cni/ElfPrXFPRegSet.cxx (ElfPrXFPRegSet::getNoteData): <= != <

2007-08-08  Phil Muldoon  <pmuldoon@redhat.com>

	* TestElf.java (testXFPRegSet): New method.
	* ElfPrXFPRegSet: New File.
	* cni/ElfPrXFPRegSet.cxx: Ditto.


2007-07-12  Phil Muldoon  <pmuldoon@redhat.com>

        * tests/TestElf.java (testCore): Deleted
        (testElfCorePrpsNotes): Deleted.
        (testElfCorePrstatusNotes): Deleted.
        (testElfCorePrAuxvNotes): Deleted.
        (testCore_x86): New. Rewritten from old version
        to test cross ISA situations
        (testElfCorePrpsNotes_x86): Ditto.
        (testElfCorePrstatusNotes_x86): Ditto.
        (testElfCorePrAuxvNotes_x86): Ditto.
        (testCore_x8664): Ditto.
        (testElfCorePrpsNotes_x8664): Ditto.
        (testElfCorePrstatusNotes_x8664): Ditto.
        (testElfCorePrAuxvNotes_x8664): Ditto.

2007-07-03  Phil Muldoon  <pmuldoon@redhat.com>

        * ElfPrstatus.java (ElfPrStatus): Remove alignment.

2007-07-02  Phil Muldoon  <pmuldoon@redhat.com>

        * ElfPrFPRegSet.java (ElfPrFPRegSet): New private constructor.
        (decode): New. Take note data and decode Floating point data.
        * cni/ElfPrFPRegSet.cxx(fillMemRegion): Indent.
        (getNoteData): New. Decode multiple note structs.
        
        * ElfPrstatus.java (ElfPrstatus): Find value pr_fpvalid.
        (printAll): Indent.
        * cni/ElfPrstatus.cxx (ElfPrstatus): Always set
        prstatus->pr_fpvalid to 1.

        * tests/TestElf.java (testElfCorePrstatusNotes):
        Add FP stubs for test.
        
2007-06-19  Phil Muldoon  <pmuldoon@redhat.com>

        * ElfPrstatus.java (ElfPrstatus): Account for alignment
        of registers on x86_64.

2007-06-15  Phil Muldoon  <pmuldoon@redhat.com>

        * ElfPrstatus.java (ElfPrstatus): Account for alignment
        on longs.
        (printAll): New.

2007-06-13  Phil Muldoon  <pmuldoon@redhat.com>

        * ElfPrpsinfo.java (ElfPrpsinfo): Account for struct
        alignment and 16 bit integer values ox x86.

2007-06-11  Phil Muldoon <pmuldoon@redhat.com>

        * ElfPrstatus.java (decode): Increment thread counter.
        * tests/TestElf (testElfCorePrstatusNotes): Test decoded
        thread is not null.

2007-04-03  Phil Muldoon  <pmuldoon@redhat.com>

        * cni/ElfPrpsinfo.cxx (fillMemRegion): Construct name
        and args strings correctly (#4316).

2007-03-24  Phil Muldoon  <pmuldoon@redhat.com>
        
        * ElfData.java (elf_data_create_native): Made decl private.
        (elf_data_finalize): Ditto.
        * cni/ElfData.cxx (elf_data_create_native): Use java long
        pointer instead of native global pointer. Do not return a 
        pointer.
        
2007-03-23  Phil Muldoon  <pmuldoon@redhat.com>

        * ElfPrstatus.java (decode): Clean out threads list.

2007-03-19  Phil Muldoon  <pmuldoon@redhat.com>

        * ElfPrAuxv.java (ElfPrAuxv):Make constructor private. Only
        allow calls from decode. Delete old note constructor.
        (decode): New.
        (getNoteData): Make declaration static.
        * cni/ElfPrAuxv.cxx (getNoteData): Do not use extern byte array.
        Instead return byte[] array.
        * tests/TestElf.java (testElfCorePrAuxvNotes): Use decode.
        * ElfData.java (getParent): Change access to public.
        
2007-03-13  Phil Muldoon  <pmuldoon@redhat.com>

        * ElfPrstatus.java: Make constructor private. Only
        allow calls from decode.
        * tests/TestElf.java (testElfCorePrpsNotes): Use
        decode function.
        * ElfPrpsinfo.java (decode): New.
        (ElfPrpsinfo): Replace public constructor with private
        constructor. Called from decode.
        (getNoteData): Make CNI declaration static.
        

2007-03-08  Phil Muldoon  <pmuldoon@redhat.com>

        * ElfPrstatus.java: Add get/set for timeval variables.
        Make variables private.

2007-03-07  Phil Muldoon  <pmuldoon@redhat.com>

        * cni/ElfPrstatus.cxx (getNoteData): Rewrite. Return raw note
        data instead of trying to deconstruct.
        * ElfPrstatus.java: Add Timeval variables.
        (decode): New.
        (ElfPrstatus): New constructor, take single note data byte[]
        and parent Elf, and create single thread model.
        * tests/TestElf.java (testElfCorePrpstatusNotes): Remove
        brokenX8664XXX/brokenPpcXXX test limiters.
        Rewrite tests to use .decode.
: 

2007-03-06  Phil Muldoon  <pmuldoon@redhat.com>

        * tests/TestElf.java (testElfCorePrpsNotes): Remove
        brokenX8664XXX/brokenPpcXXX test limiters.


2007-03-02  Mark Wielaard  <mark@klomp.org>

        * cni/ElfPrpsinfo.cxx (getNoteData): Remove debug printfs.

2007-03-02  Phil Muldoon  <pmuldoon@redhat.com>

        * ElfPrpsinfo.java (ElfPrpsinfo): Rewrite note data constructor to
        make allowance for runtime architecture over core file
        architecture.
        * cni/ElfPrpsinfo.cxx (getNoteData): Rewrite. Just pass up raw
        byte data without interpretation.

2007-02-16  Mark Wielaard  <mark@klomp.org>

        * tests/TestElf.java (findNoteSegment): Doesn't throw.

2007-02-14  Phil Muldoon  <pmuldoon@redhat.com>

        * tests/TestElf.java: (testElfCorePrpsNotes): Disable on x86_64 and PPC
for now.
        (testElfCorePrstatusNotes): Ditto.


2007-02-12  Phil Muldoon  <pmuldoon@redhat.com>

        * Elf.java (getRawData): New. Return raw elf data.
        * cni/Elf.cxx (elf_get_raw_data): Return raw byte data.

        * tests/TestElf.java (testElfCorePrpsNotes): New.Test Prpsinfo notes.
        (testElfCorePrstatusNotes): New. Test Prstatus notes.
        (testElfCorePrAuxvNotes): New. Test Auxv notes.
        
        * cni/ElfPrpsinfo.cxx (getNoteData): New. Parse raw note
        data and find relevant note section.
        * cni/ElfPrAuxv.cxx (getNoteData): Ditto
        * cni/ElfPrstatus.cxx (getNoteData): Ditto
        * cni/ElfData.cxx (elf_data_create_native): New. Create underlying
        native data structures.

        * ElfPrstatus.java (ElfPrstatus): New Constructor.
        (getRawCoreRegisters): New.
        (getThreadData): New.
        (getPrCurSig): Rename.
        * ElfPrpsinfo.java (ElfPrpsinfo): New Constructor.
        * ElfPrAuxv.java (ElfPrAuxv): New Constructor.
        (getAuxvBuffer): Return auxv data in raw form.        
        * ElfData.java (ElfData): New constructor to take raw byte[] data
        and package into an ElfData class.
        (setBuffer): Take a size argument.

2007-02-08  Phil Muldoon  <pmuldoon@redhat.com>

        * ElfCommand.java: GNU indent.
        Add ELF_C_WRITE_MMAP constant.

2007-02-07  Phil Muldoon  <pmuldoon@redhat.com>

        * Elf.java (Elf): Rewrite file open logic.
        Remove boolean write flag: infer from elf command.
        * cni/Elf.cxx (elf_begin): Open file based on elf command.



2006-12-07  Phil Muldoon  <pmuldoon@redhat.com>

        * ElfNhdr.java (fillMemRegion): Throw exceptions on size
        mismatch.
        * cni/ElfPrstatus.cxx (fillMemRegion): Return
        correct size.
        * cni/ElfPrpsinfo.cxx (fillMemRegion): Return
        correct size.


2006-11-13  Phil Muldoon  <pmuldoon@redhat.com>

        * ElfPrFPRegSet.java: New File.
        * cni/ElfPrFPRegSet.cxx: New File.

2006-10-27  Phil Muldoon  <pmuldoon@redhat.com>

        * cni/ElfPrAuxv.cxx: New File.
        * ElfPrAuxv.java: New File.


2006-10-23  Phil Muldoon  <pmuldoon@redhat.com>

        * cni/ElfPrstatus.cxx: Add in forward u63/u32 decl
        for x86_64 for now.

2006-10-22  Phil Muldoon  <pmuldoon@redhat.com>

        * ElfPrstatus.java: New file.
        * cni/ElfPrstatus.cxx: Ditto

2006-10-20  Yong Zheng  <zhengyo@cn.ibm.com>

        * ElfPrpsinfo.java (setPrPgrp): Rename to getPrPgrp.

2006-10-19  Phil Muldoon  <pmuldoon@redhat.com>

        * ElfPrpsinfo.java (setPrFname): Use String instead of char[].
        (getPrFname): Return String instead of char[].
        (setPrPsarg): Use String instead of char[].
        (getPrPsarg): Return String instead of char[].
        * cni/ElfPrpsinfo.cxx (fillMemRegion): Use JvGetStringUTFRegion
        to calculate char[] array instead of jchar elements

        * ElfPrpsinfo.java(setPrFname): Do not
        set null termination in Java. String.toCharArray
        returns a char[] array of size of String.

2006-10-19  Yong Zheng  <zhengyo@cn.ibm.com>

        * ElfNhdr.java: New file.
        * ELfNhdrType.java: Ditto.
        * ELfPrpsinfo.java: Ditto.
        * cni/ELfNhdr.cxx: Ditto.
        * cni/ELfPrpsinfo.cxx: Ditto.

2006-10-17  Phil Muldoon  <pmuldoon@redhat.com>

        * Elf.java (createNewEHeader): Require a wordsize. 

        * cni/Elf.cxx (elf_newehdr): Specify wordsize.
        gelf_getclass() for wordsize won't work on an empty elf struct.
        * cni/ElfSection.cxx (elf_updateshdr): Fixed casts.

2006-10-15  Phil Muldoon  <pmuldoon@redhat.com>

        * Elf.java (getElfVersion): New function.
        (initializeCoreHeader): Remove. Deprecated.
        * ElfData.java (setBuffer): New function. Set elf buffer.
        (setType): New.  
        (setSize): New.
        (setOffset): New.
        * ElfEHeader.java: Added Data, Class and Type constants.
        * ElfPHeader.java : Added Type constants.
        * ElfSection (update):  New Function. Update class
        back to native elf header.
        * ElfSectionHeader.java: Changed constructor access to public.
        * ElfSectionHeaderTypes.java : New.

        * cni/Elf.cxx (elf_init_core_header): Removed. Deprecated.
        * cni/ElfData.cxx (elf_data_set_buff): New function.
        (elf_data_set_type): Ditto.
        (elf_data_set_version): Ditto.
        (elf_data_set_size): Ditto.
        (elf_data_set_off): Ditto.
        (elf_data_set_align): Ditto.
        * cni/ElfSection.cxx:
        (ElfSection): Check if ehdr->e_shstrndx exists before
        attempting to calculate name from string table.
        (elf_updateshdr): New.


2006-10-13  Phil Muldoon  <pmuldoon@redhat.com>

        * ElfPHeader.java: Checked in a patch by Yong Zheng  
        <zhengyo@cn.ibm.com> that enumerates some PHFLAG types.

2006-10-11  Phil Muldoon  <pmuldoon@redhat.com>

        * cni/Elf.cxx: (elf_begin): Check args to allow writing to
        elf files.
        (elf_get_last_error_msg): New.
        (elf_get_last_error_no): New.
        (elf_updatehdr): New.
        (elf_init_core_header): New. Temporary.
        (elf_updatephdr): New.
        
        * Elf.java (Elf): Add a boolean constructor switch
        for write/read.
        (updateEHeader): New. Write Elf header back to native
        structure.
        (initializeCoreHeader): Temporary. Convienience function.
        (updatePHeader): New. Write the program segment back to native
        structure.
        (getLastErrorMsg): New. Get the error message corresponding to
        entry below.
        (getLastErrorNo): New. Get the error number set if the last
        elf function failed.