Skip to content

Commit

Permalink
lldb: Show encoding of String [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Sep 28, 2021
1 parent 8bdaaeb commit 545e016
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3457,6 +3457,7 @@ debug.$(OBJEXT): {$(VPATH)}config.h
debug.$(OBJEXT): {$(VPATH)}debug.c
debug.$(OBJEXT): {$(VPATH)}debug_counter.h
debug.$(OBJEXT): {$(VPATH)}defines.h
debug.$(OBJEXT): {$(VPATH)}encindex.h
debug.$(OBJEXT): {$(VPATH)}encoding.h
debug.$(OBJEXT): {$(VPATH)}eval_intern.h
debug.$(OBJEXT): {$(VPATH)}gc.h
Expand Down
2 changes: 2 additions & 0 deletions debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <stdio.h>

#include "eval_intern.h"
#include "encindex.h"
#include "id.h"
#include "internal/signal.h"
#include "ruby/encoding.h"
Expand Down Expand Up @@ -50,6 +51,7 @@ const union {
enum ruby_coderange_type enc_coderange_types;
enum ruby_econv_flag_type econv_flag_types;
rb_econv_result_t econv_result;
enum ruby_preserved_encindex encoding_index;
enum ruby_robject_flags robject_flags;
enum ruby_robject_consts robject_consts;
enum ruby_rmodule_flags rmodule_flags;
Expand Down
2 changes: 2 additions & 0 deletions misc/lldb_cruby.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ def lldb_inspect(debugger, target, result, val):
append_command_output(debugger, "print *(struct RClass*)%0#x" % val.GetValueAsUnsigned(), result)
elif flType == RUBY_T_STRING:
result.write('T_STRING: %s' % flaginfo)
encidx = ((flags & RUBY_ENCODING_MASK)>>RUBY_ENCODING_SHIFT)
result.write('[%s] ' % target.FindFirstType("enum ruby_preserved_encindex").GetEnumMembers().GetTypeEnumMemberAtIndex(encidx).GetName()[14:])
tRString = target.FindFirstType("struct RString").GetPointerType()
ptr, len = string2cstr(val.Cast(tRString))
if len == 0:
Expand Down

0 comments on commit 545e016

Please sign in to comment.