From d4e2ec880b322c519cca81f1e6dd63f972f2d583 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Mon, 11 Oct 2010 18:53:46 +0000 Subject: [PATCH] [src] Show string encoding in pbc_dump and pbc_disassemble git-svn-id: https://svn.parrot.org/parrot/trunk@49514 d31e2699-5ff4-0310-a27c-f18f2fbe73fe --- src/debug.c | 9 ++++++++- src/packdump.c | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/debug.c b/src/debug.c index d808bc6e6e..940f386ed3 100644 --- a/src/debug.c +++ b/src/debug.c @@ -2350,12 +2350,19 @@ PDB_disassemble_op(PARROT_INTERP, ARGOUT(char *dest), size_t space, case PARROT_ARG_SC: { const STRING *s = interp->code->const_table->str.constants[op[j]]; + + if (s->encoding != Parrot_ascii_encoding_ptr) { + strcpy(&dest[size], s->encoding->name); + size += strlen(s->encoding->name); + dest[size++] = ':'; + } + dest[size++] = '"'; if (s->strlen) { char * const unescaped = Parrot_str_to_cstring(interp, s); char * const escaped = - PDB_escape(interp, unescaped, s->strlen); + PDB_escape(interp, unescaped, s->bufused); if (escaped) { strcpy(&dest[size], escaped); size += strlen(escaped); diff --git a/src/packdump.c b/src/packdump.c index c40a6611a8..7e9c75820c 100644 --- a/src/packdump.c +++ b/src/packdump.c @@ -193,7 +193,7 @@ PackFile_Constant_dump_str(PARROT_INTERP, ARGIN(const PackFile_ConstTable *ct), Parrot_io_printf(interp, " [ 'PFC_STRING', {\n"); pobj_flag_dump(interp, (long)PObj_get_FLAGS(self)); - Parrot_io_printf(interp, " ENCODING => %ld,\n", self->encoding); + Parrot_io_printf(interp, " ENCODING => %s,\n", self->encoding->name); Parrot_io_printf(interp, " SIZE => %ld,\n", self->bufused); Parrot_io_printf(interp, " DATA => \"%Ss\"\n", Parrot_str_escape(interp, self));