Hello,
Is there any Parser available to parse the disassembly generated by xobjdump? I am interested to parse disassembly of an XC program to transform to prolog predicates.
Regards
Umer
Parser for disassembly?
-
- New User
- Posts: 2
- Joined: Wed Nov 07, 2012 5:51 pm
-
- Respected Member
- Posts: 259
- Joined: Thu Sep 16, 2010 9:15 am
Could you please elaborate on what exactly you want to do ? Do you need to see functions prolog and predicates or what ?
-
- New User
- Posts: 2
- Joined: Wed Nov 07, 2012 5:51 pm
The idea is to use existing static analyzers for logic programs by converting disassembly to a logic program(which represents at least the behavior to be analyzed).ale500 wrote:Could you please elaborate on what exactly you want to do ? Do you need to see functions prolog and predicates or what ?
There are two steps 1)Parsing disassembly 2)Transforming to equivalent prolog program or any other language for that matter.
For 1, thats what I am interested in, it will save me time to write a parser from scratch to do step 2.
For 2, I guess the details are unnecessary but to answer your post: For prolog, It doesn't need to be an exact equivalent rather an abstract representation with jumps converted to new predicate calls, instructions as facts, branches of same jump as multiple clauses of the same predicate and so on. I hope that gave you an idea.
-
- Member++
- Posts: 31
- Joined: Fri Aug 31, 2012 3:42 pm
I have personnaly written a disassembler (C++ language , project in Microsoft Visual Studio 6.0).
I can give it to you if you want. Just have to modify the source program to format it's output as you want.
I have written that to :
-Check that the documented instruction set is correct
-Make a disasembler that product an output that can re-pass in the Assembler, so one can modify a program a little and re-assemble it.
My dissassembler seems ok for all code (XMOS libraries and sample programs). It takes .o and .xe as input.
If you interested by this open-source disassembler, ok to send it to you. But i think that the "project" section of this site has also another project with a disassembler if i remember.
If you still want to "parse" the output of objdump, i understand what it is about, but i think it is also ok if you get a disassembler with the output you want.
I can give it to you if you want. Just have to modify the source program to format it's output as you want.
I have written that to :
-Check that the documented instruction set is correct
-Make a disasembler that product an output that can re-pass in the Assembler, so one can modify a program a little and re-assemble it.
My dissassembler seems ok for all code (XMOS libraries and sample programs). It takes .o and .xe as input.
If you interested by this open-source disassembler, ok to send it to you. But i think that the "project" section of this site has also another project with a disassembler if i remember.
If you still want to "parse" the output of objdump, i understand what it is about, but i think it is also ok if you get a disassembler with the output you want.
-
- XCore Expert
- Posts: 844
- Joined: Sun Jul 11, 2010 1:31 am
I have written a few yes. The one most useful to other people is probablyCarpentier wrote:But i think that the "project" section of this site has also another project with a disassembler if i remember.
my port of GNU binutils.
It doesn't handle XE files, first split out the per-core ELF files using xobjdump,
but then it's plain sailing.
-
- Respected Member
- Posts: 318
- Joined: Tue Dec 15, 2009 12:46 am
If you do want to read XE files then there is some C++ code for doing this in the tool_axe github repository (see lib/XE.cpp) that could easily be extracted and used on its own. There's also code to disassemble instructions (lib/Instruction.cpp) but this would require more work to extract so you are probably better off using Segher's binutils port.segher wrote:It doesn't handle XE files, first split out the per-core ELF files using xobjdump, but then it's plain sailing.