mbed I/F binding for mruby
Dependents: mruby_mbed_web mirb_mbed
mbed-mruby
How to use
Class
include/mruby/debug.h@0:158c61bb030f, 2015-03-25 (annotated)
- Committer:
- mzta
- Date:
- Wed Mar 25 17:36:16 2015 +0000
- Revision:
- 0:158c61bb030f
mirb_mbed initial commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mzta | 0:158c61bb030f | 1 | /* |
mzta | 0:158c61bb030f | 2 | ** mruby/debug.h - mruby debug info |
mzta | 0:158c61bb030f | 3 | ** |
mzta | 0:158c61bb030f | 4 | ** See Copyright Notice in mruby.h |
mzta | 0:158c61bb030f | 5 | */ |
mzta | 0:158c61bb030f | 6 | |
mzta | 0:158c61bb030f | 7 | #ifndef MRUBY_DEBUG_H |
mzta | 0:158c61bb030f | 8 | #define MRUBY_DEBUG_H |
mzta | 0:158c61bb030f | 9 | |
mzta | 0:158c61bb030f | 10 | #if defined(__cplusplus) |
mzta | 0:158c61bb030f | 11 | extern "C" { |
mzta | 0:158c61bb030f | 12 | #endif |
mzta | 0:158c61bb030f | 13 | |
mzta | 0:158c61bb030f | 14 | typedef enum mrb_debug_line_type { |
mzta | 0:158c61bb030f | 15 | mrb_debug_line_ary = 0, |
mzta | 0:158c61bb030f | 16 | mrb_debug_line_flat_map = 1 |
mzta | 0:158c61bb030f | 17 | } mrb_debug_line_type; |
mzta | 0:158c61bb030f | 18 | |
mzta | 0:158c61bb030f | 19 | typedef struct mrb_irep_debug_info_line { |
mzta | 0:158c61bb030f | 20 | uint32_t start_pos; |
mzta | 0:158c61bb030f | 21 | uint16_t line; |
mzta | 0:158c61bb030f | 22 | } mrb_irep_debug_info_line; |
mzta | 0:158c61bb030f | 23 | |
mzta | 0:158c61bb030f | 24 | typedef struct mrb_irep_debug_info_file { |
mzta | 0:158c61bb030f | 25 | uint32_t start_pos; |
mzta | 0:158c61bb030f | 26 | const char *filename; |
mzta | 0:158c61bb030f | 27 | mrb_sym filename_sym; |
mzta | 0:158c61bb030f | 28 | uint32_t line_entry_count; |
mzta | 0:158c61bb030f | 29 | mrb_debug_line_type line_type; |
mzta | 0:158c61bb030f | 30 | union { |
mzta | 0:158c61bb030f | 31 | void *ptr; |
mzta | 0:158c61bb030f | 32 | mrb_irep_debug_info_line *flat_map; |
mzta | 0:158c61bb030f | 33 | uint16_t *ary; |
mzta | 0:158c61bb030f | 34 | } lines; |
mzta | 0:158c61bb030f | 35 | } mrb_irep_debug_info_file; |
mzta | 0:158c61bb030f | 36 | |
mzta | 0:158c61bb030f | 37 | typedef struct mrb_irep_debug_info { |
mzta | 0:158c61bb030f | 38 | uint32_t pc_count; |
mzta | 0:158c61bb030f | 39 | uint16_t flen; |
mzta | 0:158c61bb030f | 40 | mrb_irep_debug_info_file **files; |
mzta | 0:158c61bb030f | 41 | } mrb_irep_debug_info; |
mzta | 0:158c61bb030f | 42 | |
mzta | 0:158c61bb030f | 43 | /* |
mzta | 0:158c61bb030f | 44 | * get line from irep's debug info and program counter |
mzta | 0:158c61bb030f | 45 | * @return returns NULL if not found |
mzta | 0:158c61bb030f | 46 | */ |
mzta | 0:158c61bb030f | 47 | MRB_API const char *mrb_debug_get_filename(mrb_irep *irep, uint32_t pc); |
mzta | 0:158c61bb030f | 48 | |
mzta | 0:158c61bb030f | 49 | /* |
mzta | 0:158c61bb030f | 50 | * get line from irep's debug info and program counter |
mzta | 0:158c61bb030f | 51 | * @return returns -1 if not found |
mzta | 0:158c61bb030f | 52 | */ |
mzta | 0:158c61bb030f | 53 | MRB_API int32_t mrb_debug_get_line(mrb_irep *irep, uint32_t pc); |
mzta | 0:158c61bb030f | 54 | |
mzta | 0:158c61bb030f | 55 | MRB_API mrb_irep_debug_info_file *mrb_debug_info_append_file( |
mzta | 0:158c61bb030f | 56 | mrb_state *mrb, mrb_irep *irep, |
mzta | 0:158c61bb030f | 57 | uint32_t start_pos, uint32_t end_pos); |
mzta | 0:158c61bb030f | 58 | MRB_API mrb_irep_debug_info *mrb_debug_info_alloc(mrb_state *mrb, mrb_irep *irep); |
mzta | 0:158c61bb030f | 59 | MRB_API void mrb_debug_info_free(mrb_state *mrb, mrb_irep_debug_info *d); |
mzta | 0:158c61bb030f | 60 | |
mzta | 0:158c61bb030f | 61 | #if defined(__cplusplus) |
mzta | 0:158c61bb030f | 62 | } /* extern "C" { */ |
mzta | 0:158c61bb030f | 63 | #endif |
mzta | 0:158c61bb030f | 64 | |
mzta | 0:158c61bb030f | 65 | #endif /* MRUBY_DEBUG_H */ |
mzta | 0:158c61bb030f | 66 |