[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/PropertyList.h server/as...
From: |
Rob Savoye |
Subject: |
[Gnash-commit] gnash ChangeLog server/PropertyList.h server/as... |
Date: |
Fri, 09 Feb 2007 05:52:49 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Rob Savoye <rsavoye> 07/02/09 05:52:49
Modified files:
. : ChangeLog
server : PropertyList.h as_object.cpp as_object.h
as_value.h debugger.cpp debugger.h movie_root.h
server/vm : ASHandlers.cpp VM.h
Log message:
* server/as_object.h: Return the raw properties handle so the
debugger can use it. Add set_std_string method to let one add
standard STL strings.
* server/debugger.cpp, debugger.h: Add support for setting
variables or registers from the debugger console. Fix the symbol
table to actually work, so now function names are displayed when
doing a stack frame dump instead of just the address. Add
minimal
support for dumping information about the movie.
* server/vm/ASHandlers.cpp: Grab the correct address when adding
symbols to the debugger.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2282&r2=1.2283
http://cvs.savannah.gnu.org/viewcvs/gnash/server/PropertyList.h?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.cpp?cvsroot=gnash&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.h?cvsroot=gnash&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.h?cvsroot=gnash&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/gnash/server/debugger.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/debugger.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.h?cvsroot=gnash&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.h?cvsroot=gnash&r1=1.4&r2=1.5
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2282
retrieving revision 1.2283
diff -u -b -r1.2282 -r1.2283
--- ChangeLog 9 Feb 2007 00:19:07 -0000 1.2282
+++ ChangeLog 9 Feb 2007 05:52:48 -0000 1.2283
@@ -1,3 +1,16 @@
+2007-02-08 Rob Savoye <address@hidden>
+
+ * server/as_object.h: Return the raw properties handle so the
+ debugger can use it. Add set_std_string method to let one add
+ standard STL strings.
+ * server/debugger.cpp, debugger.h: Add support for setting
+ variables or registers from the debugger console. Fix the symbol
+ table to actually work, so now function names are displayed when
+ doing a stack frame dump instead of just the address. Add minimal
+ support for dumping information about the movie.
+ * server/vm/ASHandlers.cpp: Grab the correct address when adding
+ symbols to the debugger.
+
2007-02-08 Sandro Santilli <address@hidden>
* server/timers.{h,cpp}: add execution operator.
@@ -148,6 +161,22 @@
* server/parser/shape_character_def.cpp (read):
neater parse print.
+2007-02-06 Rob Savoye <address@hidden>
+
+ * 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.
+
2007-02-06 Sandro Santilli <address@hidden>
* server/debugger.{h,cpp}: (dissasemble): first argument
Index: server/PropertyList.h
===================================================================
RCS file: /sources/gnash/gnash/server/PropertyList.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/PropertyList.h 5 Feb 2007 09:39:50 -0000 1.11
+++ server/PropertyList.h 9 Feb 2007 05:52:49 -0000 1.12
@@ -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_PROPERTYLIST_H
#define GNASH_PROPERTYLIST_H
Index: server/as_object.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- server/as_object.cpp 7 Feb 2007 13:31:26 -0000 1.35
+++ server/as_object.cpp 9 Feb 2007 05:52:49 -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,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
-//
-//
-//
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Index: server/as_object.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- server/as_object.h 7 Feb 2007 10:28:40 -0000 1.37
+++ server/as_object.h 9 Feb 2007 05:52:49 -0000 1.38
@@ -282,6 +282,10 @@
///
void setPropFlags(as_value& props, int set_false, int set_true);
+#ifdef USE_DEBUGGER
+ /// Get the properties of this objects
+ PropertyList &get_properties() { return _members; };
+#endif
/// Copy properties from the given object
void copyProperties(const as_object& o);
Index: server/as_value.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- server/as_value.h 6 Feb 2007 23:06:18 -0000 1.25
+++ server/as_value.h 9 Feb 2007 05:52:49 -0000 1.26
@@ -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: as_value.h,v 1.25 2007/02/06 23:06:18 rsavoye Exp $ */
+/* $Id: as_value.h,v 1.26 2007/02/09 05:52:49 rsavoye Exp $ */
#ifndef GNASH_AS_VALUE_H
#define GNASH_AS_VALUE_H
@@ -28,6 +28,7 @@
#include "container.h"
#include "tu_config.h"
+
//#include "resource.h" // for inheritance of as_object
namespace gnash {
@@ -383,6 +384,12 @@
m_string_value = str;
}
+ void set_std_string(const std::string& str) {
+ drop_refs();
+ m_type = STRING;
+ m_string_value = str.c_str();
+ }
+
void set_string(const char* str) {
drop_refs();
m_type = STRING;
@@ -509,3 +516,9 @@
} // namespace gnash
#endif // GNASH_AS_VALUE_H
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:
+
Index: server/debugger.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/debugger.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/debugger.cpp 8 Feb 2007 19:32:00 -0000 1.6
+++ server/debugger.cpp 9 Feb 2007 05:52:49 -0000 1.7
@@ -31,6 +31,7 @@
#include "as_environment.h"
#include "swf.h"
#include "ASHandlers.h"
+#include "movie_root.h"
namespace {
gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
@@ -86,6 +87,7 @@
cerr << "\tc - Continue" << endl;
cerr << "\td - Dissasemble current line" << endl;
// info commands
+ cerr << "\ti i - Dump Movie Info" << endl;
cerr << "\ti f - Dump Stack Frame" << endl;
cerr << "\ti s - Dump symbols" << endl;
cerr << "\ti g - Global Regs" << endl;
@@ -96,6 +98,11 @@
cerr << "\tw name [r:w:b] - set variable watchpoint" << endl;
cerr << "\tw name d - delete variable watchpoint" << endl;
cerr << "\tb name - set function break point" << endl;
+ // change data
+ cerr << "\tset var [name] [value] - set a local variable" << endl;
+ cerr << "\tset stack [index] [value] - set a stack entry" << endl;
+ cerr << "\tset reg [index] [value] - set a local register" << endl;
+ cerr << "\tset global [index] [value] - set a global register" << endl;
}
void
@@ -125,7 +132,8 @@
// this->hitBreak();
// } else {
string action;
- string var, sstate;
+ string var, val, sstate;
+ int index;
Debugger::watch_state_e wstate;
bool keep_going = true;
@@ -144,6 +152,41 @@
this->go(10);
keep_going = false;
break;
+ // Change the value of a variable on the stack
+ case 's':
+ if (action == "set") {
+ cin >> var;
+ as_value asval;
+ switch(var[0]) {
+ // change a parameter on the stack
+ case 's':
+ cin >> index >> val;
+ asval.set_std_string(val);
+ this->changeStackValue(index, asval);
+ break;
+ // change a local variable
+ case 'v':
+ cin >> var >> val;
+ asval.set_std_string(val);
+ this->changeLocalVariable(var, asval);
+ break;
+ // change a local register
+ case 'r':
+ cin >> index >> val;
+ asval.set_std_string(val);
+ this->changeLocalRegister(index, asval);
+ break;
+ // change a global register
+ case 'g':
+ cin >> index >> val;
+ asval.set_std_string(val);
+ this->changeGlobalRegister(index, asval);
+ break;
+ default:
+ break;
+ }
+ }
+ break;
// Informational commands.
case 'i':
cin >> var;
@@ -151,6 +194,9 @@
case 'd':
this->dissasemble();
break;
+ case 'i':
+ this->dumpMovieInfo();
+ break;
case 'b':
this->dumpBreakPoints();
break;
@@ -219,6 +265,22 @@
}
void
+Debugger::dumpMovieInfo()
+{
+// GNASH_REPORT_FUNCTION;
+ if (VM::isInitialized()) {
+ VM& vm = VM::get();
+ movie_root &mr = vm.getRoot();
+ int x, y, buttons;
+ mr.get_mouse_state(x, y, buttons);
+
+ cerr << "Movie is Flash v" << vm.getSWFVersion() << endl;
+ cerr << "Mouse coordinates are: X=" << x << ", Y=" << y << endl;
+ vm.getGlobal()->dump_members();
+ }
+}
+
+void
Debugger::dissasemble()
{
// GNASH_REPORT_FUNCTION;
@@ -419,6 +481,27 @@
this->dumpStackFrame(*_env);
}
+// Change the value of a parameter on the stack
+void
+Debugger::changeStackValue(int index, as_value &val)
+{
+// GNASH_REPORT_FUNCTION;
+ changeStackValue(*_env, index, val);
+}
+
+void
+Debugger::changeStackValue(as_environment &env, int index, as_value &val)
+{
+// GNASH_REPORT_FUNCTION;
+ if (!_env) {
+ dbglogfile << "WARNING: environment not set in " << __PRETTY_FUNCTION__
<< endl;
+ return;
+ }
+ if (env.stack_size()) {
+ env.m_stack[index] = val;
+ }
+}
+
void
Debugger::dumpStackFrame(as_environment &env)
{
@@ -430,15 +513,17 @@
if (env.stack_size()) {
dbglogfile << "Stack Dump of: " << (void *)&env << endl;
for (unsigned int i=0, n=env.stack_size(); i<n; i++) {
- cerr << "\t" << i << ": \"" << env.m_stack[i].to_string() << "\"";
+ cerr << "\t" << i << ": "; // << env.m_stack[i].to_string() <<
"\"";
as_value val = env.m_stack[i];
// FIXME: we want to print the name of the function
-// if (val.is_as_function()) {
-// }
+ if (val.is_as_function()) {
+// cerr << val.get_symbol_handle() << endl;
string name = this->lookupSymbol(val.to_object());
-// if (name.size()) {
-// cerr << "NAME IS: " << name << endl;
-// }
+ if (name.size()) {
+ cerr << name << " ";
+ }
+ }
+ cerr << env.m_stack[i].to_string();
if (val.is_object()) {
cerr << " has #" << val.to_object()->get_ref_count() << "
references";
}
@@ -500,6 +585,53 @@
cerr << ss.str().c_str() << endl;
}
+ // Change the value of a local variable
+void
+Debugger::changeLocalVariable(std::string &var, as_value &val)
+{
+// GNASH_REPORT_FUNCTION;
+ changeLocalVariable(*_env, var, val);
+}
+
+void
+Debugger::changeLocalVariable(as_environment &env, std::string &var, as_value
&val)
+{
+// GNASH_REPORT_FUNCTION;
+ env.set_local(var, val);
+}
+
+// Change the value of a local variable
+void
+Debugger::changeLocalRegister(int index, as_value &val)
+{
+// GNASH_REPORT_FUNCTION;
+ this->changeLocalRegister(*_env, index, val);
+}
+
+void
+Debugger::changeLocalRegister(as_environment &env, int index, as_value &val)
+{
+// GNASH_REPORT_FUNCTION;
+ if (index <= env.num_local_registers()) {
+ env.set_local_register(static_cast<uint8_t>(index), val);
+ }
+}
+
+// Change the value of a global variable
+void
+Debugger::changeGlobalRegister(int index, as_value &val)
+{
+// GNASH_REPORT_FUNCTION;
+ this->changeLocalRegister(*_env, index, val);
+}
+
+void
+Debugger::changeGlobalRegister(as_environment &env, int index, as_value &val)
+{
+// GNASH_REPORT_FUNCTION;
+ env.set_global_register(index, val);
+}
+
void
Debugger::dumpLocalVariables()
{
@@ -515,11 +647,19 @@
dbglogfile << "WARNING: environment not set in " << __PRETTY_FUNCTION__
<< endl;
return;
}
+ int index = 0;
dbglogfile << "Local variable Dump:" << endl;
as_environment::frame_slot slot;
for (size_t i = 0, n=env.get_local_frame_top(); i < n; ++i) {
slot = env.m_local_frames[i];
- cerr << "\t" << slot.m_name << " = " << slot.m_value.to_std_string() <<
endl;
+ string var = slot.m_value.to_std_string();
+ cerr << "\tvar #" << index << ": ";
+ if (slot.m_name.size()) {
+ cerr << slot.m_name << " = \"" << var << "\"" << endl;
+ } else {
+ cerr << "\"null\"" << " = " << var << endl;
+ }
+ index++;
}
}
@@ -527,7 +667,7 @@
void *
Debugger::lookupSymbol(std::string &name)
{
- GNASH_REPORT_FUNCTION;
+// GNASH_REPORT_FUNCTION;
if (_symbols.size()) {
VM& vm = VM::get(); // cache this ?
std::string namei = name;
@@ -537,7 +677,7 @@
std::map<void *, std::string>::const_iterator it;
for (it=_symbols.begin(); it != _symbols.end(); it++) {
if (it->second == namei) {
- dbglogfile << "Found symbol " << namei.c_str() << " at address:
" << it->first << endl;
+// dbglogfile << "Found symbol " << namei.c_str() << " at address:
" << it->first << endl;
return it->first;
}
}
@@ -555,13 +695,12 @@
boost::to_lower(namei, vm.getLocale());
}
if (namei.size() > 1) {
-// dbglogfile << "Adding symbol " << namei << " at address: " << ptr <<
endl;
+ dbglogfile << "Adding symbol " << namei << " at address: " << ptr <<
endl;
_symbols[ptr] = namei;
}
}
-
/// Get the name associated with an address
std::string
Debugger::lookupSymbol(void *ptr)
@@ -574,7 +713,7 @@
it = _symbols.find(ptr);
dbglogfile.setStamp(false);
if (it != _symbols.end()) {
- dbglogfile << "Found symbol " << it->second.c_str() << " at
address: " << ptr << endl;
+// dbglogfile << "Found symbol " << it->second.c_str() << " at
address: " << ptr << endl;
str = it->second;
// } else {
// dbglogfile << "No symbol found for address " << ptr << endl;
@@ -588,13 +727,15 @@
Debugger::dumpSymbols()
{
// GNASH_REPORT_FUNCTION;
+ int index = 0;
std::map<void *, std::string>::const_iterator it;
for (it=_symbols.begin(); it != _symbols.end(); it++) {
string name = it->second;
void *addr = it->first;
if (name.size()) {
- cerr << addr << ": " << name << endl;
+ cerr << "\tsym #" << index << ": " << name << " <" << addr << ">"
<< endl;
}
+ index++;
}
}
Index: server/debugger.h
===================================================================
RCS file: /sources/gnash/gnash/server/debugger.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/debugger.h 7 Feb 2007 17:38:56 -0000 1.3
+++ server/debugger.h 9 Feb 2007 05:52:49 -0000 1.4
@@ -49,6 +49,7 @@
void setBreakPoint(std::string &var);
void removeBreakPoint(std::string &var);
void dumpBreakPoints();
+ void dumpMovieInfo();
/// Set a watchpoint of a variable. Gnash stops and generates a
/// command prompt when there is a match.
@@ -107,6 +108,22 @@
std::string lookupSymbol(void *ptr);
void dumpSymbols();
+ // Change the value of a parameter on the stack
+ void changeStackValue(int index, as_value &val);
+ void changeStackValue(as_environment &env, int index, as_value &val);
+
+ // Change the value of a local variable
+ void changeLocalVariable(std::string &var, as_value &val);
+ void changeLocalVariable(as_environment &env, std::string &val, as_value
&val);
+
+ // Change the value of a local variable
+ void changeLocalRegister(int index, as_value &val);
+ void changeLocalRegister(as_environment &env, int index, as_value &val);
+
+ // Change the value of a local variable
+ void changeGlobalRegister(int index, as_value &val);
+ void changeGlobalRegister(as_environment &env, int index, as_value &val);
+
debug_state_e state() { return _state; };
private:
bool _enabled;
Index: server/movie_root.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- server/movie_root.h 9 Feb 2007 00:19:07 -0000 1.34
+++ server/movie_root.h 9 Feb 2007 05:52:49 -0000 1.35
@@ -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: movie_root.h,v 1.34 2007/02/09 00:19:07 strk Exp $ */
+/* $Id: movie_root.h,v 1.35 2007/02/09 05:52:49 rsavoye Exp $ */
/// \page events_handling Handling of user events
///
@@ -419,3 +419,8 @@
} // namespace gnash
#endif // GNASH_MOVIE_ROOT_H
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:
Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- server/vm/ASHandlers.cpp 7 Feb 2007 00:59:59 -0000 1.34
+++ server/vm/ASHandlers.cpp 9 Feb 2007 05:52:49 -0000 1.35
@@ -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.34 2007/02/07 00:59:59 rsavoye Exp $ */
+/* $Id: ASHandlers.cpp,v 1.35 2007/02/09 05:52:49 rsavoye Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -2263,7 +2263,7 @@
env.get_top_index());
#ifdef USE_DEBUGGER
- debugger.addSymbol(&new_obj, classname);
+ debugger.addSymbol(new_obj.to_object(), classname);
#endif
env.drop(nargs);
env.push(new_obj);
@@ -3058,7 +3058,7 @@
env.push_val(function_value);
}
#ifdef USE_DEBUGGER
- debugger.addSymbol(&function_value, name);
+ debugger.addSymbol(function_value.to_object(), name);
#endif
}
@@ -3187,7 +3187,7 @@
//env.set_member(name, function_value);
thread.setVariable(name, function_value);
#ifdef USE_DEBUGGER
- debugger.addSymbol(&function_value, name);
+ debugger.addSymbol(function_value.to_object(), name);
#endif
}
Index: server/vm/VM.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/VM.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/vm/VM.h 6 Dec 2006 10:21:32 -0000 1.4
+++ server/vm/VM.h 9 Feb 2007 05:52:49 -0000 1.5
@@ -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,8 +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_VM_H
#define GNASH_VM_H
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/PropertyList.h server/as...,
Rob Savoye <=