Browse Source

Merge branch 'debugger-readwrite-torture'

pull/156/head
Sami Vaarala 10 years ago
parent
commit
e3c4f9b4d9
  1. 1
      Makefile
  2. 7
      doc/feature-options.rst
  3. 6
      src/duk_debugger.c
  4. 8
      src/duk_features.h.in

1
Makefile

@ -202,6 +202,7 @@ CCOPTS_FEATURES += -DDUK_OPT_DEBUGGER_SUPPORT
CCOPTS_FEATURES += -DDUK_OPT_DEBUGGER_FWD_PRINTALERT
CCOPTS_FEATURES += -DDUK_OPT_DEBUGGER_FWD_LOGGING
CCOPTS_FEATURES += -DDUK_OPT_DEBUGGER_DUMPHEAP
#CCOPTS_FEATURES += -DDUK_OPT_DEBUGGER_TRANSPORT_TORTURE
CCOPTS_FEATURES += -DDUK_OPT_TARGET_INFO='"duk command built from Duktape repo"'
#CCOPTS_FEATURES += -DDUK_OPT_NO_JX
#CCOPTS_FEATURES += -DDUK_OPT_NO_JC

7
doc/feature-options.rst

@ -749,6 +749,13 @@ Support the DumpHeap command. This is optional because the command is not
always needed. The command also has a relatively large footprint (about 10%
of debugger code); in absolute terms it's about 1kB of code footprint.
DUK_OPT_DEBUGGER_TRANSPORT_TORTURE
----------------------------------
Development time option: force debugger transport torture. Concretely this
now causes Duktape to read/write debug protocol data in 1-byte increments,
which stresses message parsing and transport code.
Debugging options
=================

6
src/duk_debugger.c

@ -168,6 +168,9 @@ DUK_INTERNAL void duk_debug_read_bytes(duk_hthread *thr, duk_uint8_t *data, duk_
}
DUK_ASSERT(heap->dbg_read_cb != NULL);
DUK_ASSERT(left >= 1);
#if defined(DUK_USE_DEBUGGER_TRANSPORT_TORTURE)
left = 1;
#endif
got = heap->dbg_read_cb(heap->dbg_udata, (char *) p, left);
if (got == 0 || got > left) {
DUK_D(DUK_DPRINT("connection error during read, return zero data"));
@ -477,6 +480,9 @@ DUK_INTERNAL void duk_debug_write_bytes(duk_hthread *thr, const duk_uint8_t *dat
}
DUK_ASSERT(heap->dbg_write_cb != NULL);
DUK_ASSERT(left >= 1);
#if defined(DUK_USE_DEBUGGER_TRANSPORT_TORTURE)
left = 1;
#endif
got = heap->dbg_write_cb(heap->dbg_udata, (const char *) p, left);
if (got == 0 || got > left) {
DUK_D(DUK_DPRINT("connection error during write"));

8
src/duk_features.h.in

@ -2262,7 +2262,6 @@ typedef FILE duk_file;
#define DUK_USE_DOUBLE_LINKED_HEAP
#define DUK_USE_MARK_AND_SWEEP
#define DUK_USE_MS_STRINGTABLE_RESIZE
#undef DUK_USE_GC_TORTURE
#if defined(DUK_OPT_NO_REFERENCE_COUNTING)
#undef DUK_USE_REFERENCE_COUNTING
@ -2291,6 +2290,7 @@ typedef FILE duk_file;
#undef DUK_USE_MS_STRINGTABLE_RESIZE
#endif
#undef DUK_USE_GC_TORTURE
#if defined(DUK_OPT_GC_TORTURE)
#define DUK_USE_GC_TORTURE
#endif
@ -2382,6 +2382,12 @@ typedef FILE duk_file;
#define DUK_USE_DEBUGGER_DUMPHEAP
#endif
/* Debugger transport read/write torture. */
#undef DUK_USE_DEBUGGER_TRANSPORT_TORTURE
#if defined(DUK_OPT_DEBUGGER_TRANSPORT_TORTURE)
#define DUK_USE_DEBUGGER_TRANSPORT_TORTURE
#endif
/* For opcodes with indirect indices, check final index against stack size.
* This should not be necessary because the compiler is trusted, and we don't
* bound check non-indirect indices either.

Loading…
Cancel
Save