dump a module from inside GDB to a file

Hi All,

I changed the CFG of a big function using a pass that runs on a function, I am having trouble debugging it. Is there someway to dump a module to a file from inside gdb? I have access to the Module pointer. Let me know if anything else is needed.

Hi All,

I changed the CFG of a big function using a pass that runs on a function, I am having trouble debugging it. Is there someway to dump a module to a file from inside gdb? I have access to the Module pointer. Let me know if anything else is needed.

Ankit,

From within GDB you can run the following command:

“call m->dump()”

This will print the module in the bitcode in a textual format.

Hi Nadev,

The module is really big and i would like the dump to happen in a file instead of stdout. Is that possible?

The module is really big and i would like the dump to happen in a file instead
of stdout. Is that possible?

Maybe you can tell gdb to direct stderr to a file, do the dump, then redirect
stderr to the usual place?

Ciao, Duncan.

(gdb) module->dump()