63 Commits

Author SHA1 Message Date
dearblue 67606170e3 Add configuration guard for MRB_DISABLE_STDIO
ref #4576 and ref #4947

* Need MRBAPI functions without `MRB_DISABLE_STDIO`:
  * mrbgems/mruby-bin-debugger
  * mrbgems/mruby-bin-mirb
  * mrbgems/mruby-bin-mrbc
  * mrbgems/mruby-bin-mruby
  * mrbgems/mruby-bin-strip
* Need `stdio.h`:
  * mrbgems/mruby-io
  * mrbgems/mruby-print
* Need `snprintf()` in `stdio.h`:
  * mrbgems/mruby-pack
  * mrbgems/mruby-sprintf
2020-03-08 21:57:17 +09:00
dearblue cc1db2d117 Remove unnecessary 'stdio.h'; ref #4947
'stdio.h' is included in 'mruby.h' ('mrbconf.h').

However, keep 'stdio.h' used by mruby-test.
2020-03-08 21:42:09 +09:00
dearblue b3d4ab0cd8 Improve conflict error message of mruby-bin-debugger; ref 87d1b2a91 2020-03-08 20:49:22 +09:00
KOBAYASHI Shuji f92867a59e Refine the assertion failure message in mrdb print tests
#### Before this patch:

  ```console
  Fail: mruby-bin-debugger(print) error (mrbgems: mruby-bin-debugger)
   - Assertion[2]
      Expected true to be false.
  ```

#### After this patch:

  ```console
  Fail: mruby-bin-debugger(print) error (mrbgems: mruby-bin-debugger)
   - Assertion[2]
      Expected "$2 = undefined method 'bar' (NoMethodError)\n" to be start_with? "$2 = (eval):2: undefined method".
  ```
2019-12-24 23:20:20 +09:00
KOBAYASHI Shuji f0b8c9ec06 Fix mruby-bin-debugger tests; ref d2f2f9db 2019-12-18 19:34:11 +09:00
KOBAYASHI Shuji 7f6e8e8ddc Fix that print command raises FrozenError in mrdb; ref 1f5a7f2f
#### Before this patch:

  ```
  $ echo 'p true' | bin/mrdb /dev/null
  (/dev/null:1) mruby application exited.
  FrozenError: can't modify frozen String
  (-:0)
  ```

#### After this patch:

  ```
  $ echo 'p true' | bin/mrdb /dev/null
  (/dev/null:1) $1 = true
  (/dev/null:1)
  ```
2019-10-09 20:00:17 +09:00
Yukihiro "Matz" Matsumoto a365f9a67d Rename symbol-to-string functions; close #4684
* mrb_sym2name -> mrb_sym_name
* mrb_sym2name_len -> mrb_sym_name_len
* mrb_sym2str -> mrb_sym_str
2019-09-25 23:52:00 +09:00
dearblue 279c21b816 Prohibit changes to iseq in principle 2019-08-18 15:00:32 +09:00
dearblue c96b517ea2 Error needed/conflicts configuration
The purpose is to clarify the error if there is a needed/conflicts
configuration at compile time.
2019-07-14 00:29:17 +09:00
Yukihiro "Matz" Matsumoto 2871d0cdc5 Avoid keeping pointers from mrb_sym2name_len(); fix #4342
The addresses for packed inline symbols reference `mrb->symbuf` that
could be overridden by the later call of `mrb_sym2name_len`. Since
file names in call stack information are kept as symbols, keeping the
address in the C structures could cause problems like #4342.

This changes small incompatible changes in function prototypes:
* `mrb_parser_get_filename`: return value changed to `mrb_sym`.
* `mrb_debug_get_filename`: add `mrb_state*` as a first argument.
* `mrb_debug_get_line`: ditto.

I believe above functions are almost internal, and no third-party
mrbgem use them.
2019-04-01 14:13:06 +09:00
kimu_shu 477ffc7473 Add "info locals" command to mrdb 2019-02-19 18:10:05 +09:00
KOBAYASHI Shuji c86861bddf Use mrb->eException_class instead of mrb_class_get() 2019-02-03 22:00:55 +09:00
Kazuhiro Sera 2b2ff844a1 Fix misspelling words in comments 2018-08-25 09:19:17 +09:00
Yukihiro "Matz" Matsumoto beb6e5c299 Bytecode support for mrdb. 2018-07-31 17:28:42 +09:00
Yukihiro "Matz" Matsumoto 891839b976 New bytecode implementation of mruby VM. 2018-07-30 22:57:54 +09:00
mimaki e57d9e6047 Fixed test case for mruby ddebugger. 2018-04-04 14:07:59 +09:00
mimaki c1b9ec0c30 Fixed illegal memory operation on mruby debugger. 2018-04-04 13:20:40 +09:00
Yukihiro "Matz" Matsumoto aa8786f79c Do not initialize a local variable soon to be assigned. 2017-12-23 11:14:12 +09:00
Lothar Scholz 06f90a3b45 Make source compilable with C++17
Changes applied:

- Removing "register" keyword
- Fixing const pointer to pointer assignments
- Adding type casts to rb_malloc calls
2017-12-23 01:10:43 +01:00
Yukihiro "Matz" Matsumoto 8f2c62407c Add MRB_METHOD_TABLE_INLINE option.
Now the method tables (in classes/modules and caches) keeps C function
pointers without wrapping in `struct RProc` objects. For the sake of
portability, `mrb_method_t` is represented by the struct and union, but
if the most significant bit of the pointer is not used by the platform,
`mrb_method_t` should be packed in `uintptr_t` to reduce memory usage.

`MRB_METHOD_TABLE_INLINE` is turned on by default for linux.
2017-11-20 18:33:41 +09:00
Yukihiro "Matz" Matsumoto 8bf492f127 Reduce integer type mismatch warnings in VC. 2017-08-12 09:35:35 +09:00
Hiroshi Mimaki 7bdc709da0 Fixed a invalid source path name on mruby debugger. 2017-08-04 17:25:03 +09:00
Yukihiro "Matz" Matsumoto da24af34b9 Better class name management.
The change removes several internal instance variables used by
class name management. The variables `__classid__` and `__classpath__`
are no longer available. `__outer__` is used only for unnamed outer
classes/modules (and will be removed after they are named).

[Important note]
Along with this change we removed several public functions.

 - mrb_class_outer_module()
 - mrb_class_sym()

We believe no one have used those functions, but if you do, please
ask us for the workaround.
2017-08-01 22:25:49 +09:00
Yukihiro "Matz" Matsumoto 466a18b0d3 Remove redundant use of Object#to_s in interpolation. 2017-06-28 23:28:24 +09:00
Yukihiro "Matz" Matsumoto 77331d127b Unify else clause style 2017-04-03 16:56:27 +09:00
Yukihiro "Matz" Matsumoto fbf4089d2f Remove spaces around parens 2017-04-03 16:49:18 +09:00
Yukihiro "Matz" Matsumoto d0ecf862d9 Fixed mixture of signed/unsigned integers
in mrbgems/mruby-bin-debugger.
2017-02-08 23:27:17 +09:00
Nobuyoshi Nakada 6511bfd79a Removed trailing spaces 2016-09-28 12:29:41 +09:00
Guo Xiao 339005e1d5 intptr_t should be used instead of uint32_t to hold a pointer.
Fix warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
2016-07-31 12:53:39 +08:00
Yukihiro "Matz" Matsumoto 76d44b1b48 remove execute bit from mrbgems/mruby-bin-debugger files 2015-12-26 00:07:16 +09:00
Yuhei Okazaki 887a56ba80 fix bug that doesn't stop program when execute next command. 2015-12-23 22:16:36 +09:00
Yuhei Okazaki a08439a7c0 fixed next command's comment. 2015-12-23 22:16:36 +09:00
Yuhei Okazaki e1cc814ec4 add next command to mrdb. 2015-12-23 22:16:36 +09:00
Yasuhiro Matsumoto 7cc33af2dc fix build on VS2012 2015-12-22 17:46:20 +09:00
Yukihiro "Matz" Matsumoto 5c405dea3d include changed from by quotes ("") to by brackets (<>); close #3032 2015-11-27 17:48:23 +09:00
Zachary Scott c0ff5b475f Typo in mruby-bin-debugger/mrbgem.rake 2015-09-01 23:43:36 -04:00
Blaž Hrastnik a4f63caa79 Fix incorrect memory allocation of mrdb_state_new.
As detected in a Coverity scan. https://scan8.coverity.com/reports.htm#v26153/p11375/fileInstanceId=6844472&defectInstanceId=2516000&mergedDefectId=75866
2015-07-02 20:47:22 +02:00
Anton Davydov dcc316d3b8 Fix typos in documentation and error messages [skip ci] 2015-06-19 15:52:23 +03:00
Kouhei Sutou 09419874c8 Suppress warnings generated by -Wwrite-strings
Here are suppressed warnings:

    src/fmt_fp.c: In function 'fmt_fp':
    src/fmt_fp.c:124:16: warning: initialization discards 'const' qualifier from pointer target type
         char *ss = (t&32)?"inf":"INF";
                    ^
    src/fmt_fp.c:125:17: warning: assignment discards 'const' qualifier from pointer target type
         if (y!=y) ss=(t&32)?"nan":"NAN";
                     ^
    mrbgems/mruby-string-ext/src/string.c: In function 'mrb_str_succ_bang':
    mrbgems/mruby-string-ext/src/string.c:302:27: warning: assignment discards 'const' qualifier from pointer target type
           if (e == b) prepend = "1";
                               ^
    mrbgems/mruby-string-ext/src/string.c:305:27: warning: assignment discards 'const' qualifier from pointer target type
           if (e == b) prepend = "a";
                               ^
    mrbgems/mruby-string-ext/src/string.c:308:27: warning: assignment discards 'const' qualifier from pointer target type
           if (e == b) prepend = "A";
                               ^
    mrbgems/mruby-bin-mruby/tools/mruby/mruby.c: In function 'main':
    mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:213:13: warning: assignment discards 'const' qualifier from pointer target type
         cmdline = args.cmdline ? args.cmdline : "-";
                 ^
    mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c: In function 'print_breakpoint':
    mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c:159:3: warning: initialization discards 'const' qualifier from pointer target type
       char* enable_letter[] = {BREAK_INFO_MSG_DISABLE, BREAK_INFO_MSG_ENABLE};
       ^
    mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c:159:3: warning: initialization discards 'const' qualifier from pointer target type
2015-04-18 21:43:58 +09:00
Yuhei Okazaki 06435f5bc7 fix maximum value of the index when access breakpoints. 2015-03-31 10:52:10 +09:00
Yukihiro "Matz" Matsumoto d764632f86 Merge pull request #2680 from sdottaka/add-fflush
mrdb, mirb: Add fflush() so that a external program can read output imme...
2015-01-19 08:30:52 +09:00
sdottaka af51a4ac9d mrdb: fix crash when stepping into Proc.call
How to reproduce:

```
cat a.rb
Proc.new { 1 }.call

echo step | mrdb a.rb
```
2015-01-18 10:00:56 +09:00
Yukihiro "Matz" Matsumoto 53da1fb5a1 Merge pull request #2697 from cubicdaiya/use-sizeof
Use sizeof() instead of strlen().
2015-01-10 10:50:21 +09:00
Tatsuhiko Kubo dae42ffe54 Removed duplicated declarations.
* `mrb_show_version()`
 * `mrb_show_copyright()`
2015-01-03 22:56:36 +09:00
Tatsuhiko Kubo 2b753167ca Use sizeof() instead of strlen(). 2015-01-03 22:37:11 +09:00
Tatsuhiko Kubo df5f83cb84 fixed error-handling for mrb_open().
When mrb_open() is called again, it is not checked.
2015-01-03 20:56:49 +09:00
sdottaka 71548aabb7 Add fflush() (2) 2015-01-03 14:52:11 +09:00
Tatsuhiko Kubo 606095f2fe Remove redundant NULL checks for mrb_malloc(). 2015-01-01 05:12:41 +09:00
sdottaka 80a742df51 mrdb: fix that break command cannot handle Windows paths
Before fix:
```
$ mrdb c:\tmp\b.rb
(c:\tmp\b.rb:1) break c:\tmp\b.rb:3
Class name 'c' is invalid.
```

After fix:
```
$ mrdb c:\tmp\b.rb
(c:\tmp\b.rb:1) break c:\tmp\b.rb:3
Breakpoint 1: file c:\tmp\b.rb, line 3.
```
2014-12-20 08:32:28 +09:00
sdottaka 9a0fb6f91b mrdb, mirb: Add fflush() so that a external program can read output immediately. 2014-12-19 16:09:55 +09:00