- Timestamp:
- Jan 21, 2018, 12:10:09 AM (6 years ago)
- Location:
- EcnlProtoTool/trunk/mruby-1.3.0
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/mruby-1.3.0/mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c
r321 r331 6 6 #include <ctype.h> 7 7 #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> 12 12 #include "mrdb.h" 13 13 #include "mrdberror.h" … … 71 71 uint32_t l; 72 72 73 if ((*ps == '0')||(strlen(ps) >= BPNO_LETTER_NUM)) {73 if ((*ps == '0')||(strlen(ps) >= BPNO_LETTER_NUM)) { 74 74 return 0; 75 75 } 76 76 77 while ( !(ISBLANK(*ps)||ISCNTRL(*ps))) {78 if (!ISDIGIT(*ps)) {77 while (!(ISBLANK(*ps)||ISCNTRL(*ps))) { 78 if (!ISDIGIT(*ps)) { 79 79 return 0; 80 80 } … … 91 91 int32_t ret = MRB_DEBUG_OK; 92 92 93 if (mrdb->wcnt == 1) {93 if (mrdb->wcnt == 1) { 94 94 ret = func(mrb, mrdb->dbg); 95 95 print_api_common_error(ret); … … 110 110 ps = mrdb->words[i]; 111 111 bpno = parse_breakpoint_no(ps); 112 if (bpno == 0) {112 if (bpno == 0) { 113 113 printf(BREAK_ERR_MSG_INVALIDBPNO, ps); 114 114 break; 115 115 } 116 116 ret = func(mrb, mrdb->dbg, (uint32_t)bpno); 117 if (ret == MRB_DEBUG_BREAK_INVALID_NO) {117 if (ret == MRB_DEBUG_BREAK_INVALID_NO) { 118 118 printf(BREAK_ERR_MSG_NOBPNO, bpno); 119 119 } 120 else if (ret != MRB_DEBUG_OK) {120 else if (ret != MRB_DEBUG_OK) { 121 121 print_api_common_error(ret); 122 122 } … … 129 129 char* ps = args; 130 130 131 if (ISBLANK(*ps)||ISCNTRL(*ps)) {131 if (ISBLANK(*ps)||ISCNTRL(*ps)) { 132 132 puts(BREAK_ERR_MSG_BLANK); 133 133 return MRB_DEBUG_BPTYPE_NONE; 134 134 } 135 135 136 if (!ISDIGIT(*ps)) {136 if (!ISDIGIT(*ps)) { 137 137 return MRB_DEBUG_BPTYPE_METHOD; 138 138 } 139 139 140 while ( !(ISBLANK(*ps)||ISCNTRL(*ps))) {141 if (!ISDIGIT(*ps)) {140 while (!(ISBLANK(*ps)||ISCNTRL(*ps))) { 141 if (!ISDIGIT(*ps)) { 142 142 printf(BREAK_ERR_MSG_INVALIDSTR, args); 143 143 return MRB_DEBUG_BPTYPE_NONE; … … 146 146 } 147 147 148 if ((*args == '0')||(strlen(args) >= LINENO_MAX_DIGIT)) {148 if ((*args == '0')||(strlen(args) >= LINENO_MAX_DIGIT)) { 149 149 puts(BREAK_ERR_MSG_RANGEOVER); 150 150 return MRB_DEBUG_BPTYPE_NONE; … … 159 159 const char* enable_letter[] = {BREAK_INFO_MSG_DISABLE, BREAK_INFO_MSG_ENABLE}; 160 160 161 if (bp->type == MRB_DEBUG_BPTYPE_LINE) {161 if (bp->type == MRB_DEBUG_BPTYPE_LINE) { 162 162 printf(BREAK_INFO_MSG_LINEBREAK, 163 163 bp->bpno, enable_letter[bp->enable], bp->point.linepoint.file, bp->point.linepoint.lineno); 164 164 } 165 165 else { 166 if (bp->point.methodpoint.class_name == NULL) {166 if (bp->point.methodpoint.class_name == NULL) { 167 167 printf(BREAK_INFO_MSG_METHODBREAK_NOCLASS, 168 168 bp->bpno, enable_letter[bp->enable], bp->point.methodpoint.method_name); … … 184 184 185 185 bpnum = mrb_debug_get_breaknum(mrb, mrdb->dbg); 186 if (bpnum < 0) {186 if (bpnum < 0) { 187 187 print_api_common_error(bpnum); 188 188 return; 189 189 } 190 else if (bpnum == 0) {190 else if (bpnum == 0) { 191 191 puts(BREAK_ERR_MSG_NOBPNO_INFOALL); 192 192 return; … … 195 195 196 196 ret = mrb_debug_get_break_all(mrb, mrdb->dbg, (uint32_t)bpnum, bp_list); 197 if (ret < 0) {197 if (ret < 0) { 198 198 print_api_common_error(ret); 199 199 return; … … 220 220 ps = mrdb->words[i]; 221 221 bpno = parse_breakpoint_no(ps); 222 if (bpno == 0) {222 if (bpno == 0) { 223 223 puts(BREAK_ERR_MSG_INVALIDBPNO_INFO); 224 224 break; … … 226 226 227 227 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) { 229 229 printf(BREAK_ERR_MSG_NOBPNO_INFO, bpno); 230 230 break; 231 231 } 232 else if (ret != MRB_DEBUG_OK) {232 else if (ret != MRB_DEBUG_OK) { 233 233 print_api_common_error(ret); 234 234 break; 235 235 } 236 else if (isFirst == TRUE) {236 else if (isFirst == TRUE) { 237 237 isFirst = FALSE; 238 238 puts(BREAK_INFO_MSG_HEADER); … … 251 251 uint32_t l; 252 252 253 if (mrdb->wcnt <= 1) {253 if (mrdb->wcnt <= 1) { 254 254 puts(BREAK_ERR_MSG_BLANK); 255 255 return MRB_DEBUG_BPTYPE_NONE; … … 257 257 258 258 args = mrdb->words[1]; 259 if ((body = strrchr(args, ':')) == NULL) {259 if ((body = strrchr(args, ':')) == NULL) { 260 260 body = args; 261 261 type = check_bptype(body); 262 } else { 263 if(body == args) { 262 } 263 else { 264 if (body == args) { 264 265 printf(BREAK_ERR_MSG_INVALIDSTR, args); 265 266 return MRB_DEBUG_BPTYPE_NONE; … … 272 273 case MRB_DEBUG_BPTYPE_LINE: 273 274 STRTOUL(l, body); 274 if ( l <= 65535) {275 if (l <= 65535) { 275 276 *line = l; 276 277 *file = (body == args)? mrb_debug_get_filename(dbg->irep, (uint32_t)(dbg->pc - dbg->irep->iseq)): args; 277 } else { 278 } 279 else { 278 280 puts(BREAK_ERR_MSG_RANGEOVER); 279 281 type = MRB_DEBUG_BPTYPE_NONE; … … 281 283 break; 282 284 case MRB_DEBUG_BPTYPE_METHOD: 283 if (body == args) {285 if (body == args) { 284 286 /* method only */ 285 if ( ISUPPER(*body)||ISLOWER(*body)||(*body == '_')) {287 if (ISUPPER(*body)||ISLOWER(*body)||(*body == '_')) { 286 288 *method = body; 287 289 *cname = NULL; 288 } else { 290 } 291 else { 289 292 printf(BREAK_ERR_MSG_INVALIDMETHOD, args); 290 293 type = MRB_DEBUG_BPTYPE_NONE; 291 294 } 292 } else { 293 if( ISUPPER(*args) ) { 295 } 296 else { 297 if (ISUPPER(*args)) { 294 298 switch(*body) { 295 299 case '@': case '$': case '?': case '.': case ',': case ':': … … 303 307 break; 304 308 } 305 } else { 309 } 310 else { 306 311 printf(BREAK_ERR_MSG_INVALIDCLASS, args); 307 312 type = MRB_DEBUG_BPTYPE_NONE; … … 344 349 if (type == MRB_DEBUG_BPTYPE_LINE) { 345 350 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)) { 347 353 printf(BREAK_SET_MSG_METHOD, ret, method); 348 } else { 354 } 355 else { 349 356 printf(BREAK_SET_MSG_CLASS_METHOD, ret, cname, method); 350 357 } 351 } else { 358 } 359 else { 352 360 switch (ret) { 353 361 case MRB_DEBUG_BREAK_INVALID_LINENO: … … 380 388 dbgcmd_info_break(mrb_state *mrb, mrdb_state *mrdb) 381 389 { 382 if (mrdb->wcnt == 2) {390 if (mrdb->wcnt == 2) { 383 391 info_break_all(mrb, mrdb); 384 392 } … … 396 404 397 405 ret = exe_set_command_all(mrb, mrdb, mrb_debug_delete_break_all); 398 if (ret != TRUE) {406 if (ret != TRUE) { 399 407 exe_set_command_select(mrb, mrdb, mrb_debug_delete_break); 400 408 } … … 409 417 410 418 ret = exe_set_command_all(mrb, mrdb, mrb_debug_enable_break_all); 411 if (ret != TRUE) {419 if (ret != TRUE) { 412 420 exe_set_command_select(mrb, mrdb, mrb_debug_enable_break); 413 421 } … … 422 430 423 431 ret = exe_set_command_all(mrb, mrdb, mrb_debug_disable_break_all); 424 if (ret != TRUE) {432 if (ret != TRUE) { 425 433 exe_set_command_select(mrb, mrdb, mrb_debug_disable_break); 426 434 }
Note:
See TracChangeset
for help on using the changeset viewer.