gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash server/as_object.h server/as_value.h serv...


From: Rob Savoye
Subject: [Gnash-commit] gnash server/as_object.h server/as_value.h serv...
Date: Tue, 06 Feb 2007 23:06:18 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Rob Savoye <rsavoye>    07/02/06 23:06:18

Modified files:
        server         : as_object.h as_value.h debugger.cpp 
        server/parser  : action_buffer.h 
        server/vm      : ASHandlers.cpp ActionExec.cpp 
        utilities      : parser.cpp processor.cpp 

Log message:
                * server/as_value.h: Add is_as_function() .
                * server/debugger.cpp: Try to lookup a symbol name for each
                address when dumping the stack. Add support for a symbol table 
for
                all functions and "new" objects and an "i s" command to dump the
                symbol table. "i f" now dumps the stack frame, it was "i s"
                before. 
                * server/parser/action_buffer.h: Add accessors for the code
                buffer.
                * server/vm/ASHandlers.cpp: Don't need std:: since we're using 
the
                std namespace. Add a symbol for function definitions.
                * server/vm/ActionExec.cpp: Stash the pc pointer for later 
instead
                of passing it in on the command line.
                * utilities/parser.cpp, processor.cpp: Add support for the 
debugger.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.h?cvsroot=gnash&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.h?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/server/debugger.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/action_buffer.h?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.cpp?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/parser.cpp?cvsroot=gnash&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/processor.cpp?cvsroot=gnash&r1=1.46&r2=1.47

Patches:
Index: server/as_object.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- server/as_object.h  2 Feb 2007 14:11:52 -0000       1.35
+++ server/as_object.h  6 Feb 2007 23:06:18 -0000       1.36
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-// 
-//
-
 #ifndef GNASH_AS_OBJECT_H
 #define GNASH_AS_OBJECT_H
 

Index: server/as_value.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- server/as_value.h   21 Dec 2006 14:12:00 -0000      1.24
+++ server/as_value.h   6 Feb 2007 23:06:18 -0000       1.25
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -14,10 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-// 
-//
-
-/* $Id: as_value.h,v 1.24 2006/12/21 14:12:00 strk Exp $ */
+/* $Id: as_value.h,v 1.25 2007/02/06 23:06:18 rsavoye Exp $ */
 
 #ifndef GNASH_AS_VALUE_H
 #define GNASH_AS_VALUE_H
@@ -253,6 +250,12 @@
                return m_type == C_FUNCTION;
        }
 
+       /// Return true if this value is a AS function
+       bool is_as_function() const
+       {
+               return m_type == AS_FUNCTION;
+       }
+
        /// Return true if this value is strictly a string
        //
        /// Note that you usually DON'T need to call this
@@ -374,11 +377,27 @@
        // in preference to generic overloaded set().  You are
        // more likely to get a warning/error if misused.
 
-       void    set_tu_string(const tu_string& str) { drop_refs(); m_type = 
STRING; m_string_value = str; }
-
-       void    set_string(const char* str) { drop_refs(); m_type = STRING; 
m_string_value = str; }
-       void    set_double(double val) { drop_refs(); m_type = NUMBER; 
m_number_value = val; }
-       void    set_bool(bool val) { drop_refs(); m_type = BOOLEAN; 
m_boolean_value = val; }
+       void    set_tu_string(const tu_string& str) {
+          drop_refs();
+          m_type = STRING;
+          m_string_value = str;
+        }
+
+       void    set_string(const char* str) {
+          drop_refs();
+          m_type = STRING;
+          m_string_value = str;
+        }
+       void    set_double(double val) {
+          drop_refs();
+          m_type = NUMBER;
+          m_number_value = val;
+        }
+       void    set_bool(bool val) {
+          drop_refs();
+          m_type = BOOLEAN;
+          m_boolean_value = val;
+        }
        void    set_sprite(const std::string& path);
        void    set_sprite(const sprite_instance& sp);
        void    set_int(int val) { set_double(val); }

