meme / hellscape

GIMPLE obfuscator for C, C++, Go, ... all supported GCC targets and front-ends that use GIMPLE.
GNU General Public License v3.0
390 stars 34 forks source link

[Question] Debugging hellscape #12

Closed arquicanedo closed 4 years ago

arquicanedo commented 4 years ago

@meme thanks for sharing hellscape. It is very illustrative to have running code in parallel to the plugin documentation.

I was able to compile and run hellscape with Ubuntu's GCC 10.0.1. Now that I have it running I'd like to set some breakpoints to explore things.

I saw that this note in the readme:

Additionally: If you experience crashes when developing your plug-in, you can debug them by passing -wrapper gdb,--args to gcc. (Run gcc in gdb, effectively.)

However, it is not very clear to me how to do it. I get this gdb error:

$ gcc -wrapper gdb foo.c
gdb: unrecognized option '-imultiarch'
Use `gdb --help' for a complete list of options.

I also tried setting a breakpoint as follows but does not stop in the dummy NXPass that I just created.

$ gdb gcc
...
Reading symbols from gcc...
(No debugging symbols found in gcc)
(gdb) b Quit
(gdb) b NXPass::execute
Function "NXPass::execute" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (NXPass::execute) pending.
(gdb) r -fplugin=./hellscape.so -fplugin-arg-hellscape-nx foo.c -fdump-tree-all-graph
Starting program: /usr/bin/gcc -fplugin=./hellscape.so -fplugin-arg-hellscape-nx foo.c -fdump-tree-all-graph
[Detaching after vfork from child process 8598]
[Detaching after vfork from child process 8599]
[Detaching after vfork from child process 8600]
[Inferior 1 (process 8594) exited normally]
(gdb) 

When executed directly the NX pass generates an output so it is working.

Can you please share how you debug hellscape?

meme commented 4 years ago

SUPPORT WILL NOT BE PROVIDED ON THE ISSUE TRACKER (bugs are always welcome). PAID SUPPORT IS AVAILABLE.

The instructions are clear: gcc -wrapper gdb,--args foo.c