summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/directiv.dat1
-rw-r--r--doc/nasmdoc.src14
-rw-r--r--output/outdbg.c34
3 files changed, 39 insertions, 10 deletions
diff --git a/asm/directiv.dat b/asm/directiv.dat
index e1378ec7..10ffebcd 100644
--- a/asm/directiv.dat
+++ b/asm/directiv.dat
@@ -77,3 +77,4 @@ uppercase ; outieee, outobj
; --- Pragma operations
subsections_via_symbols ; macho
no_dead_strip ; macho
+maxdump ; dbg
diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src
index 2d84b64e..fd3c6b6f 100644
--- a/doc/nasmdoc.src
+++ b/doc/nasmdoc.src
@@ -6217,11 +6217,6 @@ a hint as to where to find requested symbols.
\H{dbgfmt} \i\c{dbg}: Debugging Format
-The \c{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 \i\c{OF_DBG} in \c{output/outform.h} or on the
-compiler command line, and obtain the \c{dbg} output format.
-
The \c{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
@@ -6262,6 +6257,15 @@ yourself (using \c{EXTERN}, for example) if you really need to get a
\c{dbg} accepts any section name and any directives at all, and logs
them all to its output file.
+\c{dbg} accepts and logs any \c{%pragma}, but the specific
+\c{%pragma}:
+
+\c %pragma dbg maxdump <size>
+
+where \c{<size>} is either a number or \c{unlimited}, can be used to
+control the maximum size for dumping the full contents of a
+\c{rawdata} output object.
+
\C{16bit} Writing 16-bit Code (DOS, Windows 3/3.1)
diff --git a/output/outdbg.c b/output/outdbg.c
index 5608b446..ffd6b394 100644
--- a/output/outdbg.c
+++ b/output/outdbg.c
@@ -42,6 +42,7 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
+#include <errno.h>
#include "nasm.h"
#include "nasmlib.h"
@@ -170,7 +171,7 @@ static void dbg_out(const struct out_data *data)
fprintf(ofile, " ins %s(%d)",
nasm_insn_names[data->itemp->opcode], data->itemp->operands);
} else {
- fprintf(ofile, " (data)");
+ fprintf(ofile, " no ins (plain data)");
}
if (data->type == OUT_ADDRESS || data->type == OUT_RELADDR ||
@@ -305,6 +306,13 @@ dbg_directive(enum directives directive, char *value, int pass)
}
static enum directive_result
+dbg_pragma(const struct pragma *pragma);
+
+static const struct pragma_facility dbg_pragma_list[] = {
+ { NULL, dbg_pragma }
+};
+
+static enum directive_result
dbg_pragma(const struct pragma *pragma)
{
fprintf(ofile, "pragma %s(%s) %s[%s] %s\n",
@@ -313,6 +321,26 @@ dbg_pragma(const struct pragma *pragma)
pragma->opname, directive_name(pragma->opcode),
pragma->tail);
+ if (pragma->facility == &dbg_pragma_list[0] &&
+ pragma->opcode == D_MAXDUMP) {
+ if (!nasm_stricmp(pragma->tail, "unlimited")) {
+ dbg_max_data_dump = -1UL;
+ } else {
+ char *ep;
+ unsigned long arg;
+
+ errno = 0;
+ arg = strtoul(pragma->tail, &ep, 0);
+ if (errno || *nasm_skip_spaces(ep)) {
+ nasm_error(ERR_WARNING | ERR_WARN_BAD_PRAGMA | ERR_PASS2,
+ "invalid %%pragma dbg maxdump argument");
+ return DIRR_ERROR;
+ } else {
+ dbg_max_data_dump = arg;
+ }
+ }
+ }
+
return DIRR_OK;
}
@@ -385,10 +413,6 @@ static const struct dfmt * const debug_debug_arr[3] = {
NULL
};
-static const struct pragma_facility dbg_pragma_list[] = {
- { NULL, dbg_pragma }
-};
-
const struct ofmt of_dbg = {
"Trace of all info passed to output stage",
"dbg",