mirror of https://github.com/svaarala/duktape.git
Browse Source
* Add documentation for duk_debugger_attach_custom() and duk_debugger_notify() * Change tag from 'debug' to 'debugger' * Minor additions to other debugger API callspull/600/head
Sami Vaarala
9 years ago
5 changed files with 99 additions and 4 deletions
@ -0,0 +1,43 @@ |
|||||
|
name: duk_debugger_attach_custom |
||||
|
|
||||
|
proto: | |
||||
|
void duk_debugger_attach_custom(duk_context *ctx, |
||||
|
duk_debug_read_function read_cb, |
||||
|
duk_debug_write_function write_cb, |
||||
|
duk_debug_peek_function peek_cb, |
||||
|
duk_debug_read_flush_function read_flush_cb, |
||||
|
duk_debug_write_flush_function write_flush_cb, |
||||
|
duk_debug_request_function request_cb, |
||||
|
duk_debug_detached_function detached_cb, |
||||
|
void *udata); |
||||
|
|
||||
|
summary: | |
||||
|
<p>Same as <code><a href="#duk_debugger_attach">duk_debugger_attach()</a></code> |
||||
|
but has an additional <code>request_cb</code> callback to support application |
||||
|
specific debug commands (AppRequest). The <code>request_cb</code> may also be |
||||
|
NULL to indicate that the application doesn't support AppRequest.</p> |
||||
|
|
||||
|
<p>See the debugger documentation for more information and examples on how |
||||
|
to use application specific commands.</p> |
||||
|
|
||||
|
example: | |
||||
|
duk_debugger_attach(ctx, |
||||
|
my_read_cb, |
||||
|
my_write_cb, |
||||
|
my_peek_cb, |
||||
|
NULL, |
||||
|
NULL, |
||||
|
my_request_cb, |
||||
|
my_detached_cb, |
||||
|
my_udata); |
||||
|
|
||||
|
tags: |
||||
|
- debugger |
||||
|
|
||||
|
seealso: |
||||
|
- duk_debugger_attach |
||||
|
- duk_debugger_detach |
||||
|
- duk_debugger_cooperate |
||||
|
- duk_debugger_notify |
||||
|
|
||||
|
introduced: 1.5.0 |
@ -0,0 +1,43 @@ |
|||||
|
name: duk_debugger_notify |
||||
|
|
||||
|
proto: | |
||||
|
duk_bool_t duk_debugger_notify(duk_context *ctx, duk_idx_t nvalues); |
||||
|
|
||||
|
stack: | |
||||
|
[ ... val1! ...! valN! ] -> [ ... ] |
||||
|
|
||||
|
summary: | |
||||
|
<p>Send an application specific debugger notify (AppNotify) containing the |
||||
|
<code>nvalues</code> values on the value stack top mapped to debug protocol |
||||
|
dvalues. The return value indicates whether the notify was successfully |
||||
|
sent (non-zero) or not (zero). The <code>nvalues</code> arguments are |
||||
|
always popped off the stack top. The call is a no-op if debugger support |
||||
|
has not been compiled in, or if the debugger is not attached; in both cases |
||||
|
the call will return zero to indicate that the notify was not sent.</p> |
||||
|
|
||||
|
<p>See the debugger documentation for more information and examples on how |
||||
|
to use application specific notifications.</p> |
||||
|
|
||||
|
example: | |
||||
|
/* Causes the following notify to be sent over the debugger protocol: |
||||
|
* |
||||
|
* NFY AppNotify "BatteryStatus" 740 1000 true EOM |
||||
|
*/ |
||||
|
int battery_current = 740; |
||||
|
int battery_limit = 1000; |
||||
|
int battery_charging = 1; |
||||
|
|
||||
|
duk_push_string(ctx, "BatteryStatus"); |
||||
|
duk_push_int(ctx, battery_current); |
||||
|
duk_push_int(ctx, battery_limit); |
||||
|
duk_push_boolean(ctx, battery_charging); |
||||
|
if (duk_debugger_notify(ctx, 4 /*nvalues*/)) { |
||||
|
printf("battery status notification sent\n"); |
||||
|
} else { |
||||
|
printf("battery status notification not sent\n"); |
||||
|
} |
||||
|
|
||||
|
tags: |
||||
|
- debugger |
||||
|
|
||||
|
introduced: 1.5.0 |
Loading…
Reference in new issue