Commit graph

53 commits

Author SHA1 Message Date
Théophile Bastian fd8478552a (WIP) python scripts to generate csmith benchs
This is not working yet, and might well be an abandonned approach
2018-06-04 14:54:58 +02:00
Théophile Bastian 6bdeda910f bench: add validate_csmith
Check that a csmith-generated file is interresting enough to be worth
keeping and compiling.
2018-06-04 14:53:59 +02:00
Théophile Bastian 11a218b6ab Add benchlib 2018-06-04 14:46:55 +02:00
Théophile Bastian f872119189 Refactor generate_eh_elf args handling
Use a `config` class
2018-06-04 13:57:21 +02:00
Théophile Bastian 2f91f732cb Add two csmith benching scripts 2018-05-18 11:39:01 +02:00
Théophile Bastian df2d6179a8 Add a libunwind-powered stack_walker
Preserves stack_walker's interface (one can link against stack_walker or
stack_walker_unwind indifferently).
2018-05-18 11:33:39 +02:00
Théophile Bastian 6854eb56e4 [BREAKING CHANGE] Unwinding stops at the end
This introduces a breaking change: [undefined] was previously
represented by 0, and is now represented by
`numeric_limits<uintptr_t>::max()`
2018-05-16 16:51:01 +02:00
Théophile Bastian 209e668505 Add READMEs 2018-05-15 18:13:09 +02:00
Théophile Bastian ee6e534fc9 Add .rodata to compare-sizes 2018-05-15 16:14:17 +02:00
Théophile Bastian 49cd75b7b7 Gen_eh_elf: add --force (force re-generation) 2018-05-11 17:58:09 +02:00
Théophile Bastian 4ccd49fb8a gen_eh_elf: handle -O{0,1,2,3,s} directly 2018-05-11 15:53:02 +02:00
Théophile Bastian 52ea92dcf8 Fix various problems in PC list handling 2018-05-11 15:52:38 +02:00
Théophile Bastian bc05e8270c Add --pc-list switch to generate_eh_elf 2018-05-11 15:52:08 +02:00
Théophile Bastian 13ebe46df2 Refactor extract_pc
This is meant to make it easy to call the pc extractor from some other
python code as well, to call it from generate_eh_elf.py
2018-05-11 13:09:58 +02:00
Théophile Bastian 26d7b2afd5 Add C++ code to make use of .pc_list 2018-05-11 13:09:35 +02:00
Théophile Bastian 83b304db95 Add script to extract all valid PCs of ELFs 2018-05-09 17:57:26 +02:00
Théophile Bastian 789e79613c Refactor python shared snippets 2018-05-09 17:55:57 +02:00
Théophile Bastian 066f1f06c1 Add compare_sizes: compare eh_elf vs eh_frame size 2018-05-09 15:32:42 +02:00
Théophile Bastian ba75dfa95f Fix eh_elf path error
The function `readlink` does not null-terminate its strings…
2018-05-09 15:32:34 +02:00
Théophile Bastian 7b6ff32465 Enhance Makefile for tests 2018-05-09 12:40:52 +02:00
Théophile Bastian 9aa74ad1f7 Add parameter --remote
Allows to offload the heavy steps (the compilation .c -> .o) to some
remote server
2018-05-07 15:49:22 +02:00
Théophile Bastian afe2d0b7c7 stack_walker: adapt to switch generation policies 2018-05-02 15:08:37 +02:00
Théophile Bastian c18027a0d2 generate_eh_elf.py: update to use dwarf-assembly options 2018-05-02 15:08:31 +02:00
Théophile Bastian 4b327c7c56 eh_elf generator: now also producing global switch 2018-05-02 14:58:48 +02:00
Théophile Bastian 601fb2fcd0 Python: make compatible with 3.5
subprocess.*(…, encoding='utf-8') → .decode('utf-8')
2018-05-02 14:47:05 +02:00
Théophile Bastian f8cdeda962 Ignore *.bin under tests/ 2018-04-27 17:33:16 +02:00
Théophile Bastian b8f6a2302c Fix stack walk display 2018-04-27 17:32:49 +02:00
Théophile Bastian 4595bb48fb StackWalker: multiple fixes
Includes adding a few failsafe guards, translating the instruction
pointer before handing it to the eh_elf.so, a few cosmetic changes, ...
2018-04-27 17:31:53 +02:00
Théophile Bastian f00ec34b4e CodeGenerator: use hex for switches' bounds 2018-04-27 17:07:58 +02:00
Théophile Bastian 467cfbf0cc CodeGenerator: fix badly generated eh_elf 2018-04-27 17:07:34 +02:00
Théophile Bastian 0318fabeb0 generate_eh_elf: compile in C to avoid name mangling
This made symbol lookup problematic…
2018-04-27 11:36:36 +02:00
Théophile Bastian 39ecc7a8c1 Use those functions in stack_walked.cpp test 2018-04-27 11:06:25 +02:00
Théophile Bastian f7151c6621 Implement missing stack_walker.cpp functions 2018-04-27 11:06:06 +02:00
Théophile Bastian da38a9d521 Move _fde_func_t typedef to shared .h 2018-04-27 11:05:34 +02:00
Théophile Bastian 69e6c10c36 Add fde_handler_for_pc (untested)
This is an abstraction function to get the _fde_yyy function out of the
eh_elf for a given PC
2018-04-26 19:48:00 +02:00
Théophile Bastian 4ab7d0a594 Add a simple stack_walker test 2018-04-26 19:17:34 +02:00
Théophile Bastian f587eadbcc Add a tentative stack walker using eh_elfs
This is only a beginning: this does so far load the appropriate
eh_elf.so files and read a context. Unwinding is still absent.
2018-04-26 19:16:01 +02:00
Théophile Bastian be221f68d5 Check mtime to avoid recreating existing so 2018-04-26 19:15:37 +02:00
Théophile Bastian 353a97c49d Refactor code generation: use shared/context_struct.h
This allows #include'ing `context_struct.h` in the stack walker
implementation as well
2018-04-25 18:11:59 +02:00
Théophile Bastian 771aec2621 Remove debug output 2018-04-25 17:49:02 +02:00
Théophile Bastian ff0f8c90df Allow unimplemented registers to appear in DWARF
The presence of such a register — eg. rcx, which is actually used in CFA
on a few lines of libgcc_s.so on my system — will yield an assert(0) in
the produced code, but will at least not fail to compile alltogether.
2018-04-25 17:34:31 +02:00
Théophile Bastian 31f811eca4 Add python script to compile easily 2018-04-25 17:33:59 +02:00
Théophile Bastian c07b0623e4 Add generation of a lookup function 2018-04-24 17:44:09 +02:00
Théophile Bastian 44543d85d3 Generate compilable C code, untested 2018-04-23 18:58:05 +02:00
Théophile Bastian d13b625cc5 SimpleDwarf, DwarfReader: fix machine registers 2018-04-23 16:46:03 +02:00
Théophile Bastian dc6072e991 Add simple main 2018-04-23 16:22:32 +02:00
Théophile Bastian f6e9b8ebd2 Add Makefile 2018-04-23 16:22:27 +02:00
Théophile Bastian f9f64e9606 SimpleDwarf: few fixes 2018-04-23 16:12:10 +02:00
Théophile Bastian 8bf2e1e49d SimpleDwarf: add pretty-printing operator<< 2018-04-23 15:59:10 +02:00
Théophile Bastian 13e3647629 Add libdwarfpp-based DwarfReader 2018-04-23 15:09:52 +02:00