Index: server/debugger.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/debugger.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/debugger.cpp 6 Feb 2007 22:02:01 -0000       1.3
+++ server/debugger.cpp 6 Feb 2007 23:06:18 -0000       1.4
@@ -21,7 +21,9 @@
 #include <string>
 #include <sstream>
 #include <map>
+#include <boost/algorithm/string/case_conv.hpp>
 
+#include "VM.h"
 #include "rc.h"
 #include "debugger.h"
 #include "log.h"
@@ -433,11 +435,10 @@
 // FIXME: we want to print the name of the function
 //         if (val.is_as_function()) {
 //         }
-//         string name = this->lookupSymbol(val.to_object());
+           string name = this->lookupSymbol(val.to_object());
 //         if (name.size()) {
 //             cerr << "NAME IS: " << name << endl;
 //         }
-           
            if (val.is_object()) {
                cerr << " has #" << val.to_object()->get_ref_count() << " 
references";
            }
@@ -528,10 +529,15 @@
 {
     GNASH_REPORT_FUNCTION;
     if (_symbols.size()) {
+       VM& vm = VM::get(); // cache this ?
+       std::string namei = name;
+       if ( vm.getSWFVersion() < 7 ) {
+           boost::to_lower(namei, vm.getLocale());
+       }
        std::map<void *, std::string>::const_iterator it;
        for (it=_symbols.begin(); it != _symbols.end(); it++) {
-           if (it->second == name) {
-               dbglogfile << "Found symbol " << name.c_str() << " at address: 
" << it->first << endl;
+           if (it->second == namei) {
+               dbglogfile << "Found symbol " << namei.c_str() << " at address: 
" << it->first << endl;
                return it->first;
            }
        }
@@ -542,9 +548,14 @@
 void
 Debugger::addSymbol(void *ptr, std::string name)
 {
-    GNASH_REPORT_FUNCTION;
-    dbglogfile << "Adding symbol " << name << " at address: " << ptr << endl;
-    _symbols[ptr] = name;
+//    GNASH_REPORT_FUNCTION;
+    VM& vm = VM::get(); // cache this ?
+    std::string namei = name;
+    if ( vm.getSWFVersion() < 7 ) {
+       boost::to_lower(namei, vm.getLocale());
+    }
+    dbglogfile << "Adding symbol " << namei << " at address: " << ptr << endl;
+    _symbols[ptr] = namei;
 }
 
 
@@ -552,16 +563,22 @@
 std::string
 Debugger::lookupSymbol(void *ptr)
 {
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
 
+    string str;
     if (_symbols.size()) {
        std::map<void *, std::string>::const_iterator it;
        it = _symbols.find(ptr);
+       dbglogfile.setStamp(false);
        if (it != _symbols.end()) {
            dbglogfile << "Found symbol " << it->second.c_str() << " at 
address: " << ptr << endl;
-           return it->second;
+           str = it->second;
+//     } else {
+//         dbglogfile << "No symbol found for address " << ptr << endl;
        }
     }
+    dbglogfile.setStamp(false);
+    return str;
 }
 
 void

Index: server/parser/action_buffer.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/action_buffer.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/parser/action_buffer.h       6 Feb 2007 22:02:01 -0000       1.9
+++ server/parser/action_buffer.h       6 Feb 2007 23:06:18 -0000       1.10
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -14,10 +14,6 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-// 
-//
-//
-
 #ifndef GNASH_ACTION_BUFFER_H
 #define GNASH_ACTION_BUFFER_H
 
@@ -124,6 +120,18 @@
                return (const char*)(&m_buffer[pc]);
        }
 
+        /// Get a pointer to the current instruction within the code
+       unsigned char* getFramePointer(size_t pc) const
+       {
+               return ((unsigned char*)&m_buffer[pc]);
+       }
+
+        /// Get the base pointer of the code buffer.
+        unsigned char* getCodeStart()
+       {
+               return reinterpret_cast<unsigned char*>(&m_buffer);
+       }
+
        const unsigned char* get_buffer(size_t pc) const
        {
                //assert(pc < m_buffer.size() );

Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- server/vm/ASHandlers.cpp    6 Feb 2007 17:46:25 -0000       1.32
+++ server/vm/ASHandlers.cpp    6 Feb 2007 23:06:18 -0000       1.33
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: ASHandlers.cpp,v 1.32 2007/02/06 17:46:25 rsavoye Exp $ */
+/* $Id: ASHandlers.cpp,v 1.33 2007/02/06 23:06:18 rsavoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -44,7 +44,7 @@
 #include "drag_state.h"
 #include "VM.h" // for getting the root
 #include "movie_root.h" // for set_drag_state (ActionStartDragMovie)
-#include "gstring.h"
+#include "debugger.h"
 
 #include <string>
 #include <map>
@@ -55,7 +55,10 @@
 using namespace std;
 
 namespace {
-gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
+static gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
+#ifdef USE_DEBUGGER
+static gnash::Debugger& debugger = gnash::Debugger::getDefaultInstance();
+#endif
 }
 
 // Define this to have WaitForFrame actions really
@@ -192,7 +195,7 @@
 //     GNASH_REPORT_FUNCTION;
 }
 
-ActionHandler::ActionHandler(action_type type, std::string name,
+ActionHandler::ActionHandler(action_type type, string name,
                              action_callback_t func)
        :
        _type(type),
@@ -205,7 +208,7 @@
 //     GNASH_REPORT_FUNCTION;
 }
 
-ActionHandler::ActionHandler(action_type type, std::string name,
+ActionHandler::ActionHandler(action_type type, string name,
                              action_callback_t func, as_arg_t format)
     : _debug(false), _stack_args(0)
 {
@@ -216,7 +219,7 @@
     _arg_format = format;
 }
 
-ActionHandler::ActionHandler(action_type type, std::string name,
+ActionHandler::ActionHandler(action_type type, string name,
                              action_callback_t func, as_arg_t format, int 
nargs)
     : _debug(false)
 {
@@ -244,7 +247,7 @@
 {
 //    GNASH_REPORT_FUNCTION;
 
-    std::vector<std::string> & property_names = get_property_names();
+    vector<std::string> & property_names = get_property_names();
 
     property_names.reserve(32);
     property_names.push_back("_x");
@@ -483,17 +486,17 @@
 }
 
 
-std::vector<ActionHandler> &
+vector<ActionHandler> &
 SWFHandlers::get_handlers()
 {
        static container_type handlers(255);
        return handlers;
 }
 
-std::vector<std::string> &
+vector<string> &
 SWFHandlers::get_property_names()
 {
-       static std::vector<std::string> prop_names;
+       static vector<string> prop_names;
        return prop_names;
 }
 
@@ -737,7 +740,7 @@
        assert(code[pc] == SWF::ACTION_SETTARGET); // 0x8B
 
        // Change the movie we're working on.
-       std::string target_name ( code.read_string(pc+3) );
+       string target_name ( code.read_string(pc+3) );
 
        CommonSetTarget(env, target_name);
 }
@@ -967,7 +970,7 @@
     // Truncate if necessary.
     //size = imin(str.length() - base, size);
 
-    // TODO: unsafe: use std::string::substr instead !
+    // TODO: unsafe: use string::substr instead !
     tu_string  new_string = str.c_str() + base;
     new_string.resize(size);
     
@@ -1010,7 +1013,7 @@
                return;
        }
 
-       std::string var_string(ptr);
+       string var_string(ptr);
 
        top_value = thread.getVariable(var_string);
 
@@ -1063,7 +1066,7 @@
        //strk: shouldn't we use env.pop() instead ? No (see above comment)
        //const char * target_name = env.top(0).to_string();
        assert(env.top(0).to_string());
-       std::string target_name = env.top(0).to_string();
+       string target_name = env.top(0).to_string();
        env.drop(1); // pop the target name off the stack
 
        CommonSetTarget(env, target_name);
@@ -1099,9 +1102,9 @@
                if ( prop_number < get_property_names().size() )
                {
                        as_value val;
-                       // TODO: check if get_propery_names() can return a 
std::string
+                       // TODO: check if get_propery_names() can return a 
string
                        //       directly.
-                       std::string propname = 
get_property_names()[prop_number].c_str();
+                       string propname = 
get_property_names()[prop_number].c_str();
                        //target->get_member(propname &val);
                        thread.getObjectMember(*target, propname, val);
                        env.top(1) = val;
@@ -1141,8 +1144,8 @@
 //        set_property(target, prop_number, env.top(0));
         if ( prop_number < get_property_names().size() )
        {
-           // TODO: check if get_property_names() return a std::string&
-           std::string member_name = get_property_names()[prop_number].c_str();
+           // TODO: check if get_property_names() return a string&
+           string member_name = get_property_names()[prop_number].c_str();
            thread.setObjectMember(*target, member_name, prop_val);
        }
        else
@@ -1857,14 +1860,14 @@
 // http://sswf.sourceforge.net/SWFalexref.html#action_set_target
 // http://sswf.sourceforge.net/SWFalexref.html#action_get_dynamic
 void 
-SWFHandlers::CommonSetTarget(as_environment& env, const std::string& 
target_name)
+SWFHandlers::CommonSetTarget(as_environment& env, const string& target_name)
 {
        character *new_target;
     
        // if the string is blank, we set target to the root movie
        // TODO - double check this is correct?
        if ( target_name.empty() ) {
-               new_target = env.find_target(std::string("/"));
+               new_target = env.find_target(string("/"));
        } else {
                as_value target_val = env.get_variable(target_name);
                new_target = target_val.to_sprite();
@@ -1948,7 +1951,7 @@
 void
 SWFHandlers::ActionCallFrame(ActionExec& thread)
 {
-//     GNASH_REPORT_FUNCTION;
+        GNASH_REPORT_FUNCTION;
        as_environment& env = thread.env;
 
        thread.ensureStack(1); // frame spec
@@ -2143,7 +2146,7 @@
 void
 SWFHandlers::ActionCallFunction(ActionExec& thread)
 {
-       //GNASH_REPORT_FUNCTION;
+        GNASH_REPORT_FUNCTION;
        as_environment& env = thread.env;
 
        thread.ensureStack(2); // func name, nargs
@@ -2155,7 +2158,7 @@
        if ( ! function.is_function() )
        {
                // Let's consider it a as a string and lookup the function.
-               std::string function_name(function.to_string());
+               string function_name(function.to_string());
                function = thread.getVariable(function_name);
                
                if ( ! function.is_function() )
@@ -2181,6 +2184,7 @@
        env.drop(nargs + 1);
        env.top(0) = result;
 
+
        //cerr << "After ActionCallFunction:"<<endl;
        //env.dump_stack();
 }
@@ -2188,7 +2192,7 @@
 void
 SWFHandlers::ActionReturn(ActionExec& thread)
 {
-       //GNASH_REPORT_FUNCTION;
+        GNASH_REPORT_FUNCTION;
        as_environment& env = thread.env;
        as_value* retval = thread.retval;
 
@@ -2241,7 +2245,7 @@
        thread.ensureStack(2); // classname, nargs
 
        as_value val = env.pop();
-       std::string classname;
+       string classname;
        if ( val.to_string() ) classname = val.to_string();
 
        IF_VERBOSE_ACTION (
@@ -2258,6 +2262,9 @@
        as_value new_obj = construct_object(constructor, env, nargs,
                env.get_top_index());
 
+#ifdef USE_DEBUGGER
+        debugger.addSymbol(&new_obj, classname);
+#endif
        env.drop(nargs);
        env.push(new_obj);
 
@@ -2269,7 +2276,7 @@
 //    GNASH_REPORT_FUNCTION;
     as_environment& env = thread.env;
     thread.ensureStack(1); // var name
-    std::string varname = env.top(0).to_std_string();
+    string varname = env.top(0).to_std_string();
     env.declare_local(varname);
     env.drop(1);
 }
@@ -2338,7 +2345,7 @@
     // Set provided members
     for (int i=0; i<nmembers; ++i) {
         as_value member_value = env.pop();
-       std::string member_name = env.pop().to_std_string();
+       string member_name = env.pop().to_std_string();
         //new_obj_ptr->set_member(member_name, member_value);
        thread.setObjectMember(*new_obj_ptr, member_name, member_value);
     }
@@ -2395,7 +2402,7 @@
 
        // Get the object
        as_value& var_name = env.top(0);
-       std::string var_string = var_name.to_std_string();
+       string var_string = var_name.to_std_string();
        as_value variable = thread.getVariable(var_string);
        const as_object* obj = variable.to_object();
 
@@ -2568,7 +2575,7 @@
        thread.ensureStack(3); // value, member, object
 
        as_object* obj = env.top(2).to_object();
-       std::string member_name = env.top(1).to_std_string();
+       string member_name = env.top(1).to_std_string();
        const as_value& member_value = env.top(0);
 
        if (obj)
@@ -2631,7 +2638,7 @@
     //int version = env.get_version();
 
     // Get name of the method
-    std::string method_name = env.top(0).to_std_string();
+    string method_name = env.top(0).to_std_string();
 
     // Get an object
     as_value& obj_value = env.top(1);
@@ -2726,7 +2733,7 @@
        }
 
        as_value method_val;
-       std::string method_string = method_name.to_std_string();
+       string method_string = method_name.to_std_string();
        //if ( ! obj->get_member(method_name.to_tu_stringi(), &method_val) )
        if ( ! thread.getObjectMember(*obj, method_string, method_val) )
        {
@@ -2971,7 +2978,7 @@
 
        // Extract name.
        // @@ security: watch out for possible missing terminator here!
-       std::string name = code.read_string(i);
+       string name = code.read_string(i);
        i += name.length() + 1; // add NULL-termination
 
        //cerr << " name:" << name << endl;
@@ -3050,6 +3057,9 @@
        {
                env.push_val(function_value);
        }
+#ifdef USE_DEBUGGER
+        debugger.addSymbol(&function_value, name);
+#endif
 }
 
 void
@@ -3074,7 +3084,7 @@
        thread.ensureStack(1);  // the object
        as_object* with_obj = env.pop().to_object();
 
-       const std::vector<with_stack_entry>& with_stack = thread.getWithStack();
+       const vector<with_stack_entry>& with_stack = thread.getWithStack();
        IF_VERBOSE_ACTION (
        log_action("-------------- with block start: stack size is " SIZET_FMT,
                   with_stack.size());
@@ -3132,7 +3142,7 @@
 
        // Extract name.
        // @@ security: watch out for possible missing terminator here!
-       std::string name = code.read_string(i);
+       string name = code.read_string(i);
        i += name.length() + 1;
 
        //cerr << " name:" << name << endl;
@@ -3176,6 +3186,9 @@
        {
                //env.set_member(name, function_value);
                thread.setVariable(name, function_value);
+#ifdef USE_DEBUGGER
+                debugger.addSymbol(&function_value, name);
+#endif
        }
 
        // Otherwise push the function literal on the stack

Index: server/vm/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/vm/ActionExec.cpp    6 Feb 2007 22:02:01 -0000       1.16
+++ server/vm/ActionExec.cpp    6 Feb 2007 23:06:18 -0000       1.17
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: ActionExec.cpp,v 1.16 2007/02/06 22:02:01 strk Exp $ */
+/* $Id: ActionExec.cpp,v 1.17 2007/02/06 23:06:18 rsavoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -182,9 +182,10 @@
        ash.execute((action_type)action_id, *this);
 
 #ifdef USE_DEBUGGER
+       debugger.setFramePointer(code.getFramePointer(pc));
        debugger.setEnvStack(&env);
        if (debugger.isTracing()) {
-           debugger.dissasemble(code.get_buffer(pc));
+           debugger.dissasemble();
        }
 #endif
        

Index: utilities/parser.cpp
===================================================================
RCS file: /sources/gnash/gnash/utilities/parser.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- utilities/parser.cpp        30 Jan 2007 02:02:29 -0000      1.34
+++ utilities/parser.cpp        6 Feb 2007 23:06:18 -0000       1.35
@@ -15,7 +15,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 // 
 
-/* $Id: parser.cpp,v 1.34 2007/01/30 02:02:29 rsavoye Exp $ */
+/* $Id: parser.cpp,v 1.35 2007/02/06 23:06:18 rsavoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -44,6 +44,7 @@
 #include "gnash.h"
 #include "rc.h"
 #include "hash_wrapper.h"
+#include "debugger.h"
 
 #define TWIPS_TO_PIXELS(x) ((x) / 20.f)
 #define PIXELS_TO_TWIPS(x) ((x) * 20.f)
@@ -77,6 +78,9 @@
 namespace {
 gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
 gnash::RcInitFile& rcfile = gnash::RcInitFile::getDefaultInstance();
+#ifdef USE_DEBUGGER
+gnash::Debugger& debugger = gnash::Debugger::getDefaultInstance();
+#endif
 }
 
 namespace parser
@@ -634,12 +638,20 @@
         dbglogfile.setVerbosity();
     }
     
-    while ((c = getopt (argc, argv, "h")) != -1) {
+    while ((c = getopt (argc, argv, "hg")) != -1) {
        switch (c) {
          case 'h':
              usage (argv[0]);
               dbglogfile.removeLog();
              exit(0);
+          case 'g':
+#ifdef USE_DEBUGGER
+              debugger.enabled(true);
+              debugger.console();
+              dbglogfile << "Setting debugger ON" << std::endl;
+#else
+              dbglogfile << "WARNING: The debugger has been disabled at 
configuration time" << std::endl;
+#endif
          default:
              break;
        }
@@ -687,6 +699,7 @@
        "usage: gparser [swf files to process...]\n"
        "  --help(-h)  Print this info.\n"
        "  --version   Print the version numbers.\n"
+       "  -g          Start the Flash debugger.\n"
        );
 }
 

Index: utilities/processor.cpp
===================================================================
RCS file: /sources/gnash/gnash/utilities/processor.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- utilities/processor.cpp     30 Jan 2007 02:02:29 -0000      1.46
+++ utilities/processor.cpp     6 Feb 2007 23:06:18 -0000       1.47
@@ -15,7 +15,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 // 
 
-/* $Id: processor.cpp,v 1.46 2007/01/30 02:02:29 rsavoye Exp $ */
+/* $Id: processor.cpp,v 1.47 2007/02/06 23:06:18 rsavoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -31,6 +31,7 @@
 #include "rc.h"
 #include "URL.h"
 #include "GnashException.h"
+#include "debugger.h"
 #include "VM.h"
 
 #include <iostream>
@@ -81,6 +82,9 @@
 namespace {
 gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
 gnash::RcInitFile& rcfile = gnash::RcInitFile::getDefaultInstance();
+#ifdef USE_DEBUGGER
+gnash::Debugger& debugger = gnash::Debugger::getDefaultInstance();
+#endif
 }
 
 struct movie_data
@@ -138,7 +142,7 @@
         dbglogfile.setVerbosity();
     }
 
-    while ((c = getopt (argc, argv, "hwvapr:")) != -1) {
+    while ((c = getopt (argc, argv, "hwvapr:g")) != -1) {
        switch (c) {
          case 'h':
              usage (argv[0]);
@@ -151,6 +155,14 @@
              dbglogfile.setVerbosity();
              dbglogfile << "Verbose output turned on" << endl;
              break;
+          case 'g':
+#ifdef USE_DEBUGGER
+              debugger.enabled(true);
+              debugger.console();
+              dbglogfile << "Setting debugger ON" << std::endl;
+#else
+              dbglogfile << "WARNING: The debugger has been disabled at 
configuration time" << std::endl;
+#endif
          case 'a':
 #if VERBOSE_ACTION
              dbglogfile.setActionDump(true); 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]