OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef INCLUDE_DART_DEBUGGER_API_H_ | 5 #ifndef INCLUDE_DART_TOOLS_API_H_ |
6 #define INCLUDE_DART_DEBUGGER_API_H_ | 6 #define INCLUDE_DART_TOOLS_API_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 | 9 |
| 10 /** \mainpage Dart Tools Embedding API Reference |
| 11 * |
| 12 * This reference describes the Dart embedding API for tools. Tools include |
| 13 * a debugger, service protocol, and timeline. |
| 14 * |
| 15 * NOTE: The APIs described in this file are unstable and subject to change. |
| 16 * |
| 17 * This reference is generated from the header include/dart_tools_api.h. |
| 18 */ |
| 19 |
| 20 |
| 21 /* |
| 22 * ======== |
| 23 * Debugger |
| 24 * ======== |
| 25 */ |
10 typedef struct _Dart_Breakpoint* Dart_Breakpoint; | 26 typedef struct _Dart_Breakpoint* Dart_Breakpoint; |
11 | 27 |
12 typedef struct _Dart_StackTrace* Dart_StackTrace; | 28 typedef struct _Dart_StackTrace* Dart_StackTrace; |
13 | 29 |
14 typedef struct _Dart_ActivationFrame* Dart_ActivationFrame; | 30 typedef struct _Dart_ActivationFrame* Dart_ActivationFrame; |
15 | 31 |
16 /** | 32 /** |
17 * An id used to uniquely represent an Isolate in the debugger wire protocol | 33 * An id used to uniquely represent an Isolate in the debugger wire protocol |
18 * messages. | 34 * messages. |
19 */ | 35 */ |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 * values at offset 2*n+1. | 486 * values at offset 2*n+1. |
471 */ | 487 */ |
472 DART_EXPORT Dart_Handle Dart_GetLocalVariables( | 488 DART_EXPORT Dart_Handle Dart_GetLocalVariables( |
473 Dart_ActivationFrame activation_frame); | 489 Dart_ActivationFrame activation_frame); |
474 | 490 |
475 | 491 |
476 /** | 492 /** |
477 * Returns origin class of a function. | 493 * Returns origin class of a function. |
478 * | 494 * |
479 * Requires there to be a current isolate. | 495 * Requires there to be a current isolate. |
480 * | 496 * |
481 * \return Returns the class id (a handle to an integer) of the class in | 497 * \return Returns the class id (a handle to an integer) of the class in |
482 * which \function is defined. Returns a null handle if \function is defined | 498 * which \function is defined. Returns a null handle if \function is defined |
483 * at the top level. Returns an error object otherwise. | 499 * at the top level. Returns an error object otherwise. |
484 */ | 500 */ |
485 DART_EXPORT Dart_Handle Dart_GetFunctionOrigin(Dart_Handle function); | 501 DART_EXPORT Dart_Handle Dart_GetFunctionOrigin(Dart_Handle function); |
486 | 502 |
487 | 503 |
488 /** | 504 /** |
489 * Returns an array containing all the global variable names and values of | 505 * Returns an array containing all the global variable names and values of |
490 * the library with given \library_id. | 506 * the library with given \library_id. |
(...skipping 22 matching lines...) Expand all Loading... |
513 * | 529 * |
514 * Requires there to be a current isolate. | 530 * Requires there to be a current isolate. |
515 * | 531 * |
516 * The expression is evaluated in the context of \target. | 532 * The expression is evaluated in the context of \target. |
517 * If \target is a Dart object, the expression is evaluated as if | 533 * If \target is a Dart object, the expression is evaluated as if |
518 * it were an instance method of the class of the object. | 534 * it were an instance method of the class of the object. |
519 * If \target is a Class, the expression is evaluated as if it | 535 * If \target is a Class, the expression is evaluated as if it |
520 * were a static method of that class. | 536 * were a static method of that class. |
521 * If \target is a Library, the expression is evaluated as if it | 537 * If \target is a Library, the expression is evaluated as if it |
522 * were a top-level function in that library. | 538 * were a top-level function in that library. |
523 * | 539 * |
524 * \return A handle to the computed value, or an error object if | 540 * \return A handle to the computed value, or an error object if |
525 * the compilation of the expression fails, or if the evaluation throws | 541 * the compilation of the expression fails, or if the evaluation throws |
526 * an error. | 542 * an error. |
527 */ | 543 */ |
528 DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target, | 544 DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target, |
529 Dart_Handle expr); | 545 Dart_Handle expr); |
530 | 546 |
531 | 547 |
532 /** | 548 /** |
533 * Returns the class of the given \object. | 549 * Returns the class of the given \object. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id); | 730 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id); |
715 | 731 |
716 | 732 |
717 /** | 733 /** |
718 * Returns the isolate id for an isolate. | 734 * Returns the isolate id for an isolate. |
719 * | 735 * |
720 * \return The Dart_IsolateId value corresponding to the isolate. | 736 * \return The Dart_IsolateId value corresponding to the isolate. |
721 */ | 737 */ |
722 DART_EXPORT Dart_IsolateId Dart_GetIsolateId(Dart_Isolate isolate); | 738 DART_EXPORT Dart_IsolateId Dart_GetIsolateId(Dart_Isolate isolate); |
723 | 739 |
724 #endif // INCLUDE_DART_DEBUGGER_API_H_ | 740 |
| 741 /* |
| 742 * ======= |
| 743 * Service |
| 744 * ======= |
| 745 */ |
| 746 |
| 747 /** |
| 748 * A service request callback function. |
| 749 * |
| 750 * These callbacks, registered by the embedder, are called when the VM receives |
| 751 * a service request it can't handle and the service request command name |
| 752 * matches one of the embedder registered handlers. |
| 753 * |
| 754 * \param method The rpc method name. |
| 755 * \param param_keys Service requests can have key-value pair parameters. The |
| 756 * keys and values are flattened and stored in arrays. |
| 757 * \param param_values The values associated with the keys. |
| 758 * \param num_params The length of the param_keys and param_values arrays. |
| 759 * \param user_data The user_data pointer registered with this handler. |
| 760 * |
| 761 * \return Returns a C string containing a valid JSON object. The returned |
| 762 * pointer will be freed by the VM by calling free. |
| 763 */ |
| 764 typedef const char* (*Dart_ServiceRequestCallback)( |
| 765 const char* method, |
| 766 const char** param_keys, |
| 767 const char** param_values, |
| 768 intptr_t num_params, |
| 769 void* user_data); |
| 770 |
| 771 |
| 772 /** |
| 773 * Register a Dart_ServiceRequestCallback to be called to handle |
| 774 * requests for the named rpc on a specific isolate. The callback will |
| 775 * be invoked with the current isolate set to the request target. |
| 776 * |
| 777 * \param method The name of the method that this callback is responsible for. |
| 778 * \param callback The callback to invoke. |
| 779 * \param user_data The user data passed to the callback. |
| 780 * |
| 781 * NOTE: If multiple callbacks with the same name are registered, only |
| 782 * the last callback registered will be remembered. |
| 783 */ |
| 784 DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback( |
| 785 const char* method, |
| 786 Dart_ServiceRequestCallback callback, |
| 787 void* user_data); |
| 788 |
| 789 |
| 790 /** |
| 791 * Register a Dart_ServiceRequestCallback to be called to handle |
| 792 * requests for the named rpc. The callback will be invoked without a |
| 793 * current isolate. |
| 794 * |
| 795 * \param method The name of the command that this callback is responsible for. |
| 796 * \param callback The callback to invoke. |
| 797 * \param user_data The user data passed to the callback. |
| 798 * |
| 799 * NOTE: If multiple callbacks with the same name are registered, only |
| 800 * the last callback registered will be remembered. |
| 801 */ |
| 802 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
| 803 const char* method, |
| 804 Dart_ServiceRequestCallback callback, |
| 805 void* user_data); |
| 806 |
| 807 |
| 808 /* |
| 809 * ======== |
| 810 * Timeline |
| 811 * ======== |
| 812 */ |
| 813 |
| 814 /** |
| 815 * Add a duration timeline event to the embedder stream for the current isolate. |
| 816 * |
| 817 * \param label The name of the event. |
| 818 * \param start_micros The start of the duration (in microseconds) |
| 819 * \param end_micros The end of the duration (in microseconds) |
| 820 * |
| 821 * NOTE: On Posix platforms you should use gettimeofday and on Windows platforms |
| 822 * you should use GetSystemTimeAsFileTime to get the time values. |
| 823 */ |
| 824 DART_EXPORT Dart_Handle Dart_TimelineDuration(const char* label, |
| 825 int64_t start_micros, |
| 826 int64_t end_micros); |
| 827 |
| 828 |
| 829 /** |
| 830 * Add an instant timeline event to the embedder stream for the current isolate. |
| 831 * |
| 832 * \param label The name of event. |
| 833 * |
| 834 * NOTE: On Posix platforms this call uses gettimeofday and on Windows platforms |
| 835 * this call uses GetSystemTimeAsFileTime to get the current time. |
| 836 */ |
| 837 DART_EXPORT Dart_Handle Dart_TimelineInstant(const char* label); |
| 838 |
| 839 |
| 840 /** |
| 841 * Adds an asynchronous begin timeline event to the embedder stream for the |
| 842 * current isolate. |
| 843 * |
| 844 * \param label The name of event. |
| 845 * |
| 846 * \return Returns an asynchronous id that must be passed to |
| 847 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. If the asynchronous |
| 848 * id is less than 0 the event was not added to the timeline and subsequent |
| 849 * calls to Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd will become |
| 850 * no-ops. |
| 851 * |
| 852 * NOTE: On Posix platforms this call uses gettimeofday and on Windows platforms |
| 853 * this call uses GetSystemTimeAsFileTime to get the current time. |
| 854 */ |
| 855 DART_EXPORT Dart_Handle Dart_TimelineAsyncBegin(const char* label, |
| 856 int64_t* async_id); |
| 857 |
| 858 |
| 859 /** |
| 860 * Adds an asynchronous instant timeline event to the embedder stream for the |
| 861 * current isolate. |
| 862 * |
| 863 * \param label The name of event. |
| 864 * |
| 865 * \return Returns an asynchronous id that must be passed to |
| 866 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. |
| 867 * |
| 868 * NOTE: On Posix platforms this call uses gettimeofday and on Windows platforms |
| 869 * this call uses GetSystemTimeAsFileTime to get the current time. |
| 870 */ |
| 871 DART_EXPORT Dart_Handle Dart_TimelineAsyncInstant(const char* label, |
| 872 int64_t async_id); |
| 873 |
| 874 |
| 875 /** |
| 876 * Adds an asynchronous end timeline event to the embedder stream for the |
| 877 * current isolate. |
| 878 * |
| 879 * \param label The name of event. |
| 880 * |
| 881 * \return Returns an asynchronous id that must be passed to |
| 882 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. |
| 883 * |
| 884 * NOTE: On Posix platforms this call uses gettimeofday and on Windows platforms |
| 885 * this call uses GetSystemTimeAsFileTime to get the current time. |
| 886 */ |
| 887 DART_EXPORT Dart_Handle Dart_TimelineAsyncEnd(const char* label, |
| 888 int64_t async_id); |
| 889 |
| 890 #endif // INCLUDE_DART_TOOLS_API_H_ |
OLD | NEW |