{"action":"created","issue":{"url":"https://api.github.com/repos/radare/radeco/issues/2","labels_url":"https://api.github.com/repos/radare/radeco/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/radare/radeco/issues/2/comments","events_url":"https://api.github.com/repos/radare/radeco/issues/2/events","html_url":"https://github.com/radare/radeco/issues/2","id":105263480,"number":2,"title":"`radeco` utility request/specification","user":{"login":"sushant94","id":3993360,"avatar_url":"https://avatars.githubusercontent.com/u/3993360?v=3","gravatar_id":"","url":"https://api.github.com/users/sushant94","html_url":"https://github.com/sushant94","followers_url":"https://api.github.com/users/sushant94/followers","following_url":"https://api.github.com/users/sushant94/following{/other_user}","gists_url":"https://api.github.com/users/sushant94/gists{/gist_id}","starred_url":"https://api.github.com/users/sushant94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sushant94/subscriptions","organizations_url":"https://api.github.com/users/sushant94/orgs","repos_url":"https://api.github.com/users/sushant94/repos","events_url":"https://api.github.com/users/sushant94/events{/privacy}","received_events_url":"https://api.github.com/users/sushant94/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-07T20:16:01Z","updated_at":"2015-09-07T20:16:05Z","closed_at":null,"body":"_From @XVilka on July 4, 2015 19:50_\n\nRadeco\r\n======\r\n\r\nThe radare decompiler tool, (namedly 'radeco') should be able to run from r2 or from the shell, accepting different inputs and dumping different outputs.\r\n\r\nwe can make radeco r2pipe friendly and interact with r2 using the pipes. this piece is already done, but not used at all. so i would suggest making the 'radeco' executable that allows to run like this:\r\n    \r\n    $ radeco -h\r\n    Usage: radeco [-flags] [...]\r\n    -h           show this help\r\n    -o [type]    specify output type (ssa, )\r\n    -i [type]    specify input type\r\n    -r [r2pipe]  specify how to connect to r2\r\n    -O           output all intermediate representations to files (.asm .esil .ssa. ...)\r\n    Types: (listedn bottom-top)\r\n     - asm   : assembly/hexpairs\r\n     - esil\r\n     - ssa\r\n     - dot\r\n     - ... magic ...\r\n     - C code\r\n\r\nThe -r flag can be used to tell the r2pipe connection how to talk to r2 using http, pipes, etc. in order to retrieve all the type information, function signatures, function names, symbols, imports, variable names, etc. By default, if no -r is specified it should check the environment variable R2PIPE_IN and R2PIPE_OUT and connect using pipe in that case.\r\n\r\nWe should be able to run this tool from commandline or inside r2 like this:\r\n    \r\n    $ radeco -i asm -o ssa disasm.txt > disasm-ssa.txt\r\n\r\nAnd from inside the r2 shell:\r\n    \r\n    > #!pipe radeco -o c   # decompile current function\r\n\r\nAs long as we have a chain of transformations we should define that pipeline in code and be able to serialize that info from memory data structures to something human readable. This will be good for the testsuite and for debugging issues on every internal decompilation step.\r\n\r\nBear in mind that radeco will get info from r2... but it will also export info to r2. this is. radeco is able to identify basic blocks, local variables, loops, etc.\r\n\r\n-> we shold focus on having this tool done asap, it will help to understand the whole problem better, and everyone should be able to test it and use it from r2. The tool can be then rewritten as an RCore command, but this is out of the scope of the current problem, because decompilation needs to happen first.\r\n\r\nThe next step would be to write a PseudoWriter module that takes the graph and prints C-like code, the graph representation must contain all the information needed to generate this output.\n\n_Copied from original issue: radare/radeco-lib#13_"},"comment":{"url":"https://api.github.com/repos/radare/radeco/issues/comments/138369866","html_url":"https://github.com/radare/radeco/issues/2#issuecomment-138369866","issue_url":"https://api.github.com/repos/radare/radeco/issues/2","id":138369866,"user":{"login":"sushant94","id":3993360,"avatar_url":"https://avatars.githubusercontent.com/u/3993360?v=3","gravatar_id":"","url":"https://api.github.com/users/sushant94","html_url":"https://github.com/sushant94","followers_url":"https://api.github.com/users/sushant94/followers","following_url":"https://api.github.com/users/sushant94/following{/other_user}","gists_url":"https://api.github.com/users/sushant94/gists{/gist_id}","starred_url":"https://api.github.com/users/sushant94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sushant94/subscriptions","organizations_url":"https://api.github.com/users/sushant94/orgs","repos_url":"https://api.github.com/users/sushant94/repos","events_url":"https://api.github.com/users/sushant94/events{/privacy}","received_events_url":"https://api.github.com/users/sushant94/received_events","type":"User","site_admin":false},"created_at":"2015-09-07T20:16:05Z","updated_at":"2015-09-07T20:16:05Z","body":"_From @mewmew on July 4, 2015 23:2_\n\n> As long as we have a chain of transformations we should define that pipeline in code and be able to serialize that info from memory data structures to something human readable. This will be good for the testsuite and for debugging issues on every internal decompilation step.\r\n\r\nThere is no +1 on GitHub issues, but I'd like echo this idea. I wholeheartedly believe in the powerful notion of having tools operate on well-defined input and output, and having these tools emit data from intermediate steps in human readable format (or a format which is isomorphic to a human readable format). This approach facilitates debugging and the implementation of test cases, it gives great insight into the inner workings of the pipeline, and most importantly, it enables multiple implementations of each component within the pipeline. Each implementation with their respective benefits and trade offs.\r\n\r\nI know radare has always followed the Unix philosophy. I'm just happy to see radeco following the same principles."}}