Ignore:
Timestamp:
Jan 21, 2018, 12:10:09 AM (6 years ago)
Author:
coas-nagasima
Message:

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

Location:
EcnlProtoTool/trunk/mruby-1.3.0
Files:
12 edited
1 moved

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/mruby-1.3.0/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c

    r321 r331  
    55
    66#include <string.h>
    7 #include "mruby.h"
    8 #include "mruby/irep.h"
     7#include <mruby.h>
     8#include <mruby/irep.h>
    99#include "mrdb.h"
    10 #include "mruby/debug.h"
    11 #include "mruby/opcode.h"
    12 #include "mruby/class.h"
    13 #include "mruby/proc.h"
    14 #include "mruby/variable.h"
     10#include <mruby/debug.h>
     11#include <mruby/opcode.h>
     12#include <mruby/class.h>
     13#include <mruby/proc.h>
     14#include <mruby/variable.h>
    1515#include "mrdberror.h"
    1616#include "apibreak.h"
     
    2121
    2222static uint16_t
    23 check_lineno( mrb_irep_debug_info_file *info_file, uint16_t lineno )
     23check_lineno(mrb_irep_debug_info_file *info_file, uint16_t lineno)
    2424{
    2525  uint32_t count = info_file->line_entry_count;
    2626  uint16_t l_idx;
    2727
    28   if( info_file->line_type == mrb_debug_line_ary ) {
     28  if (info_file->line_type == mrb_debug_line_ary) {
    2929    for (l_idx = 0; l_idx < count; ++l_idx) {
    30       if(lineno == info_file->lines.ary[l_idx]) {
     30      if (lineno == info_file->lines.ary[l_idx]) {
    3131        return lineno;
    3232      }
    3333    }
    34   } else {
     34  }
     35  else {
    3536    for (l_idx = 0; l_idx < count; ++l_idx) {
    36       if(lineno == info_file->lines.flat_map[l_idx].line) {
     37      if (lineno == info_file->lines.flat_map[l_idx].line) {
    3738        return lineno;
    3839      }
     
    4445
    4546static int32_t
    46 get_break_index( mrb_debug_context *dbg, int32_t bpno )
     47get_break_index(mrb_debug_context *dbg, uint32_t bpno)
    4748{
    4849  uint32_t i;
     
    5152
    5253  for(i = 0 ; i < dbg->bpnum; i++) {
    53     if(dbg->bp[i].bpno == bpno) {
     54    if (dbg->bp[i].bpno == bpno) {
    5455      hit = TRUE;
    5556      index = i;
     
    5859  }
    5960
    60   if(hit == FALSE) {
     61  if (hit == FALSE) {
    6162    return MRB_DEBUG_BREAK_INVALID_NO;
    6263  }
     
    6667
    6768static void
    68 free_breakpoint( mrb_state *mrb, mrb_debug_breakpoint *bp )
     69free_breakpoint(mrb_state *mrb, mrb_debug_breakpoint *bp)
    6970{
    7071  switch(bp->type) {
     
    7475    case MRB_DEBUG_BPTYPE_METHOD:
    7576      mrb_free(mrb, (void*)bp->point.methodpoint.method_name);
    76       if(bp->point.methodpoint.class_name != NULL) {
     77      if (bp->point.methodpoint.class_name != NULL) {
    7778        mrb_free(mrb, (void*)bp->point.methodpoint.class_name);
    7879      }
     
    8485
    8586static uint16_t
    86 check_file_lineno( struct mrb_irep *irep, const char *file, uint16_t lineno )
     87check_file_lineno(struct mrb_irep *irep, const char *file, uint16_t lineno)
    8788{
    8889  mrb_irep_debug_info_file *info_file;
     
    9495  for (f_idx = 0; f_idx < irep->debug_info->flen; ++f_idx) {
    9596    info_file = irep->debug_info->files[f_idx];
    96     if(!strcmp(info_file->filename, file)) {
     97    if (!strcmp(info_file->filename, file)) {
    9798      result = MRB_DEBUG_BP_FILE_OK;
    9899
    99       fix_lineno = check_lineno( info_file, lineno );
    100       if(fix_lineno != 0) {
     100      fix_lineno = check_lineno(info_file, lineno);
     101      if (fix_lineno != 0) {
    101102        return result | MRB_DEBUG_BP_LINENO_OK;
    102103      }
    103104    }
    104     for ( i=0; i < irep->rlen; ++i ) {
     105    for (i=0; i < irep->rlen; ++i) {
    105106      result  |= check_file_lineno(irep->reps[i], file, lineno);
    106       if(result == (MRB_DEBUG_BP_FILE_OK | MRB_DEBUG_BP_LINENO_OK)) {
     107      if (result == (MRB_DEBUG_BP_FILE_OK | MRB_DEBUG_BP_LINENO_OK)) {
    107108        return result;
    108109      }
     
    113114
    114115static const char*
    115 get_class_name( mrb_state *mrb, struct RClass *class_obj )
     116get_class_name(mrb_state *mrb, struct RClass *class_obj)
    116117{
    117118  struct RClass *outer;
     
    124125
    125126static int32_t
    126 compare_break_method( mrb_state *mrb, mrb_debug_breakpoint *bp, struct RClass *class_obj, mrb_sym method_sym, mrb_bool* isCfunc )
     127compare_break_method(mrb_state *mrb, mrb_debug_breakpoint *bp, struct RClass *class_obj, mrb_sym method_sym, mrb_bool* isCfunc)
    127128{
    128129  const char* class_name;
     
    138139
    139140  method_p = &bp->point.methodpoint;
    140   if(strcmp(method_p->method_name, method_name) == 0) {
     141  if (strcmp(method_p->method_name, method_name) == 0) {
    141142    class_name = get_class_name(mrb, class_obj);
    142     if(class_name == NULL) {
    143       if(method_p->class_name == NULL) {
     143    if (class_name == NULL) {
     144      if (method_p->class_name == NULL) {
    144145        return bp->bpno;
    145146      }
    146147    }
    147     else if(method_p->class_name != NULL) {
     148    else if (method_p->class_name != NULL) {
    148149      m = mrb_method_search_vm(mrb, &class_obj, method_sym);
    149       if(m == NULL) {
     150      if (m == NULL) {
    150151        return MRB_DEBUG_OK;
    151152      }
    152       if(MRB_PROC_CFUNC_P(m)) {
     153      if (MRB_PROC_CFUNC_P(m)) {
    153154        *isCfunc = TRUE;
    154155      }
    155156
    156157      is_defined = mrb_class_defined(mrb, method_p->class_name);
    157       if(is_defined == FALSE) {
     158      if (is_defined == FALSE) {
    158159        return MRB_DEBUG_OK;
    159160      }
     
    162163      ssym = mrb_symbol(mrb_check_intern_cstr(mrb, method_p->method_name));
    163164      m = mrb_method_search_vm(mrb, &sc, ssym);
    164       if(m == NULL) {
     165      if (m == NULL) {
    165166        return MRB_DEBUG_OK;
    166167      }
     
    168169      class_name = get_class_name(mrb, class_obj);
    169170      sn = get_class_name(mrb, sc);
    170       if(strcmp(sn, class_name) == 0) {
     171      if (strcmp(sn, class_name) == 0) {
    171172        return bp->bpno;
    172173      }
     
    177178
    178179int32_t
    179 mrb_debug_set_break_line( mrb_state *mrb, mrb_debug_context *dbg, const char *file, uint16_t lineno)
     180mrb_debug_set_break_line(mrb_state *mrb, mrb_debug_context *dbg, const char *file, uint16_t lineno)
    180181{
    181182  int32_t index;
     
    183184  uint16_t result;
    184185
    185   if((mrb == NULL)||(dbg == NULL)||(file == NULL)) {
    186     return MRB_DEBUG_INVALID_ARGUMENT;
    187   }
    188 
    189   if(dbg->bpnum >= MAX_BREAKPOINT) {
     186  if ((mrb == NULL)||(dbg == NULL)||(file == NULL)) {
     187    return MRB_DEBUG_INVALID_ARGUMENT;
     188  }
     189
     190  if (dbg->bpnum >= MAX_BREAKPOINT) {
    190191    return MRB_DEBUG_BREAK_NUM_OVER;
    191192  }
    192193
    193   if(dbg->next_bpno > MAX_BREAKPOINTNO) {
     194  if (dbg->next_bpno > MAX_BREAKPOINTNO) {
    194195    return MRB_DEBUG_BREAK_NO_OVER;
    195196  }
    196197
    197198  /* file and lineno check (line type mrb_debug_line_ary only.) */
    198   result = check_file_lineno( dbg->root_irep, file, lineno );
    199   if(result == 0) {
     199  result = check_file_lineno(dbg->root_irep, file, lineno);
     200  if (result == 0) {
    200201    return MRB_DEBUG_BREAK_INVALID_FILE;
    201   }else if(result == MRB_DEBUG_BP_FILE_OK) {
     202  }
     203  else if (result == MRB_DEBUG_BP_FILE_OK) {
    202204    return MRB_DEBUG_BREAK_INVALID_LINENO;
    203   } 
     205  }
    204206
    205207  set_file = mrb_malloc(mrb, strlen(file) + 1);
     
    221223
    222224int32_t
    223 mrb_debug_set_break_method( mrb_state *mrb, mrb_debug_context *dbg, const char *class_name, const char *method_name )
     225mrb_debug_set_break_method(mrb_state *mrb, mrb_debug_context *dbg, const char *class_name, const char *method_name)
    224226{
    225227  int32_t index;
     
    227229  char* set_method;
    228230
    229   if((mrb == NULL) || (dbg == NULL) || (method_name == NULL)) {
    230     return MRB_DEBUG_INVALID_ARGUMENT;
    231   }
    232 
    233   if(dbg->bpnum >= MAX_BREAKPOINT) {
     231  if ((mrb == NULL) || (dbg == NULL) || (method_name == NULL)) {
     232    return MRB_DEBUG_INVALID_ARGUMENT;
     233  }
     234
     235  if (dbg->bpnum >= MAX_BREAKPOINT) {
    234236    return MRB_DEBUG_BREAK_NUM_OVER;
    235237  }
    236238
    237   if(dbg->next_bpno > MAX_BREAKPOINTNO) {
     239  if (dbg->next_bpno > MAX_BREAKPOINTNO) {
    238240    return MRB_DEBUG_BREAK_NO_OVER;
    239241  }
    240242
    241   if(class_name != NULL) {
     243  if (class_name != NULL) {
    242244    set_class = mrb_malloc(mrb, strlen(class_name) + 1);
    243245    strncpy(set_class, class_name, strlen(class_name) + 1);
     
    264266
    265267int32_t
    266 mrb_debug_get_breaknum( mrb_state *mrb, mrb_debug_context *dbg )
    267 {
    268   if((mrb == NULL) || (dbg == NULL)) {
     268mrb_debug_get_breaknum(mrb_state *mrb, mrb_debug_context *dbg)
     269{
     270  if ((mrb == NULL) || (dbg == NULL)) {
    269271    return MRB_DEBUG_INVALID_ARGUMENT;
    270272  }
     
    273275}
    274276
    275 int32_t 
    276 mrb_debug_get_break_all( mrb_state *mrb, mrb_debug_context *dbg, uint32_t size, mrb_debug_breakpoint *bp )
     277int32_t
     278mrb_debug_get_break_all(mrb_state *mrb, mrb_debug_context *dbg, uint32_t size, mrb_debug_breakpoint *bp)
    277279{
    278280  uint32_t get_size = 0;
    279281
    280   if((mrb == NULL) || (dbg == NULL) || (bp == NULL)) {
    281     return MRB_DEBUG_INVALID_ARGUMENT;
    282   }
    283 
    284   if(dbg->bpnum >= size) {
     282  if ((mrb == NULL) || (dbg == NULL) || (bp == NULL)) {
     283    return MRB_DEBUG_INVALID_ARGUMENT;
     284  }
     285
     286  if (dbg->bpnum >= size) {
    285287    get_size = size;
    286288  }
     
    295297
    296298int32_t
    297 mrb_debug_get_break( mrb_state *mrb, mrb_debug_context *dbg, uint32_t bpno, mrb_debug_breakpoint *bp )
    298 {
    299   uint32_t index;
    300 
    301   if((mrb == NULL) || (dbg == NULL) || (bp == NULL)) {
     299mrb_debug_get_break(mrb_state *mrb, mrb_debug_context *dbg, uint32_t bpno, mrb_debug_breakpoint *bp)
     300{
     301  int32_t index;
     302
     303  if ((mrb == NULL) || (dbg == NULL) || (bp == NULL)) {
    302304    return MRB_DEBUG_INVALID_ARGUMENT;
    303305  }
    304306
    305307  index = get_break_index(dbg, bpno);
    306   if(index == MRB_DEBUG_BREAK_INVALID_NO) {
     308  if (index == MRB_DEBUG_BREAK_INVALID_NO) {
    307309    return MRB_DEBUG_BREAK_INVALID_NO;
    308310  }
     
    316318}
    317319
    318 int32_t 
    319 mrb_debug_delete_break( mrb_state *mrb, mrb_debug_context *dbg, uint32_t bpno )
     320int32_t
     321mrb_debug_delete_break(mrb_state *mrb, mrb_debug_context *dbg, uint32_t bpno)
    320322{
    321323  uint32_t i;
    322324  int32_t index;
    323325
    324   if((mrb == NULL) ||(dbg == NULL)) {
     326  if ((mrb == NULL) ||(dbg == NULL)) {
    325327    return MRB_DEBUG_INVALID_ARGUMENT;
    326328  }
    327329
    328330  index = get_break_index(dbg, bpno);
    329   if(index == MRB_DEBUG_BREAK_INVALID_NO) {
     331  if (index == MRB_DEBUG_BREAK_INVALID_NO) {
    330332    return MRB_DEBUG_BREAK_INVALID_NO;
    331333  }
     
    334336
    335337  for(i = index ; i < dbg->bpnum; i++) {
    336     if((i + 1) == dbg->bpnum) {
     338    if ((i + 1) == dbg->bpnum) {
    337339      memset(&dbg->bp[i], 0, sizeof(mrb_debug_breakpoint));
    338340    }
     
    347349}
    348350
    349 int32_t 
    350 mrb_debug_delete_break_all( mrb_state *mrb, mrb_debug_context *dbg )
    351 {
    352   uint32_t i;
    353 
    354   if((mrb == NULL) || (dbg == NULL)) {
     351int32_t
     352mrb_debug_delete_break_all(mrb_state *mrb, mrb_debug_context *dbg)
     353{
     354  uint32_t i;
     355
     356  if ((mrb == NULL) || (dbg == NULL)) {
    355357    return MRB_DEBUG_INVALID_ARGUMENT;
    356358  }
     
    365367}
    366368
    367 int32_t 
    368 mrb_debug_enable_break( mrb_state *mrb, mrb_debug_context *dbg, uint32_t bpno )
     369int32_t
     370mrb_debug_enable_break(mrb_state *mrb, mrb_debug_context *dbg, uint32_t bpno)
    369371{
    370372  int32_t index = 0;
    371373
    372   if((mrb == NULL) || (dbg == NULL)) {
     374  if ((mrb == NULL) || (dbg == NULL)) {
    373375    return MRB_DEBUG_INVALID_ARGUMENT;
    374376  }
    375377
    376378  index = get_break_index(dbg, bpno);
    377   if(index == MRB_DEBUG_BREAK_INVALID_NO) {
     379  if (index == MRB_DEBUG_BREAK_INVALID_NO) {
    378380    return MRB_DEBUG_BREAK_INVALID_NO;
    379381  }
     
    385387
    386388int32_t
    387 mrb_debug_enable_break_all( mrb_state *mrb, mrb_debug_context *dbg )
    388 {
    389   uint32_t i;
    390 
    391   if((mrb == NULL) || (dbg == NULL)) {
     389mrb_debug_enable_break_all(mrb_state *mrb, mrb_debug_context *dbg)
     390{
     391  uint32_t i;
     392
     393  if ((mrb == NULL) || (dbg == NULL)) {
    392394    return MRB_DEBUG_INVALID_ARGUMENT;
    393395  }
     
    400402}
    401403
    402 int32_t 
    403 mrb_debug_disable_break( mrb_state *mrb, mrb_debug_context *dbg, uint32_t bpno )
     404int32_t
     405mrb_debug_disable_break(mrb_state *mrb, mrb_debug_context *dbg, uint32_t bpno)
    404406{
    405407  int32_t index = 0;
    406408
    407   if((mrb == NULL) || (dbg == NULL)) {
     409  if ((mrb == NULL) || (dbg == NULL)) {
    408410    return MRB_DEBUG_INVALID_ARGUMENT;
    409411  }
    410412
    411413  index = get_break_index(dbg, bpno);
    412   if(index == MRB_DEBUG_BREAK_INVALID_NO) {
     414  if (index == MRB_DEBUG_BREAK_INVALID_NO) {
    413415    return MRB_DEBUG_BREAK_INVALID_NO;
    414416  }
     
    419421}
    420422
    421 int32_t 
    422 mrb_debug_disable_break_all( mrb_state *mrb, mrb_debug_context *dbg )
    423 {
    424   uint32_t i;
    425 
    426   if((mrb == NULL) || (dbg == NULL)) {
     423int32_t
     424mrb_debug_disable_break_all(mrb_state *mrb, mrb_debug_context *dbg)
     425{
     426  uint32_t i;
     427
     428  if ((mrb == NULL) || (dbg == NULL)) {
    427429    return MRB_DEBUG_INVALID_ARGUMENT;
    428430  }
     
    436438
    437439static mrb_bool
    438 check_start_pc_for_line( mrb_irep *irep, mrb_code *pc, uint16_t line )
    439 {
    440   if( pc > irep->iseq ) {
    441     if( line == mrb_debug_get_line(irep, (uint32_t)(pc - irep->iseq - 1))) {
     440check_start_pc_for_line(mrb_irep *irep, mrb_code *pc, uint16_t line)
     441{
     442  if (pc > irep->iseq) {
     443    if (line == mrb_debug_get_line(irep, (uint32_t)(pc - irep->iseq - 1))) {
    442444      return FALSE;
    443445    }
     
    447449
    448450int32_t
    449 mrb_debug_check_breakpoint_line( mrb_state *mrb, mrb_debug_context *dbg, const char *file, uint16_t line )
     451mrb_debug_check_breakpoint_line(mrb_state *mrb, mrb_debug_context *dbg, const char *file, uint16_t line)
    450452{
    451453  mrb_debug_breakpoint *bp;
    452454  mrb_debug_linepoint *line_p;
    453   int i;
    454 
    455   if((mrb == NULL) || (dbg == NULL) || (file == NULL) || (line <= 0)) {
    456     return MRB_DEBUG_INVALID_ARGUMENT;
    457   }
    458 
    459   if(!check_start_pc_for_line(dbg->irep, dbg->pc, line)) {
     455  uint32_t i;
     456
     457  if ((mrb == NULL) || (dbg == NULL) || (file == NULL) || (line <= 0)) {
     458    return MRB_DEBUG_INVALID_ARGUMENT;
     459  }
     460
     461  if (!check_start_pc_for_line(dbg->irep, dbg->pc, line)) {
    460462    return MRB_DEBUG_OK;
    461463  }
     
    465467    switch (bp->type) {
    466468      case MRB_DEBUG_BPTYPE_LINE:
    467         if(bp->enable == TRUE) {
     469        if (bp->enable == TRUE) {
    468470          line_p = &bp->point.linepoint;
    469           if((strcmp(line_p->file, file) == 0) && (line_p->lineno == line)) {
     471          if ((strcmp(line_p->file, file) == 0) && (line_p->lineno == line)) {
    470472            return bp->bpno;
    471473          }
     
    484486
    485487
    486 int32_t 
    487 mrb_debug_check_breakpoint_method( mrb_state *mrb, mrb_debug_context *dbg, struct RClass *class_obj, mrb_sym method_sym, mrb_bool* isCfunc )
     488int32_t
     489mrb_debug_check_breakpoint_method(mrb_state *mrb, mrb_debug_context *dbg, struct RClass *class_obj, mrb_sym method_sym, mrb_bool* isCfunc)
    488490{
    489491  mrb_debug_breakpoint *bp;
    490492  int32_t bpno;
    491   int i;
    492 
    493   if((mrb == NULL) || (dbg == NULL) || (class_obj == NULL)) {
     493  uint32_t i;
     494
     495  if ((mrb == NULL) || (dbg == NULL) || (class_obj == NULL)) {
    494496    return MRB_DEBUG_INVALID_ARGUMENT;
    495497  }
     
    497499  bp = dbg->bp;
    498500  for(i=0; i<dbg->bpnum; i++) {
    499     if(bp->type == MRB_DEBUG_BPTYPE_METHOD) {
    500       if(bp->enable == TRUE) {
     501    if (bp->type == MRB_DEBUG_BPTYPE_METHOD) {
     502      if (bp->enable == TRUE) {
    501503        bpno = compare_break_method(mrb, bp, class_obj, method_sym, isCfunc);
    502         if(bpno > 0) {
     504        if (bpno > 0) {
    503505          return bpno;
    504506        }
    505507      }
    506508    }
    507     else if(bp->type == MRB_DEBUG_BPTYPE_NONE) {
     509    else if (bp->type == MRB_DEBUG_BPTYPE_NONE) {
    508510      break;
    509511    }
  • EcnlProtoTool/trunk/mruby-1.3.0/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.h

    r321 r331  
    77#define APIBREAK_H_
    88
    9 #include "mruby.h"
     9#include <mruby.h>
    1010#include "mrdb.h"
    1111
    12 int32_t mrb_debug_set_break_line( mrb_state *, mrb_debug_context *, const char *, uint16_t );
    13 int32_t mrb_debug_set_break_method( mrb_state *, mrb_debug_context *, const char *, const char * );
    14 int32_t mrb_debug_get_breaknum( mrb_state *, mrb_debug_context * );
    15 int32_t mrb_debug_get_break_all( mrb_state *, mrb_debug_context *, uint32_t, mrb_debug_breakpoint bp[]);
    16 int32_t mrb_debug_get_break( mrb_state *, mrb_debug_context *, uint32_t, mrb_debug_breakpoint * );
    17 int32_t mrb_debug_delete_break( mrb_state *, mrb_debug_context *, uint32_t );
    18 int32_t mrb_debug_delete_break_all( mrb_state *, mrb_debug_context * );
    19 int32_t mrb_debug_enable_break( mrb_state *, mrb_debug_context *, uint32_t );
    20 int32_t mrb_debug_enable_break_all( mrb_state *, mrb_debug_context * );
    21 int32_t mrb_debug_disable_break( mrb_state *, mrb_debug_context *, uint32_t );
    22 int32_t mrb_debug_disable_break_all( mrb_state *, mrb_debug_context * );
    23 int32_t mrb_debug_check_breakpoint_line( mrb_state *, mrb_debug_context *, const char *, uint16_t );
    24 int32_t mrb_debug_check_breakpoint_method( mrb_state *, mrb_debug_context *, struct RClass *, mrb_sym, mrb_bool* );
     12int32_t mrb_debug_set_break_line(mrb_state *, mrb_debug_context *, const char *, uint16_t);
     13int32_t mrb_debug_set_break_method(mrb_state *, mrb_debug_context *, const char *, const char *);
     14int32_t mrb_debug_get_breaknum(mrb_state *, mrb_debug_context *);
     15int32_t mrb_debug_get_break_all(mrb_state *, mrb_debug_context *, uint32_t, mrb_debug_breakpoint bp[]);
     16int32_t mrb_debug_get_break(mrb_state *, mrb_debug_context *, uint32_t, mrb_debug_breakpoint *);
     17int32_t mrb_debug_delete_break(mrb_state *, mrb_debug_context *, uint32_t);
     18int32_t mrb_debug_delete_break_all(mrb_state *, mrb_debug_context *);
     19int32_t mrb_debug_enable_break(mrb_state *, mrb_debug_context *, uint32_t);
     20int32_t mrb_debug_enable_break_all(mrb_state *, mrb_debug_context *);
     21int32_t mrb_debug_disable_break(mrb_state *, mrb_debug_context *, uint32_t);
     22int32_t mrb_debug_disable_break_all(mrb_state *, mrb_debug_context *);
     23int32_t mrb_debug_check_breakpoint_line(mrb_state *, mrb_debug_context *, const char *, uint16_t);
     24int32_t mrb_debug_check_breakpoint_method(mrb_state *, mrb_debug_context *, struct RClass *, mrb_sym, mrb_bool*);
    2525
    2626#endif /* APIBREAK_H_ */
  • EcnlProtoTool/trunk/mruby-1.3.0/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c

    r321 r331  
    1010#include "mrdberror.h"
    1111#include "apilist.h"
    12 #include "mruby/compile.h"
    13 #include "mruby/irep.h"
    14 #include "mruby/debug.h"
     12#include <mruby/compile.h>
     13#include <mruby/irep.h>
     14#include <mruby/debug.h>
    1515
    1616#define LINE_BUF_SIZE MAX_COMMAND_LINE
     
    7272
    7373  p = strrchr(path, '/');
    74   len = p != NULL ? p - path : strlen(path);
     74  len = p != NULL ? (size_t)(p - path) : strlen(path);
    7575
    7676  dir = mrb_malloc(mrb, len + 1);
  • EcnlProtoTool/trunk/mruby-1.3.0/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.h

    r321 r331  
    66#define APILIST_H_
    77
    8 #include "mruby.h"
     8#include <mruby.h>
    99#include "mrdb.h"
    1010
  • EcnlProtoTool/trunk/mruby-1.3.0/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c

    r321 r331  
    66#include <string.h>
    77#include "mrdb.h"
    8 #include "mruby/value.h"
    9 #include "mruby/class.h"
    10 #include "mruby/compile.h"
    11 #include "mruby/error.h"
    12 #include "mruby/numeric.h"
    13 #include "mruby/string.h"
     8#include <mruby/value.h>
     9#include <mruby/class.h>
     10#include <mruby/compile.h>
     11#include <mruby/error.h>
     12#include <mruby/numeric.h>
     13#include <mruby/string.h>
    1414#include "apiprint.h"
    1515
  • EcnlProtoTool/trunk/mruby-1.3.0/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.h

    r321 r331  
    66#define APIPRINT_H_
    77
    8 #include "mruby.h"
     8#include <mruby.h>
    99#include "mrdb.h"
    1010
  • EcnlProtoTool/trunk/mruby-1.3.0/mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c

    r321 r331  
    66#include <ctype.h>
    77#include <string.h>
    8 #include "mruby.h"
    9 #include "mruby/dump.h"
    10 #include "mruby/debug.h"
    11 #include "mruby/string.h"
     8#include <mruby.h>
     9#include <mruby/dump.h>
     10#include <mruby/debug.h>
     11#include <mruby/string.h>
    1212#include "mrdb.h"
    1313#include "mrdberror.h"
     
    7171  uint32_t l;
    7272
    73   if((*ps == '0')||(strlen(ps) >= BPNO_LETTER_NUM)) {
     73  if ((*ps == '0')||(strlen(ps) >= BPNO_LETTER_NUM)) {
    7474    return 0;
    7575  }
    7676
    77   while( !(ISBLANK(*ps)||ISCNTRL(*ps)) ) {
    78     if(!ISDIGIT(*ps)) {
     77  while (!(ISBLANK(*ps)||ISCNTRL(*ps))) {
     78    if (!ISDIGIT(*ps)) {
    7979      return 0;
    8080    }
     
    9191  int32_t ret = MRB_DEBUG_OK;
    9292
    93   if(mrdb->wcnt == 1) {
     93  if (mrdb->wcnt == 1) {
    9494    ret = func(mrb, mrdb->dbg);
    9595    print_api_common_error(ret);
     
    110110    ps = mrdb->words[i];
    111111    bpno = parse_breakpoint_no(ps);
    112     if(bpno == 0) {
     112    if (bpno == 0) {
    113113      printf(BREAK_ERR_MSG_INVALIDBPNO, ps);
    114114      break;
    115115    }
    116116    ret = func(mrb, mrdb->dbg, (uint32_t)bpno);
    117     if(ret == MRB_DEBUG_BREAK_INVALID_NO) {
     117    if (ret == MRB_DEBUG_BREAK_INVALID_NO) {
    118118      printf(BREAK_ERR_MSG_NOBPNO, bpno);
    119119    }
    120     else if(ret != MRB_DEBUG_OK) {
     120    else if (ret != MRB_DEBUG_OK) {
    121121      print_api_common_error(ret);
    122122    }
     
    129129  char* ps = args;
    130130
    131   if(ISBLANK(*ps)||ISCNTRL(*ps)) {
     131  if (ISBLANK(*ps)||ISCNTRL(*ps)) {
    132132    puts(BREAK_ERR_MSG_BLANK);
    133133    return MRB_DEBUG_BPTYPE_NONE;
    134134  }
    135135
    136   if(!ISDIGIT(*ps)) {
     136  if (!ISDIGIT(*ps)) {
    137137    return MRB_DEBUG_BPTYPE_METHOD;
    138138  }
    139139
    140   while( !(ISBLANK(*ps)||ISCNTRL(*ps)) ) {
    141     if(!ISDIGIT(*ps)) {
     140  while (!(ISBLANK(*ps)||ISCNTRL(*ps))) {
     141    if (!ISDIGIT(*ps)) {
    142142      printf(BREAK_ERR_MSG_INVALIDSTR, args);
    143143      return MRB_DEBUG_BPTYPE_NONE;
     
    146146  }
    147147
    148   if((*args == '0')||(strlen(args) >= LINENO_MAX_DIGIT)) {
     148  if ((*args == '0')||(strlen(args) >= LINENO_MAX_DIGIT)) {
    149149    puts(BREAK_ERR_MSG_RANGEOVER);
    150150    return MRB_DEBUG_BPTYPE_NONE;
     
    159159  const char* enable_letter[] = {BREAK_INFO_MSG_DISABLE, BREAK_INFO_MSG_ENABLE};
    160160
    161   if(bp->type == MRB_DEBUG_BPTYPE_LINE) {
     161  if (bp->type == MRB_DEBUG_BPTYPE_LINE) {
    162162    printf(BREAK_INFO_MSG_LINEBREAK,
    163163      bp->bpno, enable_letter[bp->enable], bp->point.linepoint.file, bp->point.linepoint.lineno);
    164164  }
    165165  else {
    166     if(bp->point.methodpoint.class_name == NULL) {
     166    if (bp->point.methodpoint.class_name == NULL) {
    167167      printf(BREAK_INFO_MSG_METHODBREAK_NOCLASS,
    168168        bp->bpno, enable_letter[bp->enable], bp->point.methodpoint.method_name);
     
    184184
    185185  bpnum = mrb_debug_get_breaknum(mrb, mrdb->dbg);
    186   if(bpnum < 0) {
     186  if (bpnum < 0) {
    187187    print_api_common_error(bpnum);
    188188    return;
    189189  }
    190   else if(bpnum == 0) {
     190  else if (bpnum == 0) {
    191191    puts(BREAK_ERR_MSG_NOBPNO_INFOALL);
    192192    return;
     
    195195
    196196  ret = mrb_debug_get_break_all(mrb, mrdb->dbg, (uint32_t)bpnum, bp_list);
    197   if(ret < 0) {
     197  if (ret < 0) {
    198198    print_api_common_error(ret);
    199199    return;
     
    220220    ps = mrdb->words[i];
    221221    bpno = parse_breakpoint_no(ps);
    222     if(bpno == 0) {
     222    if (bpno == 0) {
    223223      puts(BREAK_ERR_MSG_INVALIDBPNO_INFO);
    224224      break;
     
    226226
    227227    ret = mrb_debug_get_break(mrb, mrdb->dbg, bpno, &bp);
    228     if(ret == MRB_DEBUG_BREAK_INVALID_NO) {
     228    if (ret == MRB_DEBUG_BREAK_INVALID_NO) {
    229229      printf(BREAK_ERR_MSG_NOBPNO_INFO, bpno);
    230230      break;
    231231    }
    232     else if(ret != MRB_DEBUG_OK) {
     232    else if (ret != MRB_DEBUG_OK) {
    233233      print_api_common_error(ret);
    234234      break;
    235235    }
    236     else if(isFirst == TRUE) {
     236    else if (isFirst == TRUE) {
    237237      isFirst = FALSE;
    238238      puts(BREAK_INFO_MSG_HEADER);
     
    251251  uint32_t l;
    252252
    253   if(mrdb->wcnt <= 1) {
     253  if (mrdb->wcnt <= 1) {
    254254    puts(BREAK_ERR_MSG_BLANK);
    255255    return MRB_DEBUG_BPTYPE_NONE;
     
    257257
    258258  args = mrdb->words[1];
    259   if((body = strrchr(args, ':')) == NULL) {
     259  if ((body = strrchr(args, ':')) == NULL) {
    260260    body = args;
    261261    type = check_bptype(body);
    262   } else {
    263     if(body == args) {
     262  }
     263  else {
     264    if (body == args) {
    264265      printf(BREAK_ERR_MSG_INVALIDSTR, args);
    265266      return MRB_DEBUG_BPTYPE_NONE;
     
    272273    case MRB_DEBUG_BPTYPE_LINE:
    273274      STRTOUL(l, body);
    274       if( l <= 65535 ) {
     275      if (l <= 65535) {
    275276        *line = l;
    276277        *file = (body == args)? mrb_debug_get_filename(dbg->irep, (uint32_t)(dbg->pc - dbg->irep->iseq)): args;
    277       } else {
     278      }
     279      else {
    278280        puts(BREAK_ERR_MSG_RANGEOVER);
    279281        type = MRB_DEBUG_BPTYPE_NONE;
     
    281283      break;
    282284    case MRB_DEBUG_BPTYPE_METHOD:
    283       if(body == args) {
     285      if (body == args) {
    284286        /* method only */
    285         if( ISUPPER(*body)||ISLOWER(*body)||(*body == '_') ) {
     287        if (ISUPPER(*body)||ISLOWER(*body)||(*body == '_')) {
    286288          *method = body;
    287289          *cname = NULL;
    288         } else {
     290        }
     291        else {
    289292          printf(BREAK_ERR_MSG_INVALIDMETHOD, args);
    290293          type = MRB_DEBUG_BPTYPE_NONE;
    291294        }
    292       } else {
    293         if( ISUPPER(*args) ) {
     295      }
     296      else {
     297        if (ISUPPER(*args)) {
    294298          switch(*body) {
    295299            case '@': case '$': case '?': case '.': case ',': case ':':
     
    303307            break;
    304308          }
    305         } else {
     309        }
     310        else {
    306311          printf(BREAK_ERR_MSG_INVALIDCLASS, args);
    307312          type = MRB_DEBUG_BPTYPE_NONE;
     
    344349    if (type == MRB_DEBUG_BPTYPE_LINE) {
    345350      printf(BREAK_SET_MSG_LINE, ret, file, line);
    346     } else if ((type == MRB_DEBUG_BPTYPE_METHOD)&&(cname == NULL)) {
     351    }
     352    else if ((type == MRB_DEBUG_BPTYPE_METHOD)&&(cname == NULL)) {
    347353      printf(BREAK_SET_MSG_METHOD, ret, method);
    348     } else {
     354    }
     355    else {
    349356      printf(BREAK_SET_MSG_CLASS_METHOD, ret, cname, method);
    350357    }
    351   } else {
     358  }
     359  else {
    352360    switch (ret) {
    353361      case MRB_DEBUG_BREAK_INVALID_LINENO:
     
    380388dbgcmd_info_break(mrb_state *mrb, mrdb_state *mrdb)
    381389{
    382   if(mrdb->wcnt == 2) {
     390  if (mrdb->wcnt == 2) {
    383391    info_break_all(mrb, mrdb);
    384392  }
     
    396404
    397405  ret = exe_set_command_all(mrb, mrdb, mrb_debug_delete_break_all);
    398   if(ret != TRUE) {
     406  if (ret != TRUE) {
    399407    exe_set_command_select(mrb, mrdb, mrb_debug_delete_break);
    400408  }
     
    409417
    410418  ret = exe_set_command_all(mrb, mrdb, mrb_debug_enable_break_all);
    411   if(ret != TRUE) {
     419  if (ret != TRUE) {
    412420    exe_set_command_select(mrb, mrdb, mrb_debug_enable_break);
    413421  }
     
    422430
    423431  ret = exe_set_command_all(mrb, mrdb, mrb_debug_disable_break_all);
    424   if(ret != TRUE) {
     432  if (ret != TRUE) {
    425433    exe_set_command_select(mrb, mrdb, mrb_debug_disable_break);
    426434  }
  • EcnlProtoTool/trunk/mruby-1.3.0/mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c

    r321 r331  
    99
    1010#include "apilist.h"
    11 #include "mruby/compile.h"
     11#include <mruby/compile.h>
    1212
    1313typedef struct help_msg {
     
    334334    return FALSE;
    335335  }
    336   if((lbracket = strchr(pattern, '[')) == NULL) {
     336  if ((lbracket = strchr(pattern, '[')) == NULL) {
    337337    return !strcmp(pattern, cmd);
    338338  }
  • EcnlProtoTool/trunk/mruby-1.3.0/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c

    r321 r331  
    66#include <string.h>
    77#include "mrdb.h"
    8 #include "mruby/value.h"
    9 #include "mruby/class.h"
    10 #include "mruby/compile.h"
    11 #include "mruby/error.h"
    12 #include "mruby/numeric.h"
    13 #include "mruby/string.h"
     8#include <mruby/value.h>
     9#include <mruby/class.h>
     10#include <mruby/compile.h>
     11#include <mruby/error.h>
     12#include <mruby/numeric.h>
     13#include <mruby/string.h>
    1414#include "apiprint.h"
    1515
  • EcnlProtoTool/trunk/mruby-1.3.0/mrbgems/mruby-bin-debugger/tools/mrdb/cmdrun.c

    r321 r331  
    44*/
    55
    6 #include "mruby/opcode.h"
     6#include <mruby/opcode.h>
    77#include "mrdb.h"
    88
     
    1212  mrb_debug_context *dbg = mrdb->dbg;
    1313
    14   if( dbg->xm == DBG_INIT ){
     14  if (dbg->xm == DBG_INIT){
    1515    dbg->xm = DBG_RUN;
    16   } else {
     16  }
     17  else {
    1718    dbg->xm = DBG_QUIT;
    18     if( dbg->xphase == DBG_PHASE_RUNNING ){
     19    if (dbg->xphase == DBG_PHASE_RUNNING){
    1920      struct RClass *exc;
    2021      puts("Start it from the beginning.");
     
    2324    }
    2425  }
    25  
     26
    2627  return DBGST_RESTART;
    2728}
     
    3334  int ccnt = 1;
    3435
    35   if( mrdb->wcnt > 1 ){
     36  if (mrdb->wcnt > 1){
    3637    sscanf(mrdb->words[1], "%d", &ccnt);
    3738  }
    3839  dbg->ccnt = (uint16_t)(ccnt > 0 ? ccnt : 1);  /* count of continue */
    3940
    40   if( dbg->xphase == DBG_PHASE_AFTER_RUN ){
     41  if (dbg->xphase == DBG_PHASE_AFTER_RUN){
    4142    puts("The program is not running.");
    4243    dbg->xm = DBG_QUIT;
    43   } else {
     44  }
     45  else {
    4446    dbg->xm = DBG_RUN;
    4547  }
     
    5355  return DBGST_CONTINUE;
    5456}
     57
     58dbgcmd_state
     59dbgcmd_next(mrb_state *mrb, mrdb_state *mrdb)
     60{
     61  mrdb->dbg->xm = DBG_NEXT;
     62  mrdb->dbg->prvci = mrb->c->ci;
     63  return DBGST_CONTINUE;
     64}
  • EcnlProtoTool/trunk/mruby-1.3.0/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c

    r321 r331  
    99#include <ctype.h>
    1010
    11 #include "mruby.h"
    12 #include "mruby/dump.h"
    13 #include "mruby/debug.h"
    14 #include "mruby/class.h"
    15 #include "mruby/opcode.h"
    16 #include "mruby/variable.h"
     11#include <mruby.h>
     12#include <mruby/dump.h>
     13#include <mruby/debug.h>
     14#include <mruby/class.h>
     15#include <mruby/opcode.h>
     16#include <mruby/variable.h>
    1717
    1818#include "mrdb.h"
     
    5858  {"run",       NULL,           1, 0, 0, DBGCMD_RUN,            dbgcmd_run},             /* r[un] */
    5959  {"step",      NULL,           1, 0, 1, DBGCMD_STEP,           dbgcmd_step},            /* s[tep] */
     60  {"next",      NULL,           1, 0, 1, DBGCMD_NEXT,           dbgcmd_next},            /* n[ext] */
    6061  {NULL}
    6162};
     
    406407
    407408  ret = mrb_debug_get_break(mrb, mrdb->dbg, mrdb->dbg->stopped_bpno, &bp);
    408   if(ret == 0) {
     409  if (ret == 0) {
    409410    switch(bp.type) {
    410411      case MRB_DEBUG_BPTYPE_LINE:
     
    416417        method_name = bp.point.methodpoint.method_name;
    417418        class_name = bp.point.methodpoint.class_name;
    418         if(class_name == NULL) {
     419        if (class_name == NULL) {
    419420          printf("Breakpoint %d, %s\n", bp.bpno, method_name);
    420421        }
     
    422423          printf("Breakpoint %d, %s:%s\n", bp.bpno, class_name, method_name);
    423424        }
    424         if(mrdb->dbg->isCfunc) {
     425        if (mrdb->dbg->isCfunc) {
    425426          printf("Stopped before calling the C function.\n");
    426427        }
     
    445446  char* file = mrb_debug_get_source(mrb, mrdb, mrdb->srcpath, mrdb->dbg->prvfile);
    446447  uint16_t lineno = mrdb->dbg->prvline;
    447   if(file != NULL) {
     448  if (file != NULL) {
    448449    mrb_debug_list(mrb, mrdb->dbg, file, lineno, lineno);
    449450    mrb_free(mrb, file);
     
    531532      break;
    532533  }
    533   if(sym != 0) {
     534  if (sym != 0) {
    534535    dbg->method_bpno = mrb_debug_check_breakpoint_method(mrb, dbg, c, sym, &isCfunc);
    535     if(isCfunc) {
     536    if (isCfunc) {
    536537      bpno = dbg->method_bpno;
    537538      dbg->method_bpno = 0;
     
    557558  dbg->regs = regs;
    558559
    559   if(dbg->xphase == DBG_PHASE_RESTART) {
     560  if (dbg->xphase == DBG_PHASE_RESTART) {
    560561    dbg->root_irep = irep;
    561562    dbg->prvfile = NULL;
    562563    dbg->prvline = 0;
     564    dbg->prvci = NULL;
    563565    dbg->xm = DBG_RUN;
    564566    dbg->xphase = DBG_PHASE_RUNNING;
     
    570572  switch (dbg->xm) {
    571573  case DBG_STEP:
    572   case DBG_NEXT:  // temporary
    573574    if (!file || (dbg->prvfile == file && dbg->prvline == line)) {
    574575      return;
     
    576577    dbg->method_bpno = 0;
    577578    dbg->bm = BRK_STEP;
     579    break;
     580
     581  case DBG_NEXT:
     582    if (!file || (dbg->prvfile == file && dbg->prvline == line)) {
     583      return;
     584    }
     585    if ((intptr_t)(dbg->prvci) < (intptr_t)(mrb->c->ci)) {
     586      return;
     587    }
     588    dbg->prvci = NULL;
     589    dbg->method_bpno = 0;
     590    dbg->bm = BRK_NEXT;
    578591    break;
    579592
     
    611624  dbg->prvline = line;
    612625
    613   if(dbg->bm == BRK_BREAK && --dbg->ccnt > 0) {
     626  if (dbg->bm == BRK_BREAK && --dbg->ccnt > 0) {
    614627    return;
    615628  }
     
    634647    st = cmd->func(mrb, mrdb);
    635648
    636     if( (st == DBGST_CONTINUE) || (st == DBGST_RESTART) ) break;
     649    if ((st == DBGST_CONTINUE) || (st == DBGST_RESTART)) break;
    637650  }
    638651  return dbg->xm;
     
    671684  mrdb->srcpath = args.srcpath;
    672685
    673   if(mrdb->dbg->xm == DBG_QUIT) {
     686  if (mrdb->dbg->xm == DBG_QUIT) {
    674687    mrdb->dbg->xphase = DBG_PHASE_RESTART;
    675688  }
     
    679692  mrdb->dbg->xm = DBG_INIT;
    680693  mrdb->dbg->ccnt = 1;
    681  
     694
    682695  /* setup hook functions */
    683696  mrb->code_fetch_hook = mrb_code_fetch_hook;
     
    726739    }
    727740  }
    728  
     741
    729742  mrdb->dbg->prvfile = "-";
    730743  mrdb->dbg->prvline = 0;
    731  
     744
    732745  while (1) {
    733746    cmd = get_and_parse_command(mrb, mrdb);
    734747    mrb_assert(cmd);
    735    
     748
    736749    if (cmd->id == DBGCMD_QUIT) {
    737750      break;
    738751    }
    739    
    740     if( cmd->func(mrb, mrdb) == DBGST_RESTART ) goto l_restart;
    741   }
    742  
     752
     753    if ( cmd->func(mrb, mrdb) == DBGST_RESTART ) goto l_restart;
     754  }
     755
    743756  cleanup(mrb, &args);
    744757
  • EcnlProtoTool/trunk/mruby-1.3.0/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h

    r321 r331  
    77#define MRDB_H
    88
    9 #include "mruby.h"
     9#include <mruby.h>
    1010
    1111#include "mrdbconf.h"
     
    110110  const char *prvfile;
    111111  int32_t prvline;
     112  mrb_callinfo *prvci;
    112113
    113114  mrdb_exemode xm;
     
    147148dbgcmd_state dbgcmd_continue(mrb_state*, mrdb_state*);
    148149dbgcmd_state dbgcmd_step(mrb_state*, mrdb_state*);
     150dbgcmd_state dbgcmd_next(mrb_state*, mrdb_state*);
    149151/* cmdbreak.c */
    150152dbgcmd_state dbgcmd_break(mrb_state*, mrdb_state*);
Note: See TracChangeset for help on using the changeset viewer.