 of the argument to the current dump file. No newlines or other whitespace are added.
Note that dumping is disabled by default; in this case, the call will do nothing.
Get the name of the current dump file.
If called from within a pass for which dumping is enabled, it will return the filename in string form.
If dumping is disabled for this pass, it will return None.
The typical output of a dump file will contain:
;; Function bar (bar) (dumped information when handling function bar goes here) ;; Function foo (foo) (dumped information when handling function foo goes here)
class TestPass(gcc.GimplePass): def execute(self, fun): # Dumping of strings: gcc.dump('hello world') # Dumping of other objects: gcc.dump(42) ps = TestPass(name='test-pass') ps.register_after('cfg') ps.dump_enabled = True
would have a dump file like this:
;; Function bar (bar) hello world42 ;; Function foo (foo) hello world42
Alternatively, it can be simpler to create your own logging system, given that one can simply open a file and write to it.
Get the base file path and name prefix for GCC’s dump files.
You can use this when creating non-standard logfiles and other output.
For example, the libcpychecker code can write HTML reports on reference-counting errors within a function, writing the output to a file named:
filename = '%s.%s-refcount-errors.html' % (gcc.get_dump_base_name(), fun.decl.name)
given fun, a
By default, this is the name of the input file, but within the output file’s directory. (It can be overridden using the -dumpbase command-line option).