From: Peter L. <pe...@ro...> - 2014-09-16 15:26:02
|
Yes, I want disassemble LLVM bitcode to LLVM assembly. Basically I want to do exactly what llvm-dis does, but I'd like to have the programmatic bindings that capstone provides; ie: get list of all the instructions with each instruction object having it's opcode, source registers, and destination registers broken out in nice Python/Ruby/C#/Java/etc. objects. Ideally, I'd like to use some of the same tools already built (or that I build in the future) using capstone but with LLVM bitcode files as source instead of *insert architecture here* machine code files. Sorry for not being clear at first. I'll take a look at the llvm-dis source, the question really is how hard will it be to integrate that source into capstone so we have API parity with the other supported input machine languages. Thanks for any further thoughts you have now or in the future regarding this! Peter On Tue, Sep 16, 2014 at 10:10 AM, Nguyen Anh Quynh <aq...@gm...> wrote: > > > On Tue, Sep 16, 2014 at 10:06 PM, Nguyen Anh Quynh <aq...@gm...> > wrote: > >> >> >> On Tue, Sep 16, 2014 at 9:51 PM, Peter Lucia <pe...@ro...> wrote: >> >>> Any thoughts on how hard it would be to implement? Note that I'm only >>> trying to go to LLVM assembly code, not some other architecture's assembly >>> code. Thanks >>> >> >> do you mean generating machine code from LLVM bitcode? this involves the >> backends of all related archs, and is quite different from what Capstone is >> doing. so extending Capstone to do this is not the choice, but you need to >> do that from scratch. >> >> to have a better idea, look at the source of llvm-dis. that is certainly >> a lot of works. >> > > i think i misunderstood your question: you actually want to disassemble > LLVM bitcode to LLVM assembly, right? > > then it is much easier than generating machine code from LLVM bitcode, but > again you should look at the source of llvm-dis. > > > cheers, > Q > > >> >> >>> Peter >>> >>> On Tue, Sep 16, 2014 at 8:24 AM, Nguyen Anh Quynh <aq...@gm...> >>> wrote: >>> >>>> >>>> >>>> On Tue, Sep 16, 2014 at 6:20 AM, Peter Lucia <pe...@ro...> >>>> wrote: >>>> >>>>> Hello, >>>>> >>>>> Is LLVM Bitcode itself a supported input architecture? I have some >>>>> files that have not yet been fully compiled to PowerPC or MIPS, but instead >>>>> are still in LLVM Bitcode format (in other words, clang with the -emit >>>>> -llvm option) and I'd love to use capstone to disassemble them >>>>> pragmatically. >>>>> >>>>> If this is not already implemented, how hard would it be to do? Is >>>>> there some other better way to do this? I'm using llvm-dis now, but it's >>>>> not ideal for all the reasons capstone would seem to excel. >>>>> >>>>> >>>> unfortunately no. the main idea of Capstone is to disassemble machine >>>> binary code back to assembly code. so Capstone does not, and will never >>>> convert LLVM bitcode back to assembly for you. >>>> >>>> >>>> thanks. >>>> Q >>>> >>> >>> >> |