CVSROOT: /sources/gnash Module name: gnash Changes by: Rob Savoye <rsavoye> 08/02/13 02:36:35
Modified files: . : ChangeLog utilities : Makefile.am dumpshm.cpp processor.cpp soldumper.cpp Log message: * utilities/Makefile.am: Add INTLLIB, and actually use AM_LDFLAGS. * utilities/dumpshm.cpp: Drop unused support for accessing POSIX memory as raw files. Normalize output so some things work without -v. Add --version option. Re move unused options left from prior project. * utilities/processor.cpp: Use printf instead of log_msg for --version so we can always see it. * utilities/soldumper.cpp: Add support for --help and --version per GNU standards. Use printf instead of log_msg for --version so we can always see it. Use cout instead of log_msg for all outout so we don't contaminate the main log file. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5630&r2=1.5631 http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/Makefile.am?cvsroot=gnash&r1=1.63&r2=1.64 http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/dumpshm.cpp?cvsroot=gnash&r1=1.23&r2=1.24 http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/processor.cpp?cvsroot=gnash&r1=1.81&r2=1.82 http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/soldumper.cpp?cvsroot=gnash&r1=1.4&r2=1.5 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.5630 retrieving revision 1.5631 diff -u -b -r1.5630 -r1.5631 --- ChangeLog 13 Feb 2008 02:30:06 -0000 1.5630 +++ ChangeLog 13 Feb 2008 02:36:34 -0000 1.5631 @@ -1,5 +1,18 @@ 2008-02-12 Rob Savoye <[EMAIL PROTECTED]> + * utilities/Makefile.am: Add INTLLIB, and actually use + AM_LDFLAGS. + * utilities/dumpshm.cpp: Drop unused support for accessing POSIX + memory as raw files. Normalize output so some things work without + -v. Add --version option. Re move unused options left from prior + project. + * utilities/processor.cpp: Use printf instead of log_msg for + --version so we can always see it. + * utilities/soldumper.cpp: Add support for --help and --version + per GNU standards. Use printf instead of log_msg for --version so + we can always see it. Use cout instead of log_msg for all outout + so we don't contaminate the main log file. + * doc/C/dumpshm-man.xml, gprocessor-man.xml, soldumper-man.xml: New man pages for utilities. * doc/C/asspec/asspec.xml: Update contact info and version. Index: utilities/Makefile.am =================================================================== RCS file: /sources/gnash/gnash/utilities/Makefile.am,v retrieving revision 1.63 retrieving revision 1.64 diff -u -b -r1.63 -r1.64 --- utilities/Makefile.am 1 Feb 2008 05:48:34 -0000 1.63 +++ utilities/Makefile.am 13 Feb 2008 02:36:34 -0000 1.64 @@ -38,6 +38,7 @@ $(LIBXML_LIBS) \ $(FFMPEG_LIBS) \ $(CURL_LIBS) \ + $(INTLLIBS) \ $(BOOST_LIBS) \ $(PTHREAD_LIBS) \ $(NULL) @@ -85,14 +86,14 @@ gprocessor_CPPFLAGS = $(AM_CPPFLAGS) # export our symbols so they can be used by Gnash plugins gprocessor_LDFLAGS = -export-dynamic $(LIBLTDL) -gprocessor_LDADD = $(GNASH_LIBS) +gprocessor_LDADD = $(GNASH_LIBS) $(AM_LDFLAGS) #gprocessor_DEPENDENCIES = dumpshm_SOURCES = dumpshm.cpp -dumpshm_LDADD = $(GNASH_LIBS) +dumpshm_LDADD = $(GNASH_LIBS) $(AM_LDFLAGS) soldumper_SOURCES = soldumper.cpp -soldumper_LDADD = $(GNASH_LIBS) +soldumper_LDADD = $(GNASH_LIBS) $(AM_LDFLAGS) # Rebuild with GCC 4.x Mudflap support mudflap: Index: utilities/dumpshm.cpp =================================================================== RCS file: /sources/gnash/gnash/utilities/dumpshm.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -b -r1.23 -r1.24 --- utilities/dumpshm.cpp 1 Feb 2008 01:30:30 -0000 1.23 +++ utilities/dumpshm.cpp 13 Feb 2008 02:36:34 -0000 1.24 @@ -91,51 +91,49 @@ const int SHM_INFO = 14; #endif -int verbosity = 0; - namespace { gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance(); gnash::RcInitFile& rcfile = gnash::RcInitFile::getDefaultInstance(); } +const char *DUMPSHM_VERSION = "0.5"; + int main(int argc, char *argv[]) { - unsigned int i; int c; - bool dump = false; - bool nuke = false; bool listfiles = false; - bool force = false; bool sysv = false; bool convert = false; int size = 0; string filespec, realname, tmpname; - struct dirent *entry; vector<const char *> dirlist; -// #ifdef __STDC_HOSTED__ -// ostringstream *shmnames; -// #else -// strstream *shmnames; -// #endif - // Enable native language support, i.e. internationalization #ifdef ENABLE_NLS setlocale (LC_MESSAGES, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); #endif - while ((c = getopt (argc, argv, "hdnl:ifrcv")) != -1) { + // scan for the two main standard GNU options + for (c = 0; c < argc; c++) { + if (strcmp("--help", argv[c]) == 0) { + usage(); + exit(0); + } + if (strcmp("--version", argv[c]) == 0) { + printf (_("Gnash dumpshm version: %s, Gnash version: %s\n"), + DUMPSHM_VERSION, VERSION); + exit(0); + } + } + + while ((c = getopt (argc, argv, "hircv")) != -1) { switch (c) { case 'h': usage (); break; - case 'f': - force = true; - break; - case 'r': sysv = true; convert = false; @@ -151,21 +149,9 @@ listfiles = true; break; - case 'd': - dump = true; - break; - - case 'n': - nuke = true; - break; - case 'v': + // turn on verbosity for the libraries dbglogfile.setVerbosity(); - verbosity++; - break; - - case 'l': - size = atoi(optarg); break; default: @@ -219,119 +205,6 @@ } } - DIR *library_dir = NULL; - - // Solaris stores shared memory segments in /var/tmp/.SHMD and - // /tmp/.SHMD. Linux stores them in /dev/shm. - dirlist.push_back("/dev/shm"); - dirlist.push_back("/var/tmp/.SHMD"); - dirlist.push_back("/tmp/.SHMD"); - - // Open the directory where the raw POSIX shared memory files are - for (i=0; i<dirlist.size(); i++) { - library_dir = opendir (dirlist[i]); - if (library_dir != NULL) { - realname = dirlist[i]; - - // By convention, the first two entries in each directory are - // for . and .. (``dot'' and ``dot dot''), so we ignore those. The - // next directory read will get a real file, if any exists. - entry = readdir(library_dir); - entry = readdir(library_dir); - break; - } - } - - // MacOSX, unlike Solaris and Linux doesn't appear to use a file - // based scheme for shared memory segments. In this case, we can't - // analyze the files directly, and are forced to explicitly create - // all the probable names to be deleted. - if (library_dir == NULL || force && nuke) { - // These are the names left by the various test cases. Just - // blindly delete them, because they may not even exist, so - // the errors can be ignored. -#ifdef HAVE_SHM_UNLINK - shm_unlink("/lc_test"); -#endif - exit(0); - } - - //Destroy shared memory segments - if (nuke) { - if (filespec.size() == 0) { - cout << _("No name specified, nuking everything...") << endl; - for (i=0; entry>0; i++) { - entry = readdir(library_dir); - if (entry != NULL) { - tmpname = "/"; // prefix a / so shm_unlink can - // use the correct path - tmpname += entry->d_name; - cout << _("Removing segment: ") << tmpname << endl; -#ifdef HAVE_SHM_UNLINK - shm_unlink(tmpname.c_str()); -#endif - } - } - exit(0); - } else { - cout << _("Nuking the shared memory segment ") << filespec << endl; -#ifdef HAVE_SHM_UNLINK - shm_unlink(filespec.c_str()); -#endif - } - - exit(0); - } - - // Because POSIX shared memory is is file system based, we can - // open the raw file, which lets us analyze it better without the - // potential hassle of memory faults. - ifstream in; -// int offset; - Shm shmptr; - - realname += filespec; - -#if defined(__STDC_HOSTED__) || !defined(__GNUC__) - in.open(realname.c_str(), ios::binary|ios::in); -#else - in.open(realname.c_str(), ios::binary|ios::in|ios::nocreate); -#endif - - if (!in.eof()) { - if (!in.read(reinterpret_cast<char*>(&shmptr), sizeof(Shm))) { - cerr << _("ERROR: couldn't read!") << endl; - exit(1); - } - dump_ctrl(&shmptr); - -// in.read(reinterpret_cast<char*>(mmptr), sizeof(MemManager)); - // This is pretty gross. Because we aren't mapping this segment - // into memory, we splice in the data we first read to the - // proper field in the Memory Manager structure, since it - // references this same data anyway. -// long *tmpptr = reinterpret_cast<long *>(mmptr); -// tmpptr[2] = reinterpret_cast<long>(shmptr); -// mmptr->memControlSet(shmptr); - -// memblks = new MemBlock [mmptr->blockCountGet()]; - // The Memory Block data is a big array of contiguous memory, - // so we figure out it's offset from the front of the file and - // then read from there. -// offset = reinterpret_cast<char*>(mmptr->memBlocksGet()) - -// reinterpret_cast<char*>(shmptr->memAddrGet()); -// in.seekg(offset, ios::beg); -// in.read(reinterpret_cast<char*>(memblks), mmptr->blockCountGet()); -// tmpptr[1] = reinterpret_cast<long>(memblks); -// mmptr->memBlocksSet(memblks); - - } - -// const char *item = shmptr + 40976; -// while (*item != 0) { -// cerr << "Listener: " << item << endl; -// item += strlen(item) + 1; -// } } // Dump the older style SYS V shared memory segments @@ -339,7 +212,6 @@ dump_shm(bool convert, bool out) { // These are here for debugging purposes. It - int id; char *shmaddr; key_t key = rcfile.getLCShmKey(); @@ -351,15 +223,16 @@ #endif } + int size = 64528; // 1007 bytes less than unsigned + if (key == 0) { cerr << "No shared memory segments found!" << endl; return; } -// log_msg("SHM Key 0x%x", key); - - int size = 64528; // 1007 bytes less than unsigned - int flags = 0660 | IPC_CREAT; - int total = 0; + if (dbglogfile.getVerbosity()) { + cout << "Existing SHM Key is: 0x" << hex << key + << ", Size is: " << dec << size << endl; + } LcShm lc; lc.connect(key); @@ -460,14 +333,10 @@ << endl; cerr << _("Usage: dumpmem [hdsanlif] filename") << endl; cerr << _("-h\tHelp") << endl; - cerr << _("-d\tDump data") << endl; - cerr << _("-n [optional name]\tNuke everything") << endl; - cerr << _("-l\tLength of segment") << endl; cerr << _("-i\tList segments") << endl; cerr << _("-r\tDump SYSV segments") << endl; cerr << _("-c\tDump SYSV segments to disk") << endl; cerr << _("-v\tVerbose output") << endl; - cerr << _("-f\tForce to use builtin names for nuke") << endl; exit (-1); } Index: utilities/processor.cpp =================================================================== RCS file: /sources/gnash/gnash/utilities/processor.cpp,v retrieving revision 1.81 retrieving revision 1.82 diff -u -b -r1.81 -r1.82 --- utilities/processor.cpp 21 Jan 2008 23:29:46 -0000 1.81 +++ utilities/processor.cpp 13 Feb 2008 02:36:34 -0000 1.82 @@ -16,7 +16,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: processor.cpp,v 1.81 2008/01/21 23:29:46 rsavoye Exp $ */ +/* $Id: processor.cpp,v 1.82 2008/02/13 02:36:34 rsavoye Exp $ */ #ifdef HAVE_CONFIG_H #include "gnashconfig.h" @@ -153,13 +153,11 @@ for (c = 0; c < argc; c++) { if (strcmp("--help", argv[c]) == 0) { usage(argv[0]); - dbglogfile.removeLog(); exit(0); } if (strcmp("--version", argv[c]) == 0) { - log_msg (_("Gnash gprocessor version: %s, Gnash version: %s"), + printf (_("Gnash gprocessor version: %s, Gnash version: %s\n"), GPROC_VERSION, VERSION); - dbglogfile.removeLog(); exit(0); } } Index: utilities/soldumper.cpp =================================================================== RCS file: /sources/gnash/gnash/utilities/soldumper.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- utilities/soldumper.cpp 21 Jan 2008 23:29:46 -0000 1.4 +++ utilities/soldumper.cpp 13 Feb 2008 02:36:35 -0000 1.5 @@ -49,8 +49,10 @@ gnash::RcInitFile& rcfile = gnash::RcInitFile::getDefaultInstance(); } -static void usage (void); +const char *SOLDUMPER_VERSION = "0.5"; +static void usage (); void dump_ctrl(void *ptr); + int main(int argc, char *argv[]) { @@ -69,6 +71,19 @@ bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); #endif + // scan for the two main standard GNU options + for (c = 0; c < argc; c++) { + if (strcmp("--help", argv[c]) == 0) { + usage(); + exit(0); + } + if (strcmp("--version", argv[c]) == 0) { + printf (_("Gnash soldumper version: %s, Gnash version: %s\n"), + SOLDUMPER_VERSION, VERSION); + exit(0); + } + } + /* This initializes the DBG_MSG macros */ while ((c = getopt (argc, argv, "hvfl")) != -1) { switch (c) { @@ -78,16 +93,16 @@ case 'v': dbglogfile.setVerbosity(); - log_msg (_("Verbose output turned on")); + cout << _("Verbose output turned on") << endl; break; case 'f': - log_msg (_("forcing local directory access only")); + cout << _("forcing local directory access only") << endl; localdir = true; break; case 'l': - log_msg (_("List .sol files in the default directory")); + cout << _("List .sol files in the default directory") << endl; listdir = true; break; @@ -108,7 +123,7 @@ // get the file name from the command line if (optind < argc) { filespec = argv[optind]; - log_msg("Will use \"%s\" for sol files location", filespec.c_str()); + cout << "Will use \"" << filespec << "\" for sol files location" << endl; } // List the .sol files in the default directory @@ -158,9 +173,9 @@ amf::SOL sol; if (sol.readFile(newspec)) { - log_msg("SOL file \"%s\" read in", newspec.c_str()); + cout << "SOL file \"" << newspec << "\" read in" << endl; } else { - log_error("SOL file \"%s\" does not exist!", newspec.c_str()); + cerr << "SOL file \"" << newspec << "\" does not exist!" << endl; } sol.dump(); @@ -168,7 +183,7 @@ /// \brief Display the command line arguments static void -usage (void) +usage () { cerr << _("This program dumps the internal data of a .sol file") << endl; _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit