aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-20 04:53:08 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-20 04:53:08 +0000
commitaee98a1c2be4999bb6327e6797075cb6502c1ec4 (patch)
treea2b321afed87103c7b406ba838cf7431c4f136ef
parenta9534d1b4889cc9a3a5d487944b52c859ecd9e65 (diff)
downloadruby-aee98a1c2be4999bb6327e6797075cb6502c1ec4.tar.gz
.gdbinit: show ID type
* .gdbinit (rp_id): show ID type. * template/id.h.tmpl (ruby_id_types): make enum for debugger. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--.gdbinit30
-rw-r--r--debug.c1
-rw-r--r--template/id.h.tmpl33
3 files changed, 54 insertions, 10 deletions
diff --git a/.gdbinit b/.gdbinit
index 9127db09ef..6fe7b32cfd 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -316,6 +316,36 @@ define rp_id
if $id == idASET
printf "(:[]=)\n"
else
+ if $id <= tLAST_OP_ID
+ printf "O"
+ else
+ set $id_type = $id & RUBY_ID_SCOPE_MASK
+ if $id_type == RUBY_ID_LOCAL
+ printf "l"
+ else
+ if $id_type == RUBY_ID_INSTANCE
+ printf "i"
+ else
+ if $id_type == RUBY_ID_GLOBAL
+ printf "G"
+ else
+ if $id_type == RUBY_ID_ATTRSET
+ printf "a"
+ else
+ if $id_type == RUBY_ID_CONST
+ printf "C"
+ else
+ if $id_type == RUBY_ID_CLASS
+ printf "c"
+ else
+ printf "j"
+ end
+ end
+ end
+ end
+ end
+ end
+ end
printf "(%ld): ", $id
rb_numtable_entry global_symbols.id_str $id
if $rb_numtable_rec
diff --git a/debug.c b/debug.c
index 7cd166495f..be70dafec3 100644
--- a/debug.c
+++ b/debug.c
@@ -24,6 +24,7 @@ const union {
enum ruby_tag_type tag_type;
enum node_type node_type;
enum ruby_method_ids method_ids;
+ enum ruby_id_types id_types;
enum {
RUBY_ENCODING_INLINE_MAX = ENCODING_INLINE_MAX,
RUBY_ENCODING_SHIFT = ENCODING_SHIFT,
diff --git a/template/id.h.tmpl b/template/id.h.tmpl
index c993243424..9df7947214 100644
--- a/template/id.h.tmpl
+++ b/template/id.h.tmpl
@@ -28,16 +28,29 @@ types = ids.keys.grep(/^[A-Z]/)
#ifndef RUBY_ID_H
#define RUBY_ID_H
-#define ID_SCOPE_SHIFT 3
-#define ID_SCOPE_MASK 0x07
-#define ID_LOCAL 0x00
-#define ID_INSTANCE 0x01
-#define ID_GLOBAL 0x03
-#define ID_ATTRSET 0x04
-#define ID_CONST 0x05
-#define ID_CLASS 0x06
-#define ID_JUNK 0x07
-#define ID_INTERNAL ID_JUNK
+enum ruby_id_types {
+ RUBY_ID_LOCAL = 0x00,
+ RUBY_ID_INSTANCE = 0x01,
+ RUBY_ID_GLOBAL = 0x03,
+ RUBY_ID_ATTRSET = 0x04,
+ RUBY_ID_CONST = 0x05,
+ RUBY_ID_CLASS = 0x06,
+ RUBY_ID_JUNK = 0x07,
+ RUBY_ID_INTERNAL = RUBY_ID_JUNK,
+ RUBY_ID_SCOPE_SHIFT = 3,
+ RUBY_ID_SCOPE_MASK = ~(~0U<<RUBY_ID_SCOPE_SHIFT)
+};
+
+#define ID_SCOPE_SHIFT RUBY_ID_SCOPE_SHIFT
+#define ID_SCOPE_MASK RUBY_ID_SCOPE_MASK
+#define ID_LOCAL RUBY_ID_LOCAL
+#define ID_INSTANCE RUBY_ID_INSTANCE
+#define ID_GLOBAL RUBY_ID_GLOBAL
+#define ID_ATTRSET RUBY_ID_ATTRSET
+#define ID_CONST RUBY_ID_CONST
+#define ID_CLASS RUBY_ID_CLASS
+#define ID_JUNK RUBY_ID_JUNK
+#define ID_INTERNAL RUBY_ID_INTERNAL
#define ID2ATTRSET(id) (((id)&~ID_SCOPE_MASK)|ID_ATTRSET)