This is the mail archive of the frysk@sources.redhat.com mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fcore status


I've updated FCore and relevant sections of the Java elf bindings as shown by the Changelog entries below.

FCore utility class core files now have a complete elf header, program segment header, section string table, section and corresponding data. It does not have Notes yet, that's for the coming week. So "basic" core files can be produced. There are buckets of caveats/bugs, but will get to those later.

For posterity, here is a little run down of how core files are right now:

There seems to be two ways to create basic core files:

- Do as the kernel appears to do, construct the elf header, construct the program header table, notes, and dump the relevant maps directly after that. The kernel does not use libelf, and does this manually.

- Libelf (and gcore). Construct the elf header, construct the program header table, notes, section string table, section headers and elf_data structs in there.

The former (kernel) is simpler, but you have to do the data dumping yourself without libelf. You could use libelf to construct the headers, but after that you are on your own (and would have to back-update the headers with proper offsets post dump).

If you choose to do it via libelf, the only elf data structure (Elf_Data) to hold raw data belongs to the sections api, and therefore you have to dump into sections and map them back to the program header. This appears to be exactly the way gdb does it (except gdb uses bfd, and fcore uses direct elf bindings). I really did not want to lose the large amount of lib elf abstractions, and this seemed to be the best way to maintain maximum libelf compatibility. Ultimately, I'm not 100% swayed on either method, but the libelf method will work for now.

Caveats:

- MapsBuilder seems to sometimes not produce complete map tables from /proc/$$/map
- fcore writes *all* maps right now, that is for debugging purposes
- large core file train wreck. I suspect as mixing ints (byte[] arrays size) with long (MapsBuilder api), with ints (inua.eio.ByteBuffer get parameters), we will smash on huge core files.
- Task.getMemory() only seems to map up the maximum for 32 bit architectures?
- large core file train wreck * 2: some elf headers don't match their corresponding Java types. Will fix these.
- I set the EI_CLASS size to either ELFCLASS32 or ELFCLASS64 depending on the architecture, but on my IA32 box it always seems to revert to ELFCLASS64. (This messes up some sections table entries on 32 bit)
- Arch tests. I have a horrible arch check in fcore. It's not a question of if it will fail, but when. I need to ISA to tell me what machine it is (PPC64, IA32 and so on), and the size 32/64 bit, 32 on 64 bit. Can anyone advise?
- Program header offsets are not correctly written back after the section Elf_Data is written. Bug.
- Program header alignments are not working.

I'll create bugs for all those.

The Elf bindings changes are mainly additions to the section ElfData and ElfSection API. What exited in the existing bindings only supported reading functions, and not updating back to the native elf structs, and writing those to disk



2006-10-15  Phil Muldoon  <pmuldoon@redhat.com>
	
	* frysk/util/FCore.java (write_elf_file): Rewritten with these changes:
	- Build elf header manually with full complement of data.
	- Build string table section/section header and update to disk.
	- (Still) Ugly arch test hack.
	* frysk/util/FCore.java (FCore.MapsCounter): Renamed.
	* frysk/util/FCore.java (FCore.CoreMapsBuilder): Renamed.
	(buildMap):Rewritten with these changes:
	- build section headers
	- define section headers in concert with program headers.
	- build section from header, create contextual Elf_Data class, and
	byte copy maps data.



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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]