Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
125 lines (79 sloc) 1.82 KB
Copyright (C) 2001-2003, The Perl Foundation.
=head1 NAME
disassemble - Parrot disassembler
disassemble file.pbc
This uses the C<Parrot_disassemble()> function from F<src/embed.c>,
which in turn uses the C<PDB_disassemble()> function from
=head2 Functions
=over 4
#include <parrot/parrot.h>
#include "parrot/embed.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
static void do_dis(Parrot_Interp);
=item C<int main(int argc, char *argv[])>
The run-loop. Starts up an interpreter, loads the bytecode from the
command-line and disassembles it.
main(int argc, char *argv[])
Parrot_Interp interp;
char *filename;
Parrot_PackFile pf;
interp = Parrot_new(NULL);
if (!interp) {
return 1;
/* set the top of the stack so GC can trace it for GC-able pointers
* see trace_system_areas() in src/cpu_dep.c */
interp->lo_var_ptr = &interp;
if (argc != 2) {
fprintf(stderr, "Usage: disassemble programfile \n");
Parrot_exit(interp, 1);
filename = argv[1];
pf = Parrot_readbc(interp, filename);
if (!pf) {
return 1;
Parrot_loadbc(interp, pf);
Parrot_exit(interp, 0);
=item C<static void do_dis(Parrot_Interp interp)>
Do the disassembling.
static void
do_dis(Parrot_Interp interp)
=head1 SEE ALSO
F<src/embed.c> and F<src/debug.c>.
=head1 HISTORY
Initial version by Daniel Grunblatt on 2002.5.26.
Florian Ragwitz: Moved POD documentation that's not necessary to know how to
actually run the disassembler to normal C comments (Wed, 16 Nov 2005).
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4:
Jump to Line
Something went wrong with that request. Please try again.