Copyright (C) 2000-2012 |
GNU Info (nasm.info)Section 6.106.10. `dbg': Debugging Format ============================= The `dbg' output format is not built into NASM in the default configuration. If you are building your own NASM executable from the sources, you can define `OF_DBG' in `outform.h' or on the compiler command line, and obtain the `dbg' output format. The `dbg' format does not output an object file as such; instead, it outputs a text file which contains a complete list of all the transactions between the main body of NASM and the output-format back end module. It is primarily intended to aid people who want to write their own output drivers, so that they can get a clearer idea of the various requests the main program makes of the output driver, and in what order they happen. For simple files, one can easily use the `dbg' format like this: nasm -f dbg filename.asm which will generate a diagnostic file called `filename.dbg'. However, this will not work well on files which were designed for a different object format, because each object format defines its own macros (usually user- level forms of directives), and those macros will not be defined in the `dbg' format. Therefore it can be useful to run NASM twice, in order to do the preprocessing with the native object format selected: nasm -e -f rdf -o rdfprog.i rdfprog.asm nasm -a -f dbg rdfprog.i This preprocesses `rdfprog.asm' into `rdfprog.i', keeping the `rdf' object format selected in order to make sure RDF special directives are converted into primitive form correctly. Then the preprocessed source is fed through the `dbg' format to generate the final diagnostic output. This workaround will still typically not work for programs intended for `obj' format, because the `obj' `SEGMENT' and `GROUP' directives have side effects of defining the segment and group names as symbols; `dbg' will not do this, so the program will not assemble. You will have to work around that by defining the symbols yourself (using `EXTERN', for example) if you really need to get a `dbg' trace of an `obj'-specific source file. `dbg' accepts any section name and any directives at all, and logs them all to its output file. |