summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-bin-debugger/tools
diff options
context:
space:
mode:
authorHiroshi Mimaki <[email protected]>2017-08-04 17:25:03 +0900
committerHiroshi Mimaki <[email protected]>2017-08-04 17:25:03 +0900
commit7bdc709da01d3b660b3e37a28527e6c8944c3b02 (patch)
tree2b27ddc195ae9761f5b14b742ef1504a65f9f68b /mrbgems/mruby-bin-debugger/tools
parent7b88c1a8e5e7316c1ddad6fc63c2a90678a146fc (diff)
downloadmruby-7bdc709da01d3b660b3e37a28527e6c8944c3b02.tar.gz
mruby-7bdc709da01d3b660b3e37a28527e6c8944c3b02.zip
Fixed a invalid source path name on mruby debugger.
Diffstat (limited to 'mrbgems/mruby-bin-debugger/tools')
-rw-r--r--mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c b/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c
index 33e9575bf..8aaa30bcd 100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c
@@ -174,9 +174,13 @@ mrb_debug_get_source(mrb_state *mrb, mrdb_state *mrdb, const char *srcpath, cons
FILE *fp;
const char *search_path[3];
char *path = NULL;
+ const char *srcname = strrchr(filename, '/');
+
+ if (srcname) srcname++;
+ else srcname = filename;
search_path[0] = srcpath;
- search_path[1] = dirname(mrb, mrb_debug_get_filename(mrdb->dbg->root_irep, 0));
+ search_path[1] = dirname(mrb, mrb_debug_get_filename(mrdb->dbg->irep, 0));
search_path[2] = ".";
for (i = 0; i < 3; i++) {
@@ -184,7 +188,7 @@ mrb_debug_get_source(mrb_state *mrb, mrdb_state *mrdb, const char *srcpath, cons
continue;
}
- if ((path = build_path(mrb, search_path[i], filename)) == NULL) {
+ if ((path = build_path(mrb, search_path[i], srcname)) == NULL) {
continue;
}