On Mon Jul 24 19:10:59 2006, tewk wrote:
> I've been wanting this little enhancement for quite some time.
> I finally coded it up.
> Suggestions welcome.
> 
> Kevin
> 
> The patch updates disassemble output to contain three useful pieces of
> information.
> 
> FROM
> 
> load_bytecode_sc "TGE.pbc"
> find_type_i_sc I0,"ASTGrammar"
> ne_i_ic_ic I0,0,L1
> subclass_p_sc_sc P0,"TGE::Grammar","ASTGrammar"
> L1:     set_returns_pc PMC_CONST(5)
> returncc
> get_params_pc PMC_CONST(14)
> debug_init
> defined_i_p_kc I0,P1[?]
> unless_i_ic I0,L2
> set_p_p_kc P1,P1[?]
> set_args_pc PMC_CONST(19)
> get_results_pc PMC_CONST(17)
> callmethodcc_p_sc P3,"get"
> set_returns_pc PMC_CONST(17)
> returncc
> L2:     print_sc "The top-level node d"
> end
> get_params_pc PMC_CONST(14)
> defined_i_p_kc I0,P1[?]
> unless_i_ic I0,L3
> set_p_p_kc P1,P1[?]
> set_args_pc PMC_CONST(19)
> get_results_pc PMC_CONST(17)
> callmethodcc_p_sc P3,"get"
> set_returns_pc PMC_CONST(17)
> returncc
> L3:     print_sc "The compound_stateme"
> end
> 
> TO
> 
>   Seq_Op_Num- Relative-PC SrcLn#:
> Current Source Filename src/ASTGrammar_gen.pir
> 000000000000-000000000000 000025:       load_bytecode_sc "TGE.pbc"
> 000000000001-000000000002 000026:       find_type_i_sc I0,"ASTGrammar"
> 000000000002-000000000005 000026:       ne_i_ic_ic I0,0,L1
> 000000000003-000000000009 000028:       subclass_p_sc_sc
> P0,"TGE::Grammar","ASTGrammar"
> 000000000004-000000000013 000029:       L1:     set_returns_pc
> PMC_CONST(5)
> 000000000005-000000000015 000029:       returncc
> Current Source Filename src/ASTGrammar_gen.pir
> 000000000006-000000000016 000034:       get_params_pc PMC_CONST(14)
> 000000000007-000000000021 000038:       debug_init
> 000000000008-000000000022 000042:       defined_i_p_kc I0,P1[?]
> 000000000009-000000000026 000042:       unless_i_ic I0,L2
> 000000000010-000000000029 000043:       set_p_p_kc P1,P1[?]
> 000000000011-000000000033 000045:       set_args_pc PMC_CONST(19)
> 000000000012-000000000039 000045:       get_results_pc PMC_CONST(17)
> 000000000013-000000000042 000045:       callmethodcc_p_sc P3,"get"
> 000000000014-000000000045 000047:       set_returns_pc PMC_CONST(17)
> 000000000015-000000000048 000047:       returncc
> 000000000016-000000000049 000050:       L2:     print_sc "The top-
> level
> node d"
> 000000000017-000000000051 000051:       end
> Current Source Filename src/ASTGrammar_gen.pir
> 000000000018-000000000052 000056:       get_params_pc PMC_CONST(14)
> 000000000019-000000000057 000062:       defined_i_p_kc I0,P1[?]
> 000000000020-000000000061 000062:       unless_i_ic I0,L3
> 000000000021-000000000064 000063:       set_p_p_kc P1,P1[?]
> 000000000022-000000000068 000065:       set_args_pc PMC_CONST(19)
> 000000000023-000000000074 000065:       get_results_pc PMC_CONST(17)
> 000000000024-000000000077 000065:       callmethodcc_p_sc P3,"get"
> 000000000025-000000000080 000067:       set_returns_pc PMC_CONST(17)
> 000000000026-000000000083 000067:       returncc
> 000000000027-000000000084 000070:       L3:     print_sc "The
> compound_stateme"
> 000000000028-000000000086 000071:       end
> 
> 
> 
> Seq_Op_Num  this is a sequential op number for each operation in the
> code segment.
> (The debug segment indexes both debug mappings and line numbers based
> on
> this incrementing counter)
> Relative-PC this is the op_code_t offset of the  operation in the code
> segement.
> SrcLn# is the line number of the pir source code.  (in this case
> src/AST_Grammar_gen.pir)
> 
> When chasing PIR bugs and parrot  segfauts.  Run parrot in gdb.
> cat  > .rit_gdb_cmds <<EOF
> set args cardinal.pbc t/00_if_unless_5.rb
> run
> set print pretty
> EOF
> 
> gdb -x .rit_gdb_cmds ../../parrot
> 
>  Find the runops_slow_core activation frame closes to the top of the
> stack and execute these commands in gdb
> (gdb) p interpreter->code->base.name
> $48 = 0x82c23c8 "BYTECODE_src/ASTGrammar_gen.pir"
> 
> Tells  you the source file where  parrot most likely core dumped
> 
> (gdb) p pc - interpreter->code->base.data
> $43 = 1022
> 
> 1022 in this case is the Relative-PC in the src/ASTGrammar.pbc file.
> 
> (gdb) p interpreter->code->base.name
> $48 = 0x82c23c8 "BYTECODE_src/ASTGrammar_gen.pir"
> 
> Given BYTECODE_src/ASTGrammar_gen.pir:
> run disassemble on src/ASTGrammar.pbc
> 
> make disassemble
> ./disassemble languages/cardinal/src/ASTGrammar.pbc |less
> 
> And puff, smoke, magic:
> 
> I found out I was core dumping on line #459 of src/ASTGrammar_gen.pir


Thanks!  Applied as r17922.  Note that 'interpreter' had to be changed 
to 'interp' to get this to compile.  This name change hadn't occurred 
when you submitted the patch (so was not a problem with the patch), but 
I thought it best to note it in the ticket.

Paul

Reply via email to