package.xml0000644000175000017500000022101012147043204012450 0ustar derickderick xdebug pecl.php.net Provides functions for function traces and profiling The Xdebug extension helps you debugging your script by providing a lot of valuable debug information. The debug information that Xdebug can provide includes the following: * stack and function traces in error messages with: o full parameter display for user defined functions o function name, file name and line indications o support for member functions * memory allocation * protection for infinite recursions Xdebug also provides: * profiling information for PHP scripts * code coverage analysis * capabilities to debug your scripts interactively with a debug client Derick Rethans derick derick@xdebug.org yes 2013-05-22 2.2.3 2.2.3 stable stable BSD style Tue, May 21, 2013 - xdebug 2.2.3 + Added features: - Support for PHP 5.5. = Fixed bugs: - Fixed bug #923: Xdebug + Netbeans + ext/MongoDB crash on MongoCursor instance - Fixed bug #929: Directory name management in xdebug.profiler_output_dir - Fixed bug #931: xdebug_str_add does not check for NULL str before calling strlen on it - Fixed bug #935: Document the return value from xdebug_get_code_coverage() - Fixed bug #947: Newlines converted when html_errors = 0 5.1.0 1.4.0b1 xdebug 2013-03-23 2.2.2 2.2.2 stable stable BSD style Sat, Mar 23, 2013 - xdebug 2.2.2 + Added features: - Support for PHP 5.5. = Fixed bugs: - Fixed bug #598: Use HTTP_X_FORWARDED_FOR to determine remote debugger. - Fixed bug #625: xdebug_get_headers() -> Headers are reset unexpectedly. - Fixed bug #811: PHP Documentation Link. - Fixed bug #818: Require a php script in the PHP_RINIT causes Xdebug to crash. - Fixed bug #903: xdebug_get_headers() returns replaced headers. - Fixed bug #905: Support PHP 5.5 and generators. - Fixed bug #920: AM_CONFIG_HEADER is depreciated. 2.2.1 2.2.1 stable stable 2012-07-14 BSD style = Fixed bugs: - Fixed bug #843: Text output depends on php locale. - Fixed bug #838/#839/#840: Debugging static properties crashes Xdebug. - Fixed bug #821: Variable assignments (beginning with =>) should be indented one more scope. - Fixed bug #811: PHP Documentation Link. - Fixed bug #800: var_dump(get_class(new foo\bar')) add an extra "\" in class name. 2.2.0 2.2.0 stable stable 2012-05-08 BSD style Tue, May 08, 2012 - xdebug 2.2.0 + Added features: - Support for PHP 5.4. - Added ANSI colour output for the shell. (Including patches by Michael Maclean) - Added var_dump() overloading on the command line (issue #457). - Added better support for closures in stack and function traces. - Added the size of arrays to the overloaded variable output, so that you know how many elements there are. - Added support for X-HTTP-FORWARDED-FOR before falling back to REMOTE_ADDR (issue #660). (Patch by Hannes Magnusson) - Added the method call type to xdebug_get_function_stack() (issue #695). - Added extra information to error printouts to tell that the error suppression operator has been ignored due to xdebug.scream. - Added a error-specific CSS class to stack traces. + New settings: - xdebug.cli_color for colouring output on the command line (Unix only). - Added xdebug.trace_enable_trigger to triger function traces through a GET/POST/COOKIE parameter (issue #517). (Patch by Patrick Allaert) - Added support for the 'U' format specifier for function trace and profiler filenames. + Changes: - Improved performance by lazy-initializing data structures. - Improved code coverage performance. (Including some patches by Taavi Burns) - Improved compatibility with KCacheGrind. - Improved logging of remote debugging connections, by added connection success/failure logging to the xdebug.remote_log functionality. = Fixed bugs: - Fixed bug #827: Enabling Xdebug causes phpt tests to fail because of var_dump() formatting issues. - Fixed bug #823: Single quotes are escaped in var_dumped string output. - Fixed issue #819: Xdebug 2.2.0RC2 can't stand on a breakpoint more than 30 seconds. - Fixed bug #801: Segfault with streamwrapper and unclosed $fp on destruction. - Fixed issue #797: Xdebug crashes when fetching static properties. - Fixed bug #794: Allow coloured output on Windows. - Fixed bug #784: Unlimited feature for var_display_max_data and var_display_max_depth is undocumented. - Fixed bug #774: Apache crashes on header() calls. - Fixed bug #764: Tailored Installation instructions do not work. - Fixed bug #758: php_value xdebug.idekey is ignored in .htaccess files - Fixed bug #728: Profiler reports __call() invocations confusingly/wrongly. - Fixed bug #687: Xdebug does not show dynamically defined variable. - Fixed bug #662: idekey is set to running user. - Fixed bug #627: Added the realpath check. 2.2.0RC2 2.2.0RC2 stable stable 2012-04-22 BSD style Tue, Apr 22, 2012 - xdebug 2.2.0rc2 = Fixed bugs: - Fixed bug #801: Segfault with streamwrapper and unclosed $fp on destruction. - Fixed bug #794: Allow coloured output on Windows. - Fixed bug #784: Unlimited feature for var_display_max_data and var_display_max_depth is undocumented. - Fixed bug #774: Apache crashes on header() calls. - Fixed bug #764: Tailored Installation instructions do not work. - Fixed bug #758: php_value xdebug.idekey is ignored in .htaccess files - Fixed bug #662: idekey is set to running user. 2.2.0RC1 2.2.0RC1 stable stable 2012-03-12 BSD style Tue, Mar 13, 2012 - xdebug 2.2.0rc1 + Added features: - Support for PHP 5.4. - Added ANSI colour output for the shell. (Including patches by Michael Maclean) - Added var_dump() overloading on the command line (issue #457). - Added better support for closures in stack and function traces. - Added the size of arrays to the overloaded variable output, so that you know how many elements there are. - Added support for X-HTTP-FORWARDED-FOR before falling back to REMOTE_ADDR (issue #660). (Patch by Hannes Magnusson) - Added the method call type to xdebug_get_function_stack() (issue #695). - Added extra information to error printouts to tell that the error suppression operator has been ignored due to xdebug.scream. - Added a error-specific CSS class to stack traces. + New settings: - xdebug.cli_color for colouring output on the command line (Unix only). - Added xdebug.trace_enable_trigger to triger function traces through a GET/POST/COOKIE parameter (issue #517). (Patch by Patrick Allaert) - Added support for the 'U' format specifier for function trace and profiler filenames. + Changes: - Improved performance by lazy-initializing data structures. - Improved code coverage performance. (Including some patches by Taavi Burns) - Improved compatibility with KCacheGrind. - Improved logging of remote debugging connections, by added connection success/failure logging to the xdebug.remote_log functionality. = Fixed bugs: - No additional bug fixes besides the ones from the 2.1 branch up til Xdebug 2.1.4. 2.1.4 2.1.4 stable stable 2012-03-12 BSD style = Fixed bugs: - Fixed bug #788: Collect errors eats fatal errors. - Fixed bug #787: Segmentation Fault with PHP header_remove(). - Fixed bug #778: Xdebug session in Eclipse crash whenever it run into simplexml_load_string call. - Fixed bug #756: Added support for ZEND_*_*_OBJ and self::*. - Fixed bug #747: Still problem with error message and soap client / soap server. - Fixed bug #744: new lines in a PHP file from Windows are displayed with an extra white line with var_dump(). - Fixed an issue with debugging and the eval command. - Fixed compilation with ZTS on PHP < 5.3 2.1.3 2.1.3 stable stable 2012-01-25 BSD style = Fixed bugs: - Fixed bug #725: EG(current_execute_data) is not checked in xdebug.c, xdebug_statement_call. - Fixed bug #723: xdebug is stricter than PHP regarding Exception property types. - Fixed bug #714: Cachegrind files have huge (wrong) numbers in some lines. - Fixed bug #709: Xdebug doesn't understand E_USER_DEPRECATED. - Fixed bug #698: Allow xdebug.remote_connect_back to be set in .htaccess. - Fixed bug #690: Function traces are not appended to file with xdebug_start_trace() and xdebug.trace_options=1. - Fixed bug #623: Static properties of a class can be evaluated only with difficulty. - Fixed bug #614/#619: Viewing private variables in base classes through the debugger. - Fixed bug #609: Xdebug and SOAP extension's error handlers conflict. - Fixed bug #606/#678/#688/#689/#704: crash after using eval on an unparsable, or un-executable statement. - Fixed bug #305: xdebug exception handler doesn't properly handle special chars. + Changes: - Changed xdebug_break() to hint to the statement execution trap instead of breaking forcefully adding an extra stackframe. - Prevent Xdebug 2.1.x to build with PHP 5.4. 2.1.2 2.1.2 stable stable 2011-07-28 BSD style = Fixed bugs: - Fixed bug #622: Working with eval() code is inconvenient and difficult. - Fixed bug #684: xdebug_var_dump - IE does not support &. - Fixed bug #693: Cachegrind files not written when filename is very long. - Fixed bug #697: Incorrect code coverage of function arguments when using XDEBUG_CC_UNUSED. - Fixed bug #699: Xdebug gets the filename wrong for the countable interface. - Fixed bug #703 by adding another opcode to the list that needs to be overridden. 2.1.2 2.1.2 stable stable 2011-07-28 BSD style = Fixed bugs: - Fixed bug #622: Working with eval() code is inconvenient and difficult. - Fixed bug #684: xdebug_var_dump - IE does not support &. - Fixed bug #693: Cachegrind files not written when filename is very long. - Fixed bug #697: Incorrect code coverage of function arguments when using XDEBUG_CC_UNUSED. - Fixed bug #699: Xdebug gets the filename wrong for the countable interface. - Fixed bug #703 by adding another opcode to the list that needs to be overridden. 2.1.1 2.1.1 stable stable 2011-03-28 BSD style Mon, Mar 28, 2011 - xdebug 2.1.1 = Fixed bugs: - Fixed ZTS compilation. 2.1.1RC1 2.1.1RC1 beta beta 2011-03-22 BSD style Tue, Mar 22, 2011 - xdebug 2.1.1rc1 = Fixed bugs: = Debugger - Fixed bug #518: Removed CLASSNAME pseudo-property optional. - Fixed bug #592: Xdebug crashes with run after detach. - Fixed bug #596: Call breakpoint never works with instance methods, only static methods. - Fixed JIT mode in the debugger so that it works for xdebug_break() too. = Profiler - Fixed bug #631: Summary not written when script ended with "exit()". - Fixed bug #639: Xdebug profiling: output not correct - missing 'cfl='. - Fixed bug #642: Fixed line numbers for offsetGet, offsetSet, __get/__set/__isset/__unset and __call in profile files and stack traces/function traces. - Fixed bug #643: Profiler gets line numbers wrong. - Fixed bug #653: XDebug profiler crashes with %H in file name and non standard port. = Others - Fixed bug #651: Incorrect code coverage after empty() in conditional. - Fixed bug #654: Xdebug hides error message in CLI. - Fixed bug #665: Xdebug does not respect display_errors=stderr. Patch by Ben Spencer <dangerous.ben@gmail.com> - Fixed bug #670: Xdebug crashes with broken "break x" code. 2.1.0 2.1.0 stable stable 2010-06-29 BSD style Tue, Jun 29, 2010 - xdebug 2.1.0 = Fixed bugs: - Fixed bug #562: Incorrect coverage information for closure function headers. - Fixed bug #566: Xdebug crashes when using conditional breakpoints. - Fixed bug #567: xdebug_debug_zval and xdebug_debug_zval_stdout don't work with PHP 5.3. (Patch by Endo Hiroaki). - Fixed bug #570: undefined symbol: zend_memrchr. 2.1.0RC1 2.1.0RC1 beta beta 2010-02-27 BSD style Thu, Apr 06, 2010 - xdebug 2.1.0rc1 = Fixed bugs: - Fixed bug #494: Private attributes of parent class unavailable when inheriting. - Fixed bug #400: Xdebug shows errors, even when PHP is request startup mode. - Fixed bug #421: xdebug sends back invalid characters in xml sometimes. - Fixed bug #475: Property names with null chars are not sent fully to the client. - Fixed bug #480: Issues with the reserved resource in multi threaded environments (Patch by Francis.Grolemund@netapp.com). - Fixed bug #558: PHP segfaults when running a nested eval. 2.1.0beta3 2.1.0beta3 beta beta 2010-02-27 BSD style Sat, Feb 27, 2010 - xdebug 2.1.0beta3 = Fixed bugs: - Fixed memory corruption issues. - Fixed a threading related issue for code-coverage. - Fixed bug #532: XDebug breaks header() function. - DBGP: Prevent Xdebug from returning properties when a too high page number has been requested. 2.1.0beta2 2.1.0beta2 beta beta 2010-02-03 BSD style Wed, Feb 03, 2010 - xdebug 2.1.0beta2 = Fixed bugs: - Fixed memory leak in breakpoint handling. - Fixed bug #528: Core dump generated with remote_connect_back option set and CLI usage. - Fixed bug #515: declare(ticks) statement confuses code coverage. - Fixed bug #512: DBGP: breakpoint_get doesn't return conditions in its response. - Possible fix for bug #507/#517: Crashes because of uninitalised header globals. - Fixed bug #501: Xdebug's variable tracing misses POST_INC and variants. 2.1.0beta1 2.1.0beta1 beta beta 2010-01-03 BSD style Sun, Jan 03, 2010 - xdebug 2.1.0beta1 + Added features: - Added error display collection and suppressions. - Added the recording of headers being set in scripts. - Added variable assignment tracing. - Added the ability to turn of the default overriding of var_dump(). - Added "Scream" support, which disables the @ operator. - Added a trace-file analysing script. - Added support for debugging into phars. - Added a default xdebug.ini. (Patch by Martin Schuhfuß <martins@spot-media.de>) - Added function parameters in computerized function traces. - PHP 5.3 compatibility. - Improved code coverage accuracy. + New functions: - xdebug_get_formatted_function_stack(), which returns a formatted function stack instead of displaying it. - xdebug_get_headers(), which returns all headers that have been set in a script, both explicitly with things like header(), but also implicitly for things like setcookie(). - xdebug_start_error_collection(), xdebug_stop_error_collection() and xdebug_get_collected_errors(), which allow you to collect all notices, warnings and error messages that Xdebug generates from PHP's error_reporting functionality so that you can output them at a later point in your script by hand. + New settings: - xdebug.collect_assignments, which enables the emitting of variable assignments in function traces. - xdebug.file_line_format, to generate a link with a specific format for every filename that Xdebug outputs. - xdebug.overload_var_dump, which allows you to turn off Xdebug's version of var_dump(). - xdebug.remote_cookie_expire_time, that controls the length of a remote debugging session. (Patch by Rick Pannen <pannen@gmail.com>) - xdebug.scream, which makes the @ operator to be ignored. + Changes: - Added return values for xdebug_start_code_coverage() and xdebug_stop_code_coverage() to indicate whether the action was succesfull. xdebug_start_code_coverage() will return TRUE if the call enabled code coverage, and FALSE if it was already enabled. xdebug_stop_code_coverage() will return FALSE when code coverage wasn't started yet and TRUE if it was turned on. - Added an optional argument to xdebug_print_function_stack() to display your own message. (Patch by Mikko Koppanen). - All HTML output as generated by Xdebug now has a HTML "class" attribute for easy CSS formatting. - Removed features: - Support for PHP versions lower than PHP 5.1 have been dropped. - The PHP3 and GDB debugger engines have been removed. = Fixed bugs: - Fixed support for showing $this in remote debugging sessions. - Fixed bug in formatting the display of "Variables in the local scope". - Possible fix for a threading issue where the headers gathering function would create stack overflows. - Possible fix for #324: xdebug_dump_superglobals() only dumps superglobals that were accessed before, and #478: XDebug 2.0.x can't use %R in xdebug.profiler_output_name if register_long_arrays is off. - Fixed bug #505: %s in xdebug.trace_output_name breaks functions traces. - Fixed bug #494: Private attributes of parent class unavailable when inheriting. - Fixed bug #486: feature_get -n breakpoint_types returns out of date list. - Fixed bug #476: Xdebug doesn't support PHP 5.3's exception chaining. - Fixed bug #472: Dead Code Analysis for code coverage messed up after goto. - Fixed bug #470: Catch blocks marked as dead code unless executed. - Fixed bug #469: context_get for function variables always appear as "uninitialized". - Fixed bug #468: Property_get on $GLOBALS works only at top-level, by adding GLOBALS to the super globals context. - Fixed bug #453: Memory leaks. - Fixed bug #445: error_prepend_string and error_append_string are ignored by xdebug_error_cb. (Patch by Kent Davidson <kent@marketruler.com>) - Fixed bug #442: configure: error: "you have strange libedit". - Fixed bug #439: Xdebug crash in xdebug_header_handler. - Fixed bug #423: Conflicts with funcall. - Fixed bug #419: Make use of P_tmpdir if defined instead of hard coded '/tmp'. - Fixed bug #417: Response of context_get may lack page and pagesize attributes. - Fixed bug #411: Class/function breakpoint setting does not follow the specs. - Fixed bug #393: eval returns array data at the previous page request. - Fixed bug #391: Xdebug doesn't stop executing script on catchable fatal errors. - Fixed bug #389: Destructors called on fatal error. - Fixed bug #368: Xdebug's debugger bails out on a parse error with the eval command. - Fixed bug #356: Temporary breakpoints persist. - Fixed bug #355: Function numbers in trace files weren't unique. - Fixed bug #340: Segfault while throwing an Exception. - Fixed bug #328: Private properties are incorrectly enumerated in case of extended classes. - Fixed bug #249: Xdebug's error handler messes up with the SOAP extension's error handler. + DBGP: - Fixed cases where private properties where shown for objects, but not accessible. - Added a patch by Lucas Nealan (lucas@php.net) and Brian Shire (shire@php.net) of Facebook to allow connections to the initiating request's IP address for remote debugging. - Added the -p argument to the eval command as well, pending inclusion into DBGP. - Added the retrieval of a file's execution lines. I added a new un-official method called xcmd_get_executable_lines which requires the stack depth as argument (-d). You can only fetch this information for stack frames as it needs an available op-array which is only available when a function is executed. - Added a fake "CLASSNAME" property to objects that are returned in debug requests to facilitate deficiencies in IDEs that fail to show the "classname" XML attribute. 2.0.5 2.0.5 stable stable 2009-07-03 BSD style Fri, Jul 03, 2009 - xdebug 2.0.5 = Fixed bugs: - Fixed bug #425: memory leak (around 40MB for each request) when using xdebug_start_trace. - Fixed bug #422: Segfaults when using code coverage with a parse error in the script. - Fixed bug #418: compilation breaks with CodeWarrior for NetWare. - Fixed bug #403: 'call' and 'return' breakpoints triggers both on call and return for class method breakpoints. - Fixed TSRM issues for PHP 5.2 and PHP 5.3. (Original patch by Elizabeth M. Smith). - Fixed odd crash bugs, due to GCC 4 sensitivity. 2.0.4 2.0.4 stable stable 2008-12-30 BSD style Tue, Dec 30, 2008 - xdebug 2.0.4 = Fixed bugs: - Fixed for strange jump positions in path analysis. - Fixed issues with code coverage crashing on parse errors. - Fixed code code coverage by overriding more opcodes. - Fixed issues with Xdebug stalling/crashing when detaching from remote debugging. - Fixed crash on Vista where memory was freed with routines from a different standard-C library than it was allocated with. (Patch by Eric Promislow <ericp@activestate.com>). - Link against the correct CRT library. (Patch by Eric Promislow <ericp@activestate.com>). - Sort the symbol elements according to name. (Patch by Eric Promislow <ericp@activestate.com>). - Fixed support for mapped-drive UNC paths for Windows. (Patch by Eric Promislow <ericp@activestate.com>). - Fixed a segfault in interactive mode while including a file. - Fixed a crash in super global dumping in case somebody was strange enough to reassign them to a value type other than an Array. - Simplify version checking for libtool. (Patch by PGNet <pgnet.trash@gmail.com>). - Fixed display of unused returned variables from functions in PHP 5.3. - Include config.w32 in the packages as well. - Fixed .dsp for building with PHP 4. + Added features: - Support debugging into phars. - Basic PHP 5.3 support. 2.0.3 2.0.3 stable stable 2008-04-09 BSD style Wed, Apr 09, 2008 - xdebug 2.0.3 = Fixed bugs: - Fixed bug #338: Crash with: xdebug.remote_handler=req. - Fixed bug #334: Code Coverage Regressions. - Fixed abstract method detection for PHP 5.3. - Fixed code coverage dead-code detection. - Ignore ZEND_ADD_INTERFACE, which is on a different line in PHP >= 5.3 for some weird reason. + Changes: - Added a CSS-class for xdebug's var_dump(). - Added support for the new E_DEPRECATED. 2.0.2 2.0.2 stable stable 2007-11-11 BSD style Sun, Nov 11, 2007 - xdebug 2.0.2 = Fixed bugs: - Fixed bug #325: DBGP: "detach" stops further sessions being established from Apache. - Fixed bug #321: Code coverage crashes on empty PHP files. - Fixed bug #318: Segmentation Fault in code coverage analysis. - Fixed bug #315: Xdebug crashes when including a file that doesn't exist. - Fixed bug #314: PHP CLI Error Logging thwarted when XDebug Loaded. - Fixed bug #300: Direction of var_dump(). - Always set the transaction_id and command. (Related to bug #313). 2.0.1 2.0.1 stable stable 2007-10-29 BSD style Sat, Oct 20, 2007 - xdebug 2.0.1 + Changes: - Improved code coverage performance dramatically. - PHP 5.3 compatibility (no namespaces yet though). = Fixed bugs: - Fixed bug #301: Loading would cause SIGBUS on Solaris 10 SPARC. (Patch by Sean Chalmers) - Fixed bug #300: Xdebug does not force LTR rendering for its tables. - Fixed bug #299: Computerized traces don't have a newline for return entries if memory limit is not enabled. - Fixed bug #298: xdebug_var_dump() doesn't handle entity replacements correctly concerning string length. - Fixed a memory free error related to remote debugging conditions. (Related to bug #297). 2.0.0 2.0.0 stable stable 2007-07-18 BSD style Wed, Jul 18, 2007 - xdebug 2.0.0 + Changes: - Put back the disabling of stack traces - apperently people were relying on this. This brings back xdebug_enable(), xdebug_disable() and xdebug_is_enabled(). - xdebug.collect_params is no longer a boolean setting. Although it worked fine, phpinfo() showed only just On or Off here. - Fixed the Xdebug version of raw_url_encode to not encode : and \. This is not necessary according to the RFCs and it makes debug breakpoints work on Windows. = Fixed bugs: - Fixed bug #291: Tests that use SPL do not skip when SPL is not available. - Fixed bug #290: Function calls leak memory. - Fixed bug #289: Xdebug terminates connection when eval() is run in the init stage. - Fixed bug #284: Step_over on breakpointed line made Xdebug break twice. - Fixed bug #283: Xdebug always returns $this with the value of last stack frame. - Fixed bug #282: %s is not usable for xdebug.profiler_output_name on Windows in all stack frames. - Fixed bug #280: var_dump() doesn't display key of array as expected. - Fixed bug #278: Code Coverage Issue. - Fixed bug #273: Remote debugging: context_get does not return context id. - Fixed bug #270: Debugger aborts when PHP's eval() is encountered. - Fixed bug #265: XDebug breaks error_get_last() . - Fixed bug #261: Code coverage issues by overloading zend_assign_dim. + DBGP: - Added support for "breakpoint_languages". 2.0.0RC4 2.0.0RC4 beta beta 2007-05-17 BSD style Wed, May 17, 2007 - xdebug 2.0.0rc4 + Changes: - Use µ seconds instead of a tenths of µ seconds to avoid confusion in profile information. - Changed xdebug.profiler_output_name and xdebug.trace_output_name to use modifier tags: %c = crc32 of the current working directory %p = pid %r = random number %s = script name %t = timestamp (seconds) %u = timestamp (microseconds) %H = $_SERVER['HTTP_HOST'] %R = $_SERVER['REQUEST_URI'] %S = session_id (from $_COOKIE if set) %% = literal % = Fixed bugs: - Fixed bug #255: Call Stack Table doesn't show Location on Windows. - Fixed bug #251: Using the source command with an invalid filename returns unexpected result. - Fixed bug #243: show_exception_trace="0" ignored. - Fixed bug #241: Crash in xdebug_get_function_stack(). - Fixed bug #240: Crash with xdebug.remote_log on Windows. - Fixed a segfault in rendering stack traces to error logs. - Fixed a bug that prevented variable names from being recorded for remote debug session while xdebug.collect_vars was turned off. - Fixed xdebug_dump_superglobals() in case no super globals were configured. - Removed functions: - Removed support for Memory profiling as that didn't work properly. - Get rid of xdebug.default_enable setting and associated functions: xdebug_disable() and xdebug_enable(). + Added features: - Implemented support for four different xdebug.collect_params settings for stack traces and function traces. - Allow to trigger profiling by the XDEBUG_PROFILE cookie. + DBGP: - Correctly add namespace definitions to XML. - Added the xdebug namespace that adds extra information to breakpoints if available. - Stopped the use of >error> elements for exception breakpoints, as that violates the protocol. 2.0.0RC3 2.0.0RC3 beta beta 2007-01-31 BSD style Wed, Jan 31, 2007 - xdebug 2.0.0rc3 + Changes: - Removed the bogus "xdebug.allowed_clients" setting - it was not implemented. - Optimized used variable collection by switching to a linked list instead of a hash. This is about 30% faster, but it needed a quick conversion to hash in the case the information had to be shown to remove duplicate variable names. = Fixed bugs: - Fixed bug #232: PHP log_errors functionality lost after enabling xdebug error handler when CLI is used. - Fixed problems with opening files - the filename could cause double free issues. - Fixed memory tracking as memory_limit is always enabled in PHP 5.2.1 and later. - Fixed a segfault that occurred when creating printable stack traces and collect_params was turned off. 2.0.0RC2 2.0.0RC2 beta beta 2006-12-24 BSD style Sun, Dec 24, 2006 - xdebug 2.0.0rc2 + Added new features: - Implemented the "xdebug.var_display_max_children" setting. The default is set to 128 children. - Added types to fancy var dumping function. - Implemented FR #210: Add a way to stop the debug session without having to execute a script. The GET/POST parameter "XDEBUG_SESSION_STOP_NO_EXEC" works in the same way as XDEBUG_SESSION_STOP, except that the script will not be executed. - DBGP: Allow postmortem analysis. - DBGP: Added the non-standard function xcmd_profiler_name_get. + Changes: - Fixed the issue where xdebug_get_declared_vars() did not know about variables there are in the declared function header, but were not used in the code. Due to this change expected arguments that were not send to a function will now show up as ??? in stack and function traces in PHP 5.1 and PHP 5.2. - Allow xdebug.var_display_max_data and xdebug.var_display_max_depth settings of -1 which will unlimit those settings. - DBGP: Sort super globals in Globals overview. - DBGP: Fixed a bug where error messages where not added upon errors in the protocol. - DBGP: Change context 1 from globals (superglobals + vars in bottom most stack frame) to just superglobals. = Fixed bugs: - Fixed linking error on AIX by adding libm. - Fixed dead code analysis for THROW. - Fixed oparray prefill caching for code coverage. - Fixed the xdebug.remote_log feature work. - DBGP: Fixed a bug where $this did not appear in the local scoped context. - DBGP: Reimplemented property_set to use the same symbol fetching function as property_get. We now only use eval in case no type (-t) argument was given. - DBGP: Fixed some issues with finding out the classname, which is important for fetching private properties. - DBGP: Fixed usage of uninitialized memory that prevented looking up numerical array keys while fetching array elements not work properly. - Fixed bug #228: Binary safety for stream output and property fetches. - Fixed bug #227: The SESSION super global does not show up in the Globals scope. - Fixed bug #225: xdebug dumps core when protocol is GDB. - Fixed bug #224: Compile failure on Solaris. - Fixed bug #219: Memory usage delta in traces don't work on PHP 5.2.0. - Fixed bug #215: Cannot retrieve nested arrays when the array key is a numeric index. - Fixed bug #214: The depth level of arrays was incorrectly checked so it would show the first page of a level too deep as well. - Fixed bug #213: Dead code analysis doesn't take catches for throws into account. - Fixed bug #211: When starting a new session with a different idekey, the cookie is not updated. - Fixed bug #209: Additional remote debugging session started when triggering shutdown function. - Fixed bug #208: Socket connection attempted when XDEBUG_SESSION_STOP. - Fixed PECL bug #8989: Compile error with PHP 5 and GCC 2.95. 2.0.0rc1 2.0.0rc1 beta beta 2006-10-08 BSD style + Added new features: - Implemented FR #70: Provide optional depth on xdebug_call_* functions. - Partially implemented FR #50: Resource limiting for variable display. By default only two levels of nested variables and max string lengths of 512 are shown. This can be changed by setting the ini settings xdebug.var_display_max_depth and xdebug.var_display_max_data. - Implemented breakpoints for different types of PHP errors. You can now set an 'exception' breakpoint on "Fatal error", "Warning", "Notice" etc. This is related to bug #187. - Added the xdebug_print_function_trace() function to display a stack trace on demand. - Reintroduce HTML tracing by adding a new tracing option "XDEBUG_TRACE_HTML" (4). - Made xdebug_stop_trace() return the trace file name, so that the following works: <?php echo file_get_contents( xdebug_stop_trace() ); ?> - Added the xdebug.collect_vars setting to tell Xdebug to collect information about which variables are used in a scope. Now you don't need to show variables with xdebug.show_local_vars anymore for xdebug_get_declared_vars() to work. - Make the filename parameter to the xdebug_start_trace() function optional. If left empty it will use the same algorithm to pick a filename as when you are using the xdebug.auto_trace setting. + Changes: - Implemented dead code analysis during code coverage for: * abstract methods. * dead code after return, throw and exit. * implicit returns when a normal return is present. - Improved readability of stack traces. - Use PG(html_errors) instead of checking whether we run with CLI when deciding when to use HTML messages or plain text messages. = Fixed bugs: - Fixed bug #203: PHP errors with HTML content processed incorrectly. This patch backs out the change that was made to fix bug #182. - Fixed bug #198: Segfault when trying to use a non-existing debug handler. - Fixed bug #197: Race condition fixes created too many files. - Fixed bug #196: Profile timing on Windows does not work. - Fixed bug #195: CLI Error after debugging session. - Fixed bug #193: Compile problems with PHP 5.2. - Fixed bug #191: File/line breakpoints are case-sensitive on Windows. - Fixed bug #181: Xdebug doesn't handle uncaught exception output correctly. - Fixed bug #173: Coverage produces wrong coverage. - Fixed a typo that prevented the XDEBUG_CONFIG option "profiler_enable" from working. 2.0.0beta6 2.0.0beta6 beta beta 2006-06-30 BSD style + Added new features: - Implemented FR #137: feature_get for general commands doesn't have a text field. - Implemented FR #131: XDebug needs to implement paged child object requests. - Implemented FR #124: Add backtrace dumping information when exception thrown. - Implemented FR #70: Add feature_get breakpoint_types. - Added profiling aggregation functions (patch by Andrei Zmievski) - Implemented the "timestamp" option for the xdebug.trace_output_name and xdebug.profiler_output_name settings. - Added the xdebug.remote_log setting that allows you to log debugger communication to a log file for debugging. This can also be set through the "remote_log" element in the XDEBUG_CONFIG environment variable. - Added a "script" value to the profiler_output_name option. This will write the profiler output to a filename that consists of the script's full path (using underscores). ie: /var/www/index.php becomes var_www_index_php_cachegrind.out. (Patch by Brian Shire). - DBGp: Implemented support for hit conditions for breakpoints. - DBGp: Added support for conditions for file/line breakpoints. - DBGp: Added support for hit value checking to file/line breakpoints. - DBGp: Added support for "exception" breakpoints. + Performance improvements: - Added a cache that prevents the code coverage functionality from running a "which code is executable check" on every function call, even if they were executed multiple times. This should speed up code coverage a lot. - Speedup Xdebug but only gathering information about variables in scopes when either remote debugging is used, or show_local_vars is enabled. = Fixed bugs: - Fixed bug #184: problem with control chars in code traces - Fixed bug #183: property_get -n $this->somethingnonexistent crashes the debugger. - Fixed bug #182: Errors are not html escaped when being displayed. - Fixed bug #180: collected includes not shown in trace files. (Patch by Cristian Rodriguez) - Fixed bug #178: $php_errormsg and Track errors unavailable. - Fixed bug #177: debugclient fails to compile due to Bison. - Fixed bug #176: Segfault using SplTempFileObject. - Fixed bug #173: Xdebug segfaults using SPL ArrayIterator. - Fixed bug #171: set_time_limit stack overflow on 2nd request. - Fixed bug #168: Xdebug's DBGp crashes on an eval command where the result is an array. - Fixed bug #125: show_mem_delta does not calculate correct negative values on 64bit machines. - Fixed bug #121: property_get -n $r[2] returns the whole hash. - Fixed bug #111: xdebug does not ignore set_time_limit() function during debug session. - Fixed bug #87: Warning about headers when "register_shutdown_function" used. - Fixed PECL bug #6940 (XDebug ignores set_time_limit) - Fixed Komodo bug 45484: no member data for objects in PHP debugger. - Suppress NOP/EXT_NOP from being marked as executable code with Code Coverage. 2.0.0beta5 2.0.0beta5 beta beta 2005-12-31 BSD style + Added new features: - Implemented FR #161: var_dump doesn't show lengths for strings. - Implemented FR #158: Function calls from the {main} scope always have the line number 0. - Implemented FR #156: it's impossible to know the time taken by the last func call in xdebug trace mode 0. - Implemented FR #153: xdebug_get_declared_vars(). = Fixed bugs: - Fixed shutdown crash with ZTS on Win32 - Fixed bad memory leak when a E_ERROR of exceeding memory_limit was thrown. - Fixed bug #154: GCC 4.0.2 optimizes too much out with -O2. - Fixed bug #141: Remote context_get causes segfault. 2.0.0beta4 2.0.0beta4 beta beta 2005-09-24 BSD style + Added new features: - Added xdebug_debug_zval_stdout(). - Added xdebug_get_profile_filename() function which returns the current profiler dump file. - Updated for latest 5.1 and 6.0 CVS versions of PHP. - Added FR #148: Option to append to cachegrind files, instead of overwriting. - Implemented FR #114: Rename tests/*.php to tests/*.inc - Changed features: - Allow "xdebug.default_enable" to be set everywhere. = Fixed bugs: - DBGP: Xdebug should return "array" with property get, which is defined in the typemap to the common type "hash". - Fixed bug #142: xdebug crashes with implicit destructor calls. - Fixed bug #136: The "type" attribute is missing from stack_get returns. - Fixed bug #133: PHP scripts exits with 0 on PHP error. - Fixed bug #132: use of eval causes a segmentation fault. 2.0.0beta3 2.0.0beta3 beta beta 2005-05-12 BSD style + Added new features: - Added the possibility to trigger the profiler by setting "xdebug.profiler_enable_trigger" to 1 and using XDEBUG_PROFILE as a get parameter. = Fixed bugs: - Fixed a segfault for when an attribute value is NULL on XML string generation. - Fixed bug #118: Segfault with exception when remote debugging. - Fixed bug #117: var_dump dows not work with "private". - Fixed bug #109: DBGP's eval will abort the script when the eval statement is invalid. - Fixed bug #108: log_only still displays some text for errors in included files. - Fixed bug #107: Code Coverage only detects executable code in used functions and classes. - Fixed bug #103: crash when running the DBGp command 'eval' on a global variable - Fixed bug #95: Segfault when deinitializing Xdebug module. (Patch by Maxim Poltarak <demiurg@gmail.com>) 2.0.0beta2 2.0.0beta2 beta beta 2004-11-28 BSD style + Added new features: - DBGP: Added error messages to returned errors (in most cases) + Added new functions: - xdebug_debug_zval() to debug zvals by printing its refcounts and is_ref values. = Changed features: - xdebug_code_coverage_stop() will now clean up the code coverage array, unless you specify FALSE as parameter. - The proper Xdebug type is "hash" for associative arrays. - Extended the code-coverage functionality by returning lines with executable code on them, but where not executed with a count value of -1. = Fixed bugs: - DBGP: Make property_get and property_value finally work as they should, including retrieving information from different depths then the most top stack frame. - DBGP: Fix eval'ed $varnames in property_get. - DBGP: Support the -d option for property_get. - Fixed the exit handler hook to use the new "5.1" way of handling it; which fortunately also works with PHP 5.0. - Fixed bug #102: Problems with configure for automake 1.8. - Fixed bug #101: crash with set_exeception_handler() and uncatched exceptions. - Fixed bug #99: unset variables return the name as a string with property_get. - Fixed bug #98: 'longname' attribute not returned for unintialized property in context_get request. - Fixed bug #94: xdebug_sprintf misbehaves with x86_64/glibc-2.3.3 - Fixed bug #93: Crash in lookup_hostname on x86_64 - Fixed bug #92: xdebug_disable() doesn't disable the exception handler. - Fixed bug #68: Summary not written when script ended with "exit()". 2.0.0beta1 2.0.0beta1 beta beta 2004-09-15 BSD style + Added new features: - Added support for the new DBGp protocol for communicating with the debug engine. - A computerized trace format for easier parsing by external programs. - The ability to set remote debugging features via the environment. This allows an IDE to emulate CGI and still pass the configuration through to the debugger. In CGI mode, PHP does not allow -d arguments. - Reimplementation of the tracing code, you can now only trace to file; this greatly enhances performance as no string representation of variables need to be kept in memory any more. - Re-implemented profiling support. Xdebug outputs information the same way that cachegrind does so it is possible to use Kcachegrind as front-end. - Xdebug emits warnings when it was not loaded as a Zend extension. - Added showing private, protected and public to the fancy var_dump() replacement function. - Added the setting of the TCP_NODELAY socket option to stop delays in transferring data to the remote debugger client. (Patch by Christof J. Reetz) + DebugClient: Added setting for port to listen on and implemented running the previous command when pressing just enter. + Added new functions: - xdebug_get_stack_depth() to return the current stack depth level. - xdebug_get_tracefile_name() to retrieve the name of the tracefile. This is useful in case auto trace is enabled and you want to clean the trace file. - xdebug_peak_memory_usage() which returns the peak memory used in a script. (Only works when --enable-memory-limit was enabled) + Added feature requests: - FR #5: xdebug_break() function which interupts the script for the debug engine. - FR #30: Dump current scope information in stack traces on error. - FR #88: Make the url parameter XDEBUG_SESSION_START optional. So it can be disabled and the user does not need to add it. + Added new php.ini settings: - xdebug.auto_trace_file: to configure a trace file to write to as addition to the xdebug.auto_trace setting which just turns on tracing. - xdebug.collect_includes: separates collecting names of include files from the xdebug.collect_params setting. - xdebug.collect_return: showing return values in traces. - xdebug.dump_global: with which you can turn off dumping of super globals even in you have that configured. - xdebug.extended_info: turns off the generation of extended opcodes that are needed for stepping and breakpoints for the remote debugger. This is useful incase you want to profile memory usage as the generation of this extended info increases memory usage of oparrrays by about 33%. - xdebug.profiler_output_dir: profiler output directory. - xdebug.profiler_enable: enable the profiler. - xdebug.show_local_vars: turn off the showing of local variables in the top most stack frame on errors. - xdebug.show_mem_delta: show differences between current and previous memory usage on a function call level. - xdebug.trace_options: to configure extra options for trace dumping: o XDEBUG_TRACE_APPEND option (1) = Changed features: - xdebug_start_trace() now returns the filename of the tracefile (.xt is added to the requested name). - Changed default debugging protocol to dbgp instead of gdb. - Changed default debugger port from 17869 to 9000. - Changed trace file naming: xdebug.trace_output_dir is now used to configure a directory to dump automatic traces; the trace file name now also includes the pid (xdebug.trace_output_name=pid) or a crc32 checksum of the current working dir (xdebug.trace_output_name=crc32) and traces are not being appended to an existing file anymore, but simply overwritten. - Removed $this and $GLOBALS from showing variables in the local scope. - Removed functions: - xdebug_get_function_trace/xdebug_dump_function_trace() because of the new idea of tracing. = Fixed bugs: - Fixed bug #89: var_dump shows empty strings garbled. - Fixed bug #85: Xdebug segfaults when no idekey is set. - Fixed bug #83: More than 32 parameters functions make xdebug crash. - Fixed bug #75: xdebug's var_dump implementation is not binary safe. - Fixed bug #73: komodo beta 4.3.7 crash. - Fixed bug #72: breakpoint_get returns wrong structure. - Fixed bug #69: Integer overflow in cachegrind summary. - Fixed bug #67: Filenames in Xdebug break URI RFC with spaces. - Fixed bug #64: Missing include of xdebug_compat.h. - Fixed bug #57: Crash with overloading functions. - Fixed bug #54: source command did not except missing -f parameter. - Fixed bug #53: Feature get misusing the supported attribute. - Fixed bug #51: Only start a debug session if XDEBUG_SESSION_START is passed as GET or POST parameter, or the DBGP_COOKIE is send to the server. Passing XDEBUG_SESSION_STOP as GET/POST parameter will end the debug session and removes the cookie again. The cookie is also passed to the remote handler backends; for DBGp it is added to the <init> packet. - Fixed bug #49: Included file's names should not be stored by address. - Fixed bug #44: Script time-outs should be disabled when debugging. = Fixed bug #36: GDB handler using print causes segfault with wrong syntax - Fixed bug #33: Implemented the use of the ZEND_POST_DEACTIVATE hook. Now we can handle destructors safely too. - Fixed bug #32: Unusual dynamic variables cause xdebug to crash. 1.3.1 1.3.1 stable stable 2004-04-06 BSD style = Fixed profiler to aggregate class/method calls correctly. (Robert Beenen) = Fixed debugclient to initialize socket structure correctly. (Brandon Philips and David Sklar) = GDB: Fixed bug where the source file wasn't closed after a "source" command. (Derick) 1.3.0 1.3.0 stable stable 2003-09-17 BSD style = Fixed segfault where a function name didn't exist in case of a "call_user_function". (Derick) = Fixed reading a filename in case of an callback to a PHP function from an internal function (like "array_map()"). (Derick) 1.3.0rc1 1.3.0rc1 beta beta 2003-09-17 BSD style = Fixed bug with wrong file names for functions called from call_user_*(). (Derick) + Added the option "dump_superglobals" to the remote debugger. If you set this option to 0 the "show-local" and similar commands will not return any data from superglobals anymore. (Derick) = Fixed bug #2: "pear package" triggers a segfault. (Derick) = Fixed crash bug when a function had sprintf style parameters (ie. strftime()). (Derick) + Added "id" attribute to <var /> elements in responses from the remove debugger when the response method is XML. This makes it possible to distinguish between unique elements by use of recursion for example. (Derick) = Improved performance greatly by doing lazy folding of variables outside trace mode. (Derick) = Fixed a bug with "quit", if it was used it disabled the extension for the current process. (Derick) + Added the "full" argument to the remote command "backtrace". When this argument is passed, the local variables will be returned to for each frame in the stack. (Derick) + Implemented xdebug_time_index() which returns the time passed since the start of the script. This change also changes the output of the tracing functions as the start time will no longer be the first function call, but the real start time of the script. (Derick) + Implemented the "show-local" command (shows all local variables in the current scope including all contents). (Derick) + Implemented conditions for breakpoints in the "break" command. (Derick) 1.2.0 1.2.0 stable stable 2003-04-21 BSD style = Fixed compilation on MacOSX. (Derick) 1.2.0rc2 1.2.0rc2 beta beta 2003-04-15 BSD style = Fixed handling Windows paths in the debugger. (Derick) = Fixed getting zvals out of Zend Engine 2. (Derick) 1.2.0rc1 1.2.0rc1 beta beta 2003-04-06 BSD style + Added code coverage functions to check which lines and how often they were touched during execution. (Derick) + Made Xdebug compatible with Zend Engine 2. (Derick) + Added dumping of super globals on errors. (Harald Radi) + Added XML protocol for the debugger client. (Derick) = Fixed handling of "continue" (so that it also continues with the script). (Derick) + Additions to the remote debugger: "eval" (evaluate any PHP code from the debugger client). (Derick) + Added profiling support to xdebug. This introduces 3 new functions, xdebug_start_profiling() that begins profiling process, xdebug_stop_profiling() that ends the profiling process and xdebug_dump_function_trace() that dumps the profiling data. (Ilia) + Implemented the "kill" (kills the running script) and "delete" (removes a breakpoint on a specified element) command. (Derick) 1.1.0 1.1.0 stable stable 2002-11-11 BSD style + Implemented the "list" (source listing), "print" (printing variable contents), "show" (show all variables in the scope), "step" (step through execution), "pwd" (print working directory), "next" (step over) and "finish" (step out) commands for the remote debugger. (Derick) = Fixed lots of small bugs, under them memory leaks and crash bugs. (Derick) 1.1.0pre2 1.1.0pre2 beta beta 2002-10-29 BSD style + Implemented class::method, object->method and file.ext:line style breakpoints. (Derick) + Added xdebug.collect_params setting. If this setting is on (the default) then Xdebug collects all parameters passed to functions, otherwise they are not collected at all. (Derick) + Implemented correct handling of include/require and eval. (Derick) 1.1.0pre1 1.1.0pre1 beta beta 2002-10-22 BSD style + Added automatic starting of function traces (xdebug.auto_trace, defaulting to "off"). (Derick) - Xdebug no longer supports PHP versions below PHP 4.3.0pre1. (Derick) + Added gdb compatible debugger handler with support for simple (function only) breakpoints. (Derick) = Implemented a new way to get class names and file names. (Derick, Thies C. Arntzen <thies@thieso.net>) + Added time-index and memory footprint to CLI dumps. (Derick) + Implemented remote debugger handler abstraction. (Derick) + Added a php3 compatible debugger handler. (Derick) 1.0.0rc1 1.0.0rc1 beta beta 2002-09-01 BSD style + Implemented gathering of parameters to internal functions (only available in combination with PHP 4.3.0-dev). (Derick) = Implemented a new way to get class names and file names. (Derick, Thies C. Arntzen >thies@thieso.net<) + Added support for error messages with stack trace in syslog. (Sergio Ballestrero >s.ballestrero@planetweb.it<) = Windows compilation fixes. (Derick) 0.9.0 0.9.0 beta beta 2002-06-16 BSD style = Fixed a memory leak in delayed included files. (Derick) - Added support for PHP 4.1.2. (Derick) = Rewrote xdebug_get_function_stack() and xdebug_get_function_trace() to return data in multidimensional arrays. (Derick) = Fixed compiling without memory limit enabled (Sander Roobol, Derick) - Add support for classnames, variable include files and variable function names. (Derick) - Implemented links to the PHP Manual in traces. (Derick) - Added timestamps and memory usage to function traces. (Derick) = Fixed crash when using an user defined session handler. (Derick) + Implemented variable function names ($a = 'foo'; $f();) for use in traces. (Derick) 0.8.0 0.8.0 beta beta 2002-05-26 BSD style + Implemented much better parameter tracing for user defined functions. (Derick) = Renamed xdebug_get_function_trace() to xdebug_dump_function_trace(). (Derick) = Implemented new xdebug_get_function_trace() to return the function trace in an array. (Derick) + Added a parameter to xdebug_start_trace(). When this parameter is used, xdebug will dump a function trace to the filename which this parameter speficies. (Derick) - Fix a problem with nested member functions. (Derick) = Make configure scripts work with PHP 4.2.x. (Derick) + Implemented handling single-dimensional constant arrays passed to a function. (Derick) = Fix function traces in windows. (Derick) + Implemented function traces, which you can start and stop with xdebug_start_trace() and xdebug_stop_trace(). You can view the trace by using the return array from xdebug_get_function_trace(). (Derick) = Fixed segfaults with xdebug_call_*(). (Derick) 0.7.0 0.7.0 beta beta 2002-05-08 BSD style + Implemented handling of static method calls (foo::bar). (Derick) + Added correct handling of include(_once)/require(_once) and eval(). (Derick) + Added ini setting to change the default setting for enabling showing enhanced error messages. (Defaults to "On"). (Derick) + Added the functions xdebug_enable() and xdebug_disable() to change the showing of stack traces from within your code. (Derick) = Fixed the extension to show all errors. (Derick) + Implemented xdebug_memory_usage() which returns the memory in use by PHPs engine. (Derick) xdebug-2.2.3/contrib/tracefile-analyser.php0000644000175000017500000001214312147043203020200 0ustar derickderick 4 ) { showUsage(); } $fileName = $argv[1]; $sortKey = 'time-own'; $elements = 25; if ( $argc > 2 ) { $sortKey = $argv[2]; if ( !in_array( $sortKey, array( 'calls', 'time-inclusive', 'memory-inclusive', 'time-own', 'memory-own' ) ) ) { showUsage(); } } if ( $argc > 3 ) { $elements = (int) $argv[3]; } $o = new drXdebugTraceFileParser( $argv[1] ); $o->parse(); $functions = $o->getFunctions( $sortKey ); // find longest function name $maxLen = 0; foreach( $functions as $name => $f ) { if ( strlen( $name ) > $maxLen ) { $maxLen = strlen( $name ); } } echo "Showing the {$elements} most costly calls sorted by '{$sortKey}'.\n\n"; echo " ", str_repeat( ' ', $maxLen - 8 ), " Inclusive Own\n"; echo "function", str_repeat( ' ', $maxLen - 8 ), "#calls time memory time memory\n"; echo "--------", str_repeat( '-', $maxLen - 8 ), "----------------------------------------\n"; // display functions $c = 0; foreach( $functions as $name => $f ) { $c++; if ( $c > $elements ) { break; } printf( "%-{$maxLen}s %5d %3.4f %8d %3.4f %8d\n", $name, $f['calls'], $f['time-inclusive'], $f['memory-inclusive'], $f['time-own'], $f['memory-own'] ); } function showUsage() { echo "usage:\n\tphp run-cli tracefile [sortkey] [elements]\n\n"; echo "Allowed sortkeys:\n\tcalls, time-inclusive, memory-inclusive, time-own, memory-own\n"; die(); } class drXdebugTraceFileParser { protected $handle; /** * Stores the last function, time and memory for the entry point per * stack depth. int=>array(string, float, int). */ protected $stack; /** * Stores per function the total time and memory increases and calls * string=>array(float, int, int) */ protected $functions; /** * Stores which functions are on the stack */ protected $stackFunctions; public function __construct( $fileName ) { $this->handle = fopen( $fileName, 'r' ); if ( !$this->handle ) { throw new Exception( "Can't open '$fileName'" ); } $this->stack[-1] = array( '', 0, 0, 0, 0 ); $this->stack[ 0] = array( '', 0, 0, 0, 0 ); $this->stackFunctions = array(); $header1 = fgets( $this->handle ); $header2 = fgets( $this->handle ); if ( !preg_match( '@Version: 2.*@', $header1 ) || !preg_match( '@File format: 2@', $header2 ) ) { echo "\nThis file is not an Xdebug trace file made with format option '1'.\n"; showUsage(); } } public function parse() { echo "\nparsing...\n"; $c = 0; $size = fstat( $this->handle ); $size = $size['size']; $read = 0; while ( !feof( $this->handle ) ) { $buffer = fgets( $this->handle, 4096 ); $read += strlen( $buffer ); $this->parseLine( $buffer ); $c++; if ( $c % 25000 === 0 ) { printf( " (%5.2f%%)\n", ( $read / $size ) * 100 ); } } echo "\nDone.\n\n"; } private function parseLine( $line ) { /* if ( preg_match( '@^Version: (.*)@', $line, $matches ) ) { } else if ( preg_match( '@^File format: (.*)@', $line, $matches ) ) { } else if ( preg_match( '@^TRACE.*@', $line, $matches ) ) { } else // assume a normal line */ { $parts = explode( "\t", $line ); if ( count( $parts ) < 5 ) { return; } $depth = $parts[0]; $funcNr = $parts[1]; $time = $parts[3]; $memory = $parts[4]; if ( $parts[2] == '0' ) // function entry { $funcName = $parts[5]; $intFunc = $parts[6]; $this->stack[$depth] = array( $funcName, $time, $memory, 0, 0 ); array_push( $this->stackFunctions, $funcName ); } else if ( $parts[2] == '1' ) // function exit { list( $funcName, $prevTime, $prevMem, $nestedTime, $nestedMemory ) = $this->stack[$depth]; // collapse data onto functions array $dTime = $time - $prevTime; $dMemory = $memory - $prevMem; $this->stack[$depth - 1][3] += $dTime; $this->stack[$depth - 1][4] += $dMemory; array_pop( $this->stackFunctions ); $this->addToFunction( $funcName, $dTime, $dMemory, $nestedTime, $nestedMemory ); } } } protected function addToFunction( $function, $time, $memory, $nestedTime, $nestedMemory ) { if ( !isset( $this->functions[$function] ) ) { $this->functions[$function] = array( 0, 0, 0, 0, 0 ); } $elem = &$this->functions[$function]; $elem[0]++; if ( !in_array( $function, $this->stackFunctions ) ) { $elem[1] += $time; $elem[2] += $memory; $elem[3] += $nestedTime; $elem[4] += $nestedMemory; } } public function getFunctions( $sortKey = null ) { $result = array(); foreach ( $this->functions as $name => $function ) { $result[$name] = array( 'calls' => $function[0], 'time-inclusive' => $function[1], 'memory-inclusive' => $function[2], 'time-children' => $function[3], 'memory-children' => $function[4], 'time-own' => $function[1] - $function[3], 'memory-own' => $function[2] - $function[4] ); } if ( $sortKey !== null ) { uasort( $result, function( $a, $b ) use ( $sortKey ) { return ( $a[$sortKey] > $b[$sortKey] ) ? -1 : ( $a[$sortKey] < $b[$sortKey] ? 1 : 0 ); } ); } return $result; } } ?> xdebug-2.2.3/contrib/xt.vim0000644000175000017500000000410712147043203015066 0ustar derickderick" Vim syntax file " Language: Xdebug trace files (context or unified) " Maintainer: Derick Rethans " Last Change: 2010 Jun 06 " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded if version < 600 syntax clear elseif exists("b:current_syntax") finish endif syn match begin "^TRACE START" syn match end "^TRACE END" syn match date "\[.*\]" syn match min_memory "+\d\+" syn match pls_memory "-\d\+" syn match nll_memory "+0" syn match level "->" syn match lineno ":\d\+$" syn match result ">=>.\+" syn match assignment "=> \$[a-z]\+\(->[a-z]\+\)*\ .*=" syn match assignment "=> \$[a-z]\+\['\([a-z]\+\)*'\]\ .*=" syn match methodcall "\k\+->" syn match staticcall "\k\+::" syn match functionb "\k\+(" syn match functione ") " syn match main "{main}()" syn match include "include\(_once\)\=('.\+')" " Define the default highlighting. " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_diff_syntax_inits") if version < 508 let did_diff_syntax_inits = 1 command -nargs=+ HiLink hi link else command -nargs=+ HiLink hi def link endif HiLink begin Label HiLink end Label HiLink date Label HiLink assignment Label HiLink level SpecialChar HiLink result Constant HiLink min_memory Constant HiLink pls_memory Structure HiLink nll_memory Comment HiLink main Structure HiLink include Structure HiLink lineno Delimiter HiLink methodcall Function HiLink staticcall Function HiLink functionb Function HiLink functione Function delcommand HiLink endif let b:current_syntax = "xt" :set foldmethod=expr :set foldexpr=strlen(substitute(substitute(substitute(substitute(getline(v:lnum),'^TR.*$','',''),'\\s>=>','->',\"g\"),'^\\s.\\{20\\}\\(\\s\\+\\)\\?->.*$','\\1',''),'\\s\\s','\ ',\"g\"))-2 :set foldlevel=9999 " vim: ts=8 sw=2 xdebug-2.2.3/debugclient/build/buildcheck.sh0000755000175000017500000001005112147043203020271 0ustar derickderick#! /bin/sh # +----------------------------------------------------------------------+ # | PHP Version 4 | # +----------------------------------------------------------------------+ # | Copyright (c) 1997-2002 The PHP Group | # +----------------------------------------------------------------------+ # | This source file is subject to version 2.02 of the PHP license, | # | that is bundled with this package in the file LICENSE, and is | # | available at through the world-wide-web at | # | http://www.php.net/license/2_02.txt. | # | If you did not receive a copy of the PHP license and are unable to | # | obtain it through the world-wide-web, please send a note to | # | license@php.net so we can mail you a copy immediately. | # +----------------------------------------------------------------------+ # | Authors: Stig Bakken | # | Sascha Schumann | # +----------------------------------------------------------------------+ # # $Id: buildcheck.sh,v 1.3 2008-12-09 20:27:24 derick Exp $ # echo "buildconf: checking installation..." stamp=$1 # autoconf 2.13 or newer ac_version=`autoconf --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` if test -z "$ac_version"; then echo "buildconf: autoconf not found." echo " You need autoconf version 2.13 or newer installed" echo " to build PHP from CVS." exit 1 fi IFS=.; set $ac_version; IFS=' ' if test "$1" = "2" -a "$2" -lt "13" || test "$1" -lt "2"; then echo "buildconf: autoconf version $ac_version found." echo " You need autoconf version 2.13 or newer installed" echo " to build PHP from CVS." exit 1 else echo "buildconf: autoconf version $ac_version (ok)" fi #if test "$1" = "2" && test "$2" -ge "50"; then # echo "buildconf: Your version of autoconf likely contains buggy cache code." # echo " Running cvsclean for you." # echo " To avoid this, install autoconf-2.13 and automake-1.5." # ./cvsclean # stamp= #fi # automake 1.4 or newer am_version=`automake --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` am_version_clean=`echo $am_version|sed -e 's/-p[0-9]*$//'` if test "$am_version" = ""; then echo "buildconf: automake not found." echo " You need automake version 1.4 or newer installed" echo " to build PHP from CVS." exit 1 fi IFS=.; set $am_version_clean; IFS=' ' if test "$1" = "1" -a "$2" -lt "4" || test "$1" -lt "1"; then echo "buildconf: automake version $am_version found." echo " You need automake version 1.4 or newer installed" echo " to build PHP from CVS." exit 1 else echo "buildconf: automake version $am_version (ok)" fi # libtool 1.4 or newer # Prefer glibtool over libtool for Mac OS X compatibility libtool=`which glibtool 2> /dev/null` if test ! -f "$libtool"; then libtool=`which libtool`; fi lt_pversion=`$libtool --version 2>/dev/null | head -n 1 | awk '{print $4}'` if test "$lt_pversion" = ""; then echo "buildconf: libtool not found." echo " You need libtool version 1.4 or newer installed" echo " to build PHP from CVS." exit 1 fi lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'` IFS=.; set $lt_version; IFS=' ' if test "$1" -gt "1" || test "$2" -ge "4"; then echo "buildconf: libtool version $lt_pversion (ok)" else echo "buildconf: libtool version $lt_pversion found." echo " You need libtool version 1.4 or newer installed" echo " to build PHP from CVS." exit 1 fi am_prefix=`which automake | sed -e 's#/[^/]*/[^/]*$##'` lt_prefix=`echo $libtool | sed -e 's#/[^/]*/[^/]*$##'` if test "$am_prefix" != "$lt_prefix"; then echo "WARNING: automake and libtool are installed in different" echo " directories. This may cause aclocal to fail." echo " continuing anyway" fi test -n "$stamp" && touch $stamp exit 0 xdebug-2.2.3/debugclient/build/buildconf1.mk0000755000175000017500000000027412147043203020225 0ustar derickderick all: buildmk.stamp generated_list @$(MAKE) -s -f build/buildconf2.mk buildmk.stamp: build/buildcheck.sh @build/buildcheck.sh $@ generated_list: @echo config_m4_files = >> $@ xdebug-2.2.3/debugclient/build/buildconf2.mk0000755000175000017500000000145412147043203020227 0ustar derickderick include generated_list TOUCH_FILES = mkinstalldirs install-sh missing all: $(TOUCH_FILES) config_h.in aclocal.m4 targets configure targets: @echo rebuilding Makefile templates @for i in `find . -name Makefile.am`; do \ (automake --foreign -a `dirname $$i`/Makefile 2>/dev/null || true); \ echo " `dirname $$i`/Makefile.in"; \ done aclocal.m4: configure.in acinclude.m4 @echo rebuilding $@ @aclocal 2>&1 config_h.in: configure # explicitly remove target since autoheader does not seem to work # correctly otherwise (timestamps are not updated) @echo rebuilding $@ @rm -f $@ @autoheader 2>&1 $(TOUCH_FILES): @touch $(TOUCH_FILES) configure: aclocal.m4 configure.in $(config_m4_files) @echo rebuilding $@ @autoconf 2>&1 | (egrep -v 'warning: AC_PROG_LEX invoked multiple times' || true) xdebug-2.2.3/debugclient/build/clean.mk0000644000175000017500000000025512147043203017255 0ustar derickderickall: @for i in `find . -name .cvsignore`; do \ (cd `dirname $$i` 2>/dev/null && rm -rf `cat .cvsignore` *.o *.a || true); \ done xdebug-2.2.3/debugclient/build/config-stubs0000755000175000017500000000013612147043203020171 0ustar derickderick#!/bin/sh # dir=$1; shift for m4file in $dir/*/config.m4; do echo "sinclude($m4file)" done xdebug-2.2.3/debugclient/acinclude.m40000644000175000017500000000211112147043203016725 0ustar derickderickdnl dnl $Id: acinclude.m4,v 1.3 2007-02-26 14:38:42 derick Exp $ dnl dnl This file contains local autoconf functions. dnl This source file is subject to version 1.0 of the Xdebug license, dnl that is bundled with this package in the file LICENSE, and is dnl available at through the world-wide-web at dnl http://xdebug.derickrethans.nl/license.php dnl If you did not receive a copy of the Xdebug license and are unable dnl to obtain it through the world-wide-web, please send a note to dnl xdebug@derickrethans.nl so we can mail you a copy immediately. dnl dnl Authors: Derick Rethans dnl dnl XDEBUG_MODULE_ADD(modulename [, static]) dnl XDEBUG_STATIC_LDADD="" AC_DEFUN([XDEBUG_MODULE_ADD],[ XDEBUG_MODULES="$XDEBUG_MODULES $1" if test a$2 != "a"; then XDEBUG_STATIC_MODULES="$XDEBUG_STATIC_MODULES $1" XDEBUG_STATIC_LDADD="$XDEBUG_STATIC_LDADD \$(top_srcdir)/modules/$1/lib$1.la" fi XDEBUG_MOD_MAKEFILES="$XDEBUG_MOD_MAKEFILES modules/$1/Makefile" ]) dnl dnl XDEBUG_HELP_SEPARATOR(text) dnl AC_DEFUN([XDEBUG_HELP_SEPARATOR],[ AC_ARG_ENABLE([],[ $1],[]) ]) xdebug-2.2.3/debugclient/buildconf0000755000175000017500000000014612147043203016435 0ustar derickderick#!/bin/sh echo "cleaning" ${MAKE:-make} -s -f build/clean.mk ${MAKE:-make} -s -f build/buildconf1.mk xdebug-2.2.3/debugclient/config.guess0000755000175000017500000011315012147043203017062 0ustar derickderick#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. timestamp='2001-09-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Written by Per Bothner . # Please send patches to . # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi dummy=dummy-$$ trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int dummy(){}" > $dummy.c ; for c in cc gcc c89 ; do ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; if test $? = 0 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; rm -f $dummy.c $dummy.o $dummy.rel ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # Netbsd (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # Determine the machine/vendor (is the vendor relevant). case "${UNAME_MACHINE}" in amiga) machine=m68k-unknown ;; arm32) machine=arm-unknown ;; atari*) machine=m68k-atari ;; sun3*) machine=m68k-sun ;; mac68k) machine=m68k-apple ;; macppc) machine=powerpc-apple ;; hp3[0-9][05]) machine=m68k-hp ;; ibmrt|romp-ibm) machine=romp-ibm ;; *) machine=${UNAME_MACHINE}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE}" in i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <$dummy.s .data \$Lformat: .byte 37,100,45,37,120,10,0 # "%d-%x\n" .text .globl main .align 4 .ent main main: .frame \$30,16,\$26,0 ldgp \$29,0(\$27) .prologue 1 .long 0x47e03d80 # implver \$0 lda \$2,-1 .long 0x47e20c21 # amask \$2,\$1 lda \$16,\$Lformat mov \$0,\$17 not \$1,\$18 jsr \$26,printf ldgp \$29,0(\$26) mov 0,\$16 jsr \$26,exit .end main EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then case `./$dummy` in 0-0) UNAME_MACHINE="alpha" ;; 1-0) UNAME_MACHINE="alphaev5" ;; 1-1) UNAME_MACHINE="alphaev56" ;; 1-101) UNAME_MACHINE="alphapca56" ;; 2-303) UNAME_MACHINE="alphaev6" ;; 2-307) UNAME_MACHINE="alphaev67" ;; 2-1307) UNAME_MACHINE="alphaev68" ;; esac fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; arc64:OpenBSD:*:*) echo mips64el-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hkmips:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; sparc*:NetBSD:*) echo `uname -p`-unknown-netbsd${UNAME_RELEASE} exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; sun3*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) case "${HPUX_REV}" in 11.[0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; esac ;; esac fi ;; esac if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; hppa*:OpenBSD:*:*) echo hppa-unknown-openbsd exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*X-MP:*:*:*) echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i386-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in big) echo mips-unknown-linux-gnu && exit 0 ;; little) echo mipsel-unknown-linux-gnu && exit 0 ;; esac ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. ld_supported_targets=`cd /; ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build cat >$dummy.c < #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 printf ("%s-pc-linux-gnu\n", argv[1]); # else printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif # else printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif #else printf ("%s-pc-linux-gnuaout\n", argv[1]); #endif return 0; } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) echo `uname -p`-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) if test "${UNAME_MACHINE}" = "x86pc"; then UNAME_MACHINE=pc fi echo `uname -p`-${UNAME_MACHINE}-nto-qnx exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-[KW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: xdebug-2.2.3/debugclient/config.h.in0000644000175000017500000000612012147043203016563 0ustar derickderick/* config.h.in. Generated from configure.in by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Dmalloc */ #undef HAVE_DMALLOC /* */ #undef HAVE_DYLD /* Define to 1 if you have the header file. */ #undef HAVE_ERROR_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* */ #undef HAVE_LIBEDIT /* Define to 1 if you have the `nsl' library (-lnsl). */ #undef HAVE_LIBNSL /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET /* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* */ #undef HAVE_TERMCAP /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* The size of `char', as computed by sizeof. */ #undef SIZEOF_CHAR /* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG /* The size of `short', as computed by sizeof. */ #undef SIZEOF_SHORT /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Number of arguments to el_init */ #undef XDC_ELINIT_ARGS /* H_SETSIZE or H_EVENT */ #undef XDC_H_SETSIZE /* Whether debugging is enabled or not. */ #undef XDEBUG_DEBUG /* */ #undef XDEBUG_MACOSX /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif xdebug-2.2.3/debugclient/config.sub0000755000175000017500000006710012147043203016530 0ustar derickderick#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. timestamp='2001-09-07' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ | d10v | d30v | dsp16xx \ | fr30 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | m32r | m68000 | m68k | m88k | mcore \ | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el | mips64vr4300 \ | mips64vr4300el | mips64vr5000 | mips64vr5000el \ | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ | mipsisa32 \ | mn10200 | mn10300 \ | ns16k | ns32k \ | openrisc \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | s390 | s390x \ | sh | sh[34] | sh[34]eb | shbe | shle \ | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ | stormy16 | strongarm \ | tahoe | thumb | tic80 | tron \ | v850 \ | we32k \ | x86 | xscale \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alphapca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armv*-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c54x-* \ | clipper-* | cray2-* | cydra-* \ | d10v-* | d30v-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | m32r-* \ | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | s390-* | s390x-* \ | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ | sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \ | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ | v850-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | ymp) basic_machine=ymp-cray os=-unicos ;; cray2) basic_machine=cray2-cray os=-unicos ;; [cjt]90) basic_machine=${basic_machine}-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu ;; mips*-linux*) basic_machine=mips-unknown os=-linux-gnu ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i686-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sparclite-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=t3e-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; windows32) basic_machine=i386-pc os=-windows32-msvcrt ;; xmp) basic_machine=xmp-cray os=-unicos ;; xps | xps100) basic_machine=xps100-honeywell ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown else basic_machine=mips-mips fi ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh3eb | sh4eb) basic_machine=sh-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; c4x*) basic_machine=c4x-none os=-coff ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto*) os=-nto-qnx ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: xdebug-2.2.3/debugclient/configure0000755000175000017500000056346512147043203016473 0ustar derickderick#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="main.c" ac_default_prefix=/usr/local # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS INCLUDES XDEBUG_MOD_MAKEFILES XDEBUG_STATIC_LDADD XDEBUG_STATIC_MODULES XDEBUG_MODULES EGREP GREP CPP AS am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC host_os host_vendor host_cpu host build_os build_vendor build_cpu build MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_maintainer_mode enable_dependency_tracking enable_ enable_debug enable_dmalloc with_libedit ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors DEBUGGING: --enable-debug Enable debugging. --enable-dmalloc Enable dmalloc debugging Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-libedit Enable libedit Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid; break else as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=$ac_mid; break else as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid else as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval () { return $2; } static unsigned long int ulongval () { return $2; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : echo >>conftest.val; read $3 &5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE=debugclient VERSION=$VERSION cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' ac_config_headers="$ac_config_headers config.h" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # This is needed if SUBDIRS is set { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi if test "$ac_cv_c_compiler_gnu" = "yes" then AS="$CC -c" else # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_AS+:} false; then : $as_echo_n "(cached) " >&6 else case $AS in [\\/]* | ?:[\\/]*) ac_cv_path_AS="$AS" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_AS="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_AS" && ac_cv_path_AS="as" ;; esac fi AS=$ac_cv_path_AS if test -n "$AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 $as_echo "$AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in error.h \ fcntl.h \ malloc.h \ syslog.h \ unistd.h \ dlfcn.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char" >&5 $as_echo_n "checking size of char... " >&6; } if ${ac_cv_sizeof_char+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char))" "ac_cv_sizeof_char" "$ac_includes_default"; then : else if test "$ac_cv_type_char" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (char) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_char=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_char" >&5 $as_echo "$ac_cv_sizeof_char" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_CHAR $ac_cv_sizeof_char _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } if ${ac_cv_sizeof_short+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : else if test "$ac_cv_type_short" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (short) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_short=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 $as_echo "$ac_cv_sizeof_short" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } if ${ac_cv_sizeof_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : else if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 $as_echo "$ac_cv_sizeof_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } if ${ac_cv_sizeof_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 $as_echo "$ac_cv_sizeof_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } if ${ac_cv_sizeof_long_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 $as_echo "$ac_cv_sizeof_long_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; } if ${ac_cv_lib_nsl_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_gethostbyname=yes else ac_cv_lib_nsl_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNSL 1 _ACEOF LIBS="-lnsl $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } if ${ac_cv_lib_socket_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_socket=yes else ac_cv_lib_socket_socket=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } if test "x$ac_cv_lib_socket_socket" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF LIBS="-lsocket $LIBS" fi for ac_func in strerror strtol strtoul do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Check whether --enable- was given. if test "${enable_+set}" = set; then : enableval=$enable_; fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable debugging" >&5 $as_echo_n "checking whether to enable debugging... " >&6; } # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; if test "$enableval" = "yes" ; then $as_echo "#define XDEBUG_DEBUG 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -Wall -Werror" else $as_echo "#define XDEBUG_DEBUG 0" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$CFLAGS -Wall -Werror" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use dmalloc debugging" >&5 $as_echo_n "checking whether to use dmalloc debugging... " >&6; } # Check whether --enable-dmalloc was given. if test "${enable_dmalloc+set}" = set; then : enableval=$enable_dmalloc; if test "$enableval" = "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dmalloc_error in -ldmalloc" >&5 $as_echo_n "checking for dmalloc_error in -ldmalloc... " >&6; } if ${ac_cv_lib_dmalloc_dmalloc_error+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dmalloc_error (); int main () { return dmalloc_error (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dmalloc_dmalloc_error=yes else ac_cv_lib_dmalloc_dmalloc_error=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dmalloc_dmalloc_error" >&5 $as_echo "$ac_cv_lib_dmalloc_dmalloc_error" >&6; } if test "x$ac_cv_lib_dmalloc_dmalloc_error" = xyes; then : $as_echo "#define HAVE_DMALLOC 1" >>confdefs.h LIBS="-ldmalloc $LIBS" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use libedit" >&5 $as_echo_n "checking whether to use libedit... " >&6; } # Check whether --with-libedit was given. if test "${with_libedit+set}" = set; then : withval=$with_libedit; if test "$withval" = "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetflag in -ltermcap" >&5 $as_echo_n "checking for tgetflag in -ltermcap... " >&6; } if ${ac_cv_lib_termcap_tgetflag+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltermcap $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tgetflag (); int main () { return tgetflag (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_termcap_tgetflag=yes else ac_cv_lib_termcap_tgetflag=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termcap_tgetflag" >&5 $as_echo "$ac_cv_lib_termcap_tgetflag" >&6; } if test "x$ac_cv_lib_termcap_tgetflag" = xyes; then : $as_echo "#define HAVE_TERMCAP 1" >>confdefs.h LIBS="-ltermcap $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for el_set in -ledit" >&5 $as_echo_n "checking for el_set in -ledit... " >&6; } if ${ac_cv_lib_edit_el_set+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ledit $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char el_set (); int main () { return el_set (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_edit_el_set=yes else ac_cv_lib_edit_el_set=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_edit_el_set" >&5 $as_echo "$ac_cv_lib_edit_el_set" >&6; } if test "x$ac_cv_lib_edit_el_set" = xyes; then : $as_echo "#define HAVE_LIBEDIT 1" >>confdefs.h LIBS="-ledit $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for H_SETSIZE" >&5 $as_echo_n "checking for H_SETSIZE... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifdef H_SETSIZE yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then : $as_echo "#define XDC_H_SETSIZE H_SETSIZE" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: H_SETSIZE" >&5 $as_echo "H_SETSIZE" >&6; } else $as_echo "#define XDC_H_SETSIZE H_EVENT" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: H_EVENT" >&5 $as_echo "H_EVENT" >&6; } fi rm -f conftest* { $as_echo "$as_me:${as_lineno-$LINENO}: checking for number of arguments to el_init" >&5 $as_echo_n "checking for number of arguments to el_init... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { static EditLine *el = NULL; el = el_init("foo", stdin, stdout, stderr); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : XDC_ELINIT_ARGS=4 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { static EditLine *el = NULL; el = el_init("foo", stdin, stdout); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : XDC_ELINIT_ARGS=3 else as_fn_error $? "\"you have strange libedit\"" "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >>confdefs.h <<_ACEOF #define XDC_ELINIT_ARGS $XDC_ELINIT_ARGS _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XDC_ELINIT_ARGS" >&5 $as_echo "$XDC_ELINIT_ARGS" >&6; } else as_fn_error $? "\"libedit was not found on your system.\"" "$LINENO" 5 fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi case $host_alias in *darwin*|*rhapsody*) CFLAGS="$CFLAGS -Wno-long-double" $as_echo "#define XDEBUG_MACOSX 1" >>confdefs.h $as_echo "#define HAVE_DYLD 1" >>confdefs.h ;; esac ac_config_files="$ac_config_files Makefile" ac_config_commands="$ac_config_commands default" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" if test "\$CONFIG_FILES" = "$MAKES" || test -z "\$CONFIG_FILES"; then REDO_ALL=yes fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi xdebug-2.2.3/debugclient/configure.in0000644000175000017500000001020312147043203017046 0ustar derickderickdnl $Id: configure.in,v 1.7 2009-07-05 19:57:59 derick Exp $ dnl dnl Process this file with autoconf to produce a configure script. dnl dnl divert(1) dnl dnl Start dnl AC_INIT([main.c]) AC_PREREQ(2.59) AC_PREFIX_DEFAULT([/usr/local]) AM_INIT_AUTOMAKE(debugclient, $VERSION) AC_CONFIG_HEADERS(config.h) AM_MAINTAINER_MODE AC_CANONICAL_HOST # This is needed if SUBDIRS is set AC_PROG_MAKE_SET dnl divert(2) dnl dnl Checks for working compiler and other programs needed. dnl AC_PROG_CC if test "$ac_cv_c_compiler_gnu" = "yes" then AS="$CC -c" AC_SUBST(AS) else AC_PATH_PROG(AS, as, as) fi dnl AM_PROG_LIBTOOL AC_PROG_INSTALL dnl dnl Checks for needed header files. dnl AC_HEADER_STDC AC_CHECK_HEADERS( error.h \ fcntl.h \ malloc.h \ syslog.h \ unistd.h \ dlfcn.h \ ) dnl dnl Checks for typedefs, structures, and compiler characteristics. dnl AC_C_CONST AC_C_INLINE AC_CHECK_SIZEOF(char, 1) AC_CHECK_SIZEOF(short, 2) AC_CHECK_SIZEOF(int, 2) AC_CHECK_SIZEOF(long, 4) AC_CHECK_SIZEOF(long long, 8) AC_CHECK_LIB(nsl, gethostbyname) AC_CHECK_LIB(socket, socket) AC_CHECK_FUNCS(strerror strtol strtoul) dnl dnl Debug section: dnl dnl Debug on/off [default: OFF] dnl XDEBUG_HELP_SEPARATOR(DEBUGGING:) AC_MSG_CHECKING([whether to enable debugging]) AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging.], [ if test "$enableval" = "yes" ; then AC_DEFINE(XDEBUG_DEBUG, 1, [Whether debugging is enabled or not.]) AC_MSG_RESULT([yes]) CFLAGS="$CFLAGS -Wall -Werror" else AC_DEFINE(XDEBUG_DEBUG, 0, [Whether debugging is enabled or not.]) AC_MSG_RESULT([no]) CFLAGS="$CFLAGS -Wall -Werror" fi ],[ AC_MSG_RESULT([no]) ]) AC_MSG_CHECKING([whether to use dmalloc debugging]) AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc Enable dmalloc debugging ], [ if test "$enableval" = "yes" ; then AC_MSG_RESULT([yes]) AC_CHECK_LIB(dmalloc, dmalloc_error, [ AC_DEFINE(HAVE_DMALLOC, 1, [Dmalloc]) LIBS="-ldmalloc $LIBS" ]) else AC_MSG_RESULT([no]) fi ],[ AC_MSG_RESULT([no]) ]) AC_MSG_CHECKING([whether to use libedit]) AC_ARG_WITH(libedit, [ --with-libedit Enable libedit ], [ if test "$withval" = "yes" ; then AC_MSG_RESULT([yes]) AC_CHECK_LIB(termcap, tgetflag, [ AC_DEFINE(HAVE_TERMCAP, 1, [ ]) LIBS="-ltermcap $LIBS" ]) AC_CHECK_LIB(edit, el_set, [ AC_DEFINE(HAVE_LIBEDIT, 1, [ ]) LIBS="-ledit $LIBS" AC_MSG_CHECKING([for H_SETSIZE]) AC_EGREP_CPP(yes, [ #include #ifdef H_SETSIZE yes #endif ], [ AC_DEFINE([XDC_H_SETSIZE], H_SETSIZE, [H_SETSIZE or H_EVENT]) AC_MSG_RESULT([H_SETSIZE]) ], [ AC_DEFINE([XDC_H_SETSIZE], H_EVENT, [H_SETSIZE or H_EVENT]) AC_MSG_RESULT([H_EVENT]) ]) AC_MSG_CHECKING([for number of arguments to el_init]) AC_TRY_COMPILE([ #include #include ], [ static EditLine *el = NULL; el = el_init("foo", stdin, stdout, stderr); ], XDC_ELINIT_ARGS=4, [AC_TRY_COMPILE([ #include #include ], [ static EditLine *el = NULL; el = el_init("foo", stdin, stdout); ], XDC_ELINIT_ARGS=3, [AC_ERROR("you have strange libedit")] )] ) AC_DEFINE_UNQUOTED([XDC_ELINIT_ARGS], $XDC_ELINIT_ARGS, [Number of arguments to el_init]) AC_MSG_RESULT($XDC_ELINIT_ARGS) ], [ AC_ERROR("libedit was not found on your system.") ]) else AC_MSG_RESULT([no]) fi ],[ AC_MSG_RESULT([no]) ]) dnl dnl System dependant checks dnl case $host_alias in *darwin*|*rhapsody*) CFLAGS="$CFLAGS -Wno-long-double" AC_DEFINE(XDEBUG_MACOSX,1,[ ]) AC_DEFINE(HAVE_DYLD,1, [ ]) ;; esac AC_SUBST(XDEBUG_MODULES) AC_SUBST(XDEBUG_STATIC_MODULES) AC_SUBST(XDEBUG_STATIC_LDADD) AC_SUBST(XDEBUG_MOD_MAKEFILES) AC_SUBST(INCLUDES) dnl dnl Output dnl AC_OUTPUT([Makefile], [], [ if test "\$CONFIG_FILES" = "$MAKES" || test -z "\$CONFIG_FILES"; then REDO_ALL=yes fi ]) xdebug-2.2.3/debugclient/cvsclean0000755000175000017500000000005312147043203016263 0ustar derickderick#!/bin/sh ${MAKE:-make} -f build/clean.mk xdebug-2.2.3/debugclient/debugclient.dsp0000644000175000017500000001054212147043203017540 0ustar derickderick# Microsoft Developer Studio Project File - Name="debugclient" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=debugclient - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "debugclient.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "debugclient.mak" CFG="debugclient - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "debugclient - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "debugclient - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "debugclient - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 !ELSEIF "$(CFG)" == "debugclient - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept !ENDIF # Begin Target # Name "debugclient - Win32 Release" # Name "debugclient - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\main.c # End Source File # Begin Source File SOURCE=.\usefulstuff.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\usefulstuff.h # End Source File # End Group # End Target # End Project xdebug-2.2.3/debugclient/depcomp0000755000175000017500000005064312147043203016126 0ustar derickderick#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2012-03-27.16; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, # 2011, 2012 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 # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # A tabulation character. tab=' ' # A newline character. nl=' ' if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' "$nl" < "$tmpdepfile" | ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependent.h'. # Do two passes, one to just change these to # '$object: dependent.h' and one to simply 'dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. # However on # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\': # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... # tcc 0.9.26 (FIXME still under development at the moment of writing) # will emit a similar output, but also prepend the continuation lines # with horizontal tabulation characters. "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form 'foo.o: dependent.h', # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. # Do two passes, one to just change these to # '$object: dependent.h' and one to simply 'dependent.h:'. sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ < "$tmpdepfile" > "$depfile" sed ' s/[ '"$tab"'][ '"$tab"']*/ /g s/^ *// s/ *\\*$// s/^[^:]*: *// /^$/d /:$/d s/$/ :/ ' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test "$stat" = 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' "$nl" < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: xdebug-2.2.3/debugclient/INSTALL0000644000175000017500000000051612147043203015574 0ustar derickderickINSTALLATION ============ Compilation of the debug client can be done very easily with the following three steps: 1. ./buildconf 2. ./configure or ./configure --with-libedit in case you have libedit installed. This is highly recommended as it makes navigating to previous commands much easier. 3. make 4. make install xdebug-2.2.3/debugclient/install-sh0000644000175000017500000001273612147043203016553 0ustar derickderick#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 xdebug-2.2.3/debugclient/LICENSE0000644000175000017500000000574112147043203015555 0ustar derickderick-------------------------------------------------------------------- The Xdebug License, version 1.01 (Based on "The PHP License, version 3.0) Copyright (c) 2003-2007 Derick Rethans. All rights reserved. -------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, is permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name "Xdebug" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact derick@xdebug.org. 4. Products derived from this software may not be called "Xdebug", nor may "Xdebug" appear in their name, without prior written permission from derick@xdebug.org. 5. Derick Rethans may publish revised and/or new versions of the license from time to time. Each version will be given a distinguishing version number. Once covered code has been published under a particular version of the license, you may always continue to use it under the terms of that version. You may also choose to use such covered code under the terms of any subsequent version of the license published by Derick Rethans. No one other than the Derick Rethans has the right to modify the terms applicable to covered code created under this License. 6. Redistributions of any form whatsoever must retain the following acknowledgment: "This product includes Xdebug, freely available from ". THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------- This software consists of voluntary contributions made by many individuals on behalf of Derick Rethans. Derick Rethans can be contacted via e-mail at derick@xdebug.org. For more information Xdebug, please see . xdebug-2.2.3/debugclient/ltmain.sh0000644000175000017500000041755612147043203016403 0ustar derickderick# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # 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 # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" # Parse our command line options once, thoroughly. while test $# -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" exit 0 ;; --config) sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 exit 0 ;; --debug) echo "$progname: enabling shell trace mode" set -x ;; --dry-run | -n) run=: ;; --features) echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit 0 ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --quiet | --silent) show=: ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit 1 ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then case $nonopt in *cc | *++ | gcc* | *-gcc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit 1 fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= prev= lastarg= srcfile="$nonopt" suppress_output= user_target=no for arg do case $prev in "") ;; xcompiler) # Aesthetically quote the previous argument. prev= lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac # Add the previous argument to base_compile. if test -z "$base_compile"; then base_compile="$lastarg" else base_compile="$base_compile $lastarg" fi continue ;; esac # Accept any command-line options. case $arg in -o) if test "$user_target" != "no"; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit 1 fi user_target=next ;; -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; -Xcompiler) prev=xcompiler continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. if test -z "$base_compile"; then base_compile="$lastarg" else base_compile="$base_compile $lastarg" fi continue ;; esac case $user_target in next) # The next one is the -o target name user_target=yes continue ;; yes) # We got the output file user_target=set libobj="$arg" continue ;; esac # Accept the current argument as the source file. lastarg="$srcfile" srcfile="$arg" # Aesthetically quote the previous argument. # Backslashify any backslashes, double quotes, and dollar signs. # These are the only characters that are still specially # interpreted inside of double-quoted scrings. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $lastarg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac # Add the previous argument to base_compile. if test -z "$base_compile"; then base_compile="$lastarg" else base_compile="$base_compile $lastarg" fi done case $user_target in set) ;; no) # Get the name of the library object. libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; *) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit 1 ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSfmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit 1 ;; esac if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit 1 fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $libobj" else removelist="$libobj" fi $run $rm $removelist trap "$run $rm $removelist; exit 1" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit 1" 1 2 15 else need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$0" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then # All platforms use -DPIC, to notify preprocessed assembler code. command="$base_compile $srcfile $pic_flag -DPIC" else # Don't build PIC code command="$base_compile $srcfile" fi if test "$build_old_libs" = yes; then lo_libobj="$libobj" dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$libobj"; then dir="$objdir" else dir="$dir/$objdir" fi libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` if test -d "$dir"; then $show "$rm $libobj" $run $rm $libobj else $show "$mkdir $dir" $run $mkdir $dir status=$? if test $status -ne 0 && test ! -d $dir; then exit $status fi fi fi if test "$compiler_o_lo" = yes; then output_obj="$libobj" command="$command -o $output_obj" elif test "$compiler_c_o" = yes; then output_obj="$obj" command="$command -o $output_obj" fi $run $rm "$output_obj" $show "$command" if $run eval "$command"; then : else test -n "$output_obj" && $run $rm $removelist exit 1 fi if test "$need_locks" = warn && test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi # Just move the object if needed, then go on to compile the next one if test x"$output_obj" != x"$libobj"; then $show "$mv $output_obj $libobj" if $run $mv $output_obj $libobj; then : else error=$? $run $rm $removelist exit $error fi fi # If we have no pic_flag, then copy the object into place and finish. if (test -z "$pic_flag" || test "$pic_mode" != default) && test "$build_old_libs" = yes; then # Rename the .lo from within objdir to obj if test -f $obj; then $show $rm $obj $run $rm $obj fi $show "$mv $libobj $obj" if $run $mv $libobj $obj; then : else error=$? $run $rm $removelist exit $error fi xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir="." else xdir="$xdir" fi baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` # Now arrange that obj and lo_libobj become the same file $show "(cd $xdir && $LN_S $baseobj $libobj)" if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then # Unlock the critical section if it was locked if test "$need_locks" != no; then $run $rm "$lockfile" fi exit 0 else error=$? $run $rm $removelist exit $error fi fi # Allow error messages only from the first compilation. suppress_output=' >/dev/null 2>&1' fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $srcfile" else # All platforms use -DPIC, to notify preprocessed assembler code. command="$base_compile $srcfile $pic_flag -DPIC" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" output_obj="$obj" fi # Suppress compiler output if we already did a PIC compilation. command="$command$suppress_output" $run $rm "$output_obj" $show "$command" if $run eval "$command"; then : else $run $rm $removelist exit 1 fi if test "$need_locks" = warn && test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi # Just move the object if needed if test x"$output_obj" != x"$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Create an invalid libtool object if no PIC, so that we do not # accidentally link it into a program. if test "$build_libtool_libs" != yes; then $show "echo timestamp > $libobj" $run eval "echo timestamp > \$libobj" || exit $? else # Move the .lo from within objdir $show "$mv $libobj $lo_libobj" if $run $mv $libobj $lo_libobj; then : else error=$? $run $rm $removelist exit $error fi fi fi # Unlock the critical section if it was locked if test "$need_locks" != no; then $run $rm "$lockfile" fi exit 0 ;; # libtool link mode link | relink) modename="$modename: link" case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invokation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args="$nonopt" compile_command="$nonopt" finalize_command="$nonopt" compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= # We need to know -static, to get the right output filenames. for arg do case $arg in -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test $# -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit 1 fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit 1 ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n $prev prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit 1 fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 exit 1 fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -o) prev=output ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit 1 ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.lo | *.$objext) # A library or standard object. if test "$prev" = dlfiles; then # This file was specified with -dlopen. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $arg" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` prev= else case $arg in *.lo) libobjs="$libobjs $arg" ;; *) objs="$objs $arg" ;; esac fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit 1 ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac libs="$libs $deplib" done deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit 1 ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode" = prog; then # Determine which files to process case $pass in dlopen) libs="$dlfiles" save_deplibs="$deplibs" # Collect dlpreopened libraries deplibs= ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi for deplib in $libs; do lib= found=no case $deplib in -l*) if test "$linkmode" = oldlib && test "$linkmode" = obj; then $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 continue fi if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do # Search the libtool library lib="$searchdir/lib${name}.la" if test -f "$lib"; then found=yes break fi done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) if test "$deplibs_check_method" != pass_all; then echo echo "*** Warning: This library needs some functionality provided by $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." else echo echo "*** Warning: Linking the shared library $output against the" echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 exit 1 fi # Check to see that this really is a libtool archive. if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variable installed. installed=yes # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" = oldlib && test "$linkmode" = obj; }; then # Add dl[pre]opened files of deplib test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit 1 fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit 1 fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit 1 fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit 1 fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. dlprefiles="$dlprefiles $lib" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit 1 fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # Link against this shared library if test "$linkmode,$pass" = "prog,link" || { test "$linkmode" = lib && test "$hardcode_into_libs" = yes; }; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac if test "$linkmode" = prog; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi fi fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`echo $soroot | sed -e 's/^.*\///'` newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' eval cmds=\"$extract_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' eval cmds=\"$old_archive_from_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit 1 fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi # Try to link the static library # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo echo "*** Warning: This library needs some functionality provided by $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** Therefore, libtool will create a static module, that should work " echo "*** as long as the dlopening application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="-L$absdir/$objdir" else eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit 1 fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="-L$absdir" fi ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then test "$pass" != scan && dependency_libs="$newdependency_libs" if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do case $deplib in -L*) new_libs="$deplib $new_libs" ;; *) case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi if test "$pass" = "conv" && { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then libs="$deplibs" # reset libs deplibs= fi done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit 1 fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit 1 else echo echo "*** Warning: Linking the shared library $output against the non-libtool" echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. libext=al oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit 1 fi current="$2" revision="$3" age="$4" # Check that each of the things are valid numbers. case $current in [0-9]*) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac case $revision in [0-9]*) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac case $age in [0-9]*) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix) major=`expr $current - $age + 1` verstring="sgi$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="sgi$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= verstring="0.0" case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring="" ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs. $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd*) # Do not include libc due to us having libc/libc_r. ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behaviour. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | sed 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | sed 10q \ | egrep "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done if test -n "$a_deplib" ; then droppeddeps=yes echo echo "*** Warning: This library needs some functionality provided by $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do if eval echo \"$potent_lib\" 2>/dev/null \ | sed 10q \ | egrep "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done if test -n "$a_deplib" ; then droppeddeps=yes echo echo "*** Warning: This library needs some functionality provided by $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | grep . >/dev/null; then echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" echo "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi test -z "$dlname" && dlname=$soname lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Ensure that we have .o objects for linkers which dislike .lo # (e.g. aix) in case we are running --disable-static for obj in $libobjs; do xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir="." else xdir="$xdir" fi baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` if test ! -f $xdir/$oldobj; then $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? fi done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols eval cmds=\"$export_symbols_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` done fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval cmds=\"$archive_expsym_cmds\" else eval cmds=\"$archive_cmds\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? exit 0 fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit 1 fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` done fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" eval cmds=\"$reload_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit 0 fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. $show "echo timestamp > $libobj" $run eval "echo timestamp > $libobj" || exit $? exit 0 fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" eval cmds=\"$reload_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" else # Just create a symlink. $show $rm $libobj $run $rm $libobj xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$libobj"; then xdir="." else xdir="$xdir" fi baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` $show "(cd $xdir && $LN_S $oldobj $baseobj)" $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit 0 ;; prog) case $host in *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`echo "$arg" | sed -e 's%^.*/%%'` $run eval 'echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DPIC";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit 1 ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit 0 fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $0 --fallback-echo"; then case $0 in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; *) qecho="$SHELL `pwd`/$0 --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`echo $output|sed 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe ;; *) exeext= ;; esac $rm $output trap "$rm $output; exit 1" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # win32 systems need to use the prog path for dll # lookup to work *-*-cygwin* | *-*-pw32*) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ # Export the path to the program. PATH=\"\$progdir:\$PATH\" export PATH exec \$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit 0 ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" # Add in members from convenience archives. for xlib in $addlibs; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` done fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then eval cmds=\"$old_archive_from_new_cmds\" else # Ensure that we have .o objects in place in case we decided # not to build a shared library, and have fallen back to building # static libs even though --disable-static was passed! for oldobj in $oldobjs; do if test ! -f $oldobj; then xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$oldobj"; then xdir="." else xdir="$xdir" fi baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` $show "(cd $xdir && ${LN_S} $obj $baseobj)" $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? fi done eval cmds=\"$old_archive_cmds\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit 1 fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit 0 ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit 1 fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit 1 fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit 1 fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 continue fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" eval cmds=\"$postinstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit 0 ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Do a test to see if this is really a libtool program. if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then notinst_deplibs= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 exit 1 fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` if test $? = 0 ; then : else tmpdir="$tmpdir/libtool-$$" fi if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : else $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in /usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`echo $destfile | sed -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. eval cmds=\"$old_postinstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $0 --finish$current_libdirs' else exit 0 fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. eval cmds=\"$finish_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit 0 echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do echo " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" echo "more information, such as the ld(1) and ld.so(8) manual pages." echo "----------------------------------------------------------------------" exit 0 ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit 1 fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit 1 fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit 1 fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit 1 fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved enviroment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit 0 fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit 1 fi rmdirs= for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$objdir" else objdir="$dir/$objdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. eval cmds=\"$postuninstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. eval cmds=\"$old_postuninstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) if test "$build_old_libs" = yes; then oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` rmfiles="$rmfiles $dir/$oldobj" fi ;; *) # Do a test to see if this is a libtool program. if test "$mode" = clean && (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$file rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit 1 ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit 1 fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit 1 fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE." exit 0 ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac echo $echo "Try \`$modename --help' for more information about other modes." exit 0 # Local Variables: # mode:shell-script # sh-indentation:2 # End: xdebug-2.2.3/debugclient/main.c0000644000175000017500000002024312147043204015633 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | | Marco Canini | +----------------------------------------------------------------------+ */ #include #include #ifndef WIN32 #include "config.h" #include #include #include #include #include #else #include #define socklen_t int #endif #include #include #include #ifdef HAVE_LIBEDIT #include #include #endif #include "usefulstuff.h" #ifdef WIN32 #define MSG_NOSIGNAL 0 #define sleep(t) Sleep((t)*1000) #define close(fd) closesocket(fd) #endif #ifndef MSG_NOSIGNAL #define MSG_NOSIGNAL 0 #endif #define DEBUGCLIENT_VERSION "0.10.0" #define DEFAULT_PORT 9000 #ifdef HAVE_LIBEDIT static char prompt[8]; static EditLine *el = NULL; static History *hist = NULL; #ifndef XSC_OLD_LIBEDIT static HistEvent ev; #endif void initialize_libedit(const char *prog); void deinitialize_libedit(); static char *get_prompt(EditLine *el); void handle_sigterm(int i); void initialize_libedit(const char *prog) { /* Init the builtin history */ hist = history_init(); /* Remember 100 events */ #ifdef XDC_OLD_LIBEDIT history(hist, XDC_H_SETSIZE, 100); #else history(hist, &ev, XDC_H_SETSIZE, 100); #endif /* Initialize editline */ #ifdef XDC_OLD_LIBEDIT el = el_init(prog, stdin, stdout); #else el = el_init(prog, stdin, stdout, stderr); #endif el_set(el, EL_EDITOR, "emacs"); /* Default editor is emacs */ el_set(el, EL_SIGNAL, 1); /* Handle signals gracefully */ el_set(el, EL_PROMPT, get_prompt); /* Set the prompt function */ /* Tell editline to use this history interface */ el_set(el, EL_HIST, history, hist); /* * Source the user's defaults file. */ /* el_source(el, "xdebug"); */ } void deinitialize_libedit(void) { el_end(el); history_end(hist); } static char *get_prompt(EditLine *el) { return prompt; } void handle_sigterm(int i) { deinitialize_libedit(); } #endif int main(int argc, char *argv[]) { int port = DEFAULT_PORT; /* Port number to listen for connections */ int ssocket = 0; /* Socket file descriptor */ int debug_once = 1; /* Whether to allow more than one debug session (1 = no) */ struct sockaddr_in server_in; struct sockaddr_in client_in; socklen_t client_in_len; int fd; /* Filedescriptor for userinput */ fd_buf cxt = { NULL, 0 }; struct in_addr *iaddr; char *buffer; /* Buffer with data from the server */ char *cmd; /* Command to send to the server */ char *prev_cmd = NULL; /* Last send command to the server */ int length; /* Length of read buffer */ #ifndef WIN32 int opt; /* Current option during parameter parsing */ #endif #ifdef HAVE_LIBEDIT int num = 0; /* Add SIGTERM signal handler */ signal (SIGTERM, handle_sigterm); initialize_libedit (argv[0]); #else fd_buf std_in = { NULL, 0 }; #endif #ifdef WIN32 /* Initialise Windows' WinSock library */ WORD wVersionRequested; WSADATA wsaData; wVersionRequested = MAKEWORD(2, 2); WSAStartup(wVersionRequested, &wsaData); #endif /* Display copyright notice and version number */ printf("Xdebug Simple DBGp client (%s)\n", DEBUGCLIENT_VERSION); printf("Copyright 2002-2007 by Derick Rethans.\n"); #ifdef HAVE_LIBEDIT printf("- libedit support: enabled\n"); #endif #ifndef WIN32 /* Option handling */ while (1) { opt = getopt(argc, argv, "hp:v1"); if (opt == -1) { break; } switch (opt) { case 'h': printf("\nUsage:\n"); printf("\tdebugclient [-h] [-p port] [-v]\n"); printf("\t-h\tShow this help\n"); printf("\t-p\tSpecify the port to listen on (default = 9000)\n"); printf("\t-v\tShow version number and exit\n"); printf("\t-1\tDebug once and then exit\n"); exit(0); break; case 'v': exit(0); break; case 'p': port = atoi(optarg); printf("Listening on TCP port %d.\n", port); break; case '1': debug_once = 0; break; } } #endif /* Main loop that listens for connections from the debug client and that * does all the communications handling. */ do { ssocket = socket(AF_INET, SOCK_STREAM, 0); if (ssocket < 0) { fprintf(stderr, "socket: couldn't create socket\n"); exit(-1); } memset(&server_in, 0, sizeof(struct sockaddr)); server_in.sin_family = AF_INET; server_in.sin_addr.s_addr = htonl(INADDR_ANY); server_in.sin_port = htons((unsigned short int) port); memset(&client_in, 0, sizeof(client_in)); client_in_len = sizeof(client_in); /* Loop until we can bind to the listening socket. */ while (bind(ssocket, (struct sockaddr *) &server_in, sizeof(struct sockaddr_in)) < 0) { fprintf(stderr, "bind: couldn't bind AF_INET socket?\n"); sleep(5); } if (listen(ssocket, 0) == -1) { fprintf(stderr, "listen: listen call failed\n"); exit(-2); } printf("\nWaiting for debug server to connect.\n"); #ifdef WIN32 fd = accept(ssocket, (struct sockaddr *) &client_in, NULL); if (fd == -1) { printf("accept: %d\n", WSAGetLastError()); exit(-3); } #else fd = accept(ssocket, (struct sockaddr *) &client_in, &client_in_len); if (fd == -1) { perror("accept"); exit(-3); } #endif close(ssocket); iaddr = &client_in.sin_addr; printf("Connect\n"); /* Get the message from the server*/ while ((buffer = fd_read_line_delim(fd, &cxt, FD_RL_SOCKET, '\0', &length)) > 0) { buffer = fd_read_line_delim(fd, &cxt, FD_RL_SOCKET, '\0', &length); printf ("%s\n", buffer); if (strstr(buffer, "/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = debugclient$(EXEEXT) subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure INSTALL config.guess config.sub \ depcomp install-sh ltmain.sh missing mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_debugclient_OBJECTS = main.$(OBJEXT) usefulstuff.$(OBJEXT) debugclient_OBJECTS = $(am_debugclient_OBJECTS) debugclient_LDADD = $(LDADD) debugclient_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(debugclient_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(debugclient_SOURCES) DIST_SOURCES = $(debugclient_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XDEBUG_MODULES = @XDEBUG_MODULES@ XDEBUG_MOD_MAKEFILES = @XDEBUG_MOD_MAKEFILES@ XDEBUG_STATIC_LDADD = @XDEBUG_STATIC_LDADD@ XDEBUG_STATIC_MODULES = @XDEBUG_STATIC_MODULES@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ debugclient_LDFLAGS = debugclient_SOURCES = main.c usefulstuff.c all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .o .obj am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ./Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ./Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) debugclient$(EXEEXT): $(debugclient_OBJECTS) $(debugclient_DEPENDENCIES) $(EXTRA_debugclient_DEPENDENCIES) @rm -f debugclient$(EXEEXT) $(debugclient_LINK) $(debugclient_OBJECTS) $(debugclient_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usefulstuff.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) config.h installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: all install-am install-strip .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \ dist-zip distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-tags distcleancheck \ distdir distuninstallcheck dvi dvi-am html html-am info \ info-am install install-am install-binPROGRAMS install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-binPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xdebug-2.2.3/debugclient/missing0000644000175000017500000000000012147043204016124 0ustar derickderickxdebug-2.2.3/debugclient/mkinstalldirs0000644000175000017500000000123412147043204017345 0ustar derickderick#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" 1>&2 mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here xdebug-2.2.3/debugclient/usefulstuff.c0000644000175000017500000000541212147043204017263 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #include #include #ifndef WIN32 #include #include #include #else #include #include #endif #include "usefulstuff.h" #define READ_BUFFER_SIZE 128 char* fd_read_line_delim(int socket, fd_buf *context, int type, unsigned char delim, int *length) { int size = 0, newl = 0, nbufsize = 0; char *tmp; char *tmp_buf = NULL; char *ptr; char buffer[READ_BUFFER_SIZE + 1]; if (!context->buffer) { context->buffer = calloc(1,1); context->buffer_size = 0; } while ((ptr = memchr(context->buffer, delim, context->buffer_size)) == NULL) { ptr = context->buffer + context->buffer_size; if (type == FD_RL_FILE) { newl = read(socket, buffer, READ_BUFFER_SIZE); } else { newl = recv(socket, buffer, READ_BUFFER_SIZE, 0); } if (newl > 0) { context->buffer = realloc(context->buffer, context->buffer_size + newl + 1); memcpy(context->buffer + context->buffer_size, buffer, newl); context->buffer_size += newl; context->buffer[context->buffer_size] = '\0'; } else { return NULL; } } ptr = memchr(context->buffer, delim, context->buffer_size); size = ptr - context->buffer; /* Copy that line into tmp */ tmp = malloc(size + 1); tmp[size] = '\0'; memcpy(tmp, context->buffer, size); /* Rewrite existing buffer */ if ((nbufsize = context->buffer_size - size - 1) > 0) { tmp_buf = malloc(nbufsize + 1); memcpy(tmp_buf, ptr + 1, nbufsize); tmp_buf[nbufsize] = 0; } free(context->buffer); context->buffer = tmp_buf; context->buffer_size = context->buffer_size - (size + 1); /* Return normal line */ if (length) { *length = size; } return tmp; } xdebug-2.2.3/debugclient/usefulstuff.h0000644000175000017500000000276312147043204017276 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #ifndef __HAVE_USEFULSTUFF_H__ #define __HAVE_USEFULSTUFF_H__ #define FD_RL_FILE 0 #define FD_RL_SOCKET 1 typedef struct _fd_buf fd_buf; struct _fd_buf { char *buffer; int buffer_size; }; #define fd_read_line(s,c,t) fd_read_line_delim(s, c, t, '\n', NULL) char* fd_read_line_delim(int socket, fd_buf *context, int type, unsigned char delim, int *length); #endif xdebug-2.2.3/config.m40000644000175000017500000000263012147043204013765 0ustar derickderickdnl $Id: config.m4,v 1.28 2008-07-31 00:43:35 sniper Exp $ dnl config.m4 for extension xdebug PHP_ARG_ENABLE(xdebug, whether to enable eXtended debugging support, [ --enable-xdebug Enable Xdebug support]) if test "$PHP_XDEBUG" != "no"; then AC_MSG_CHECKING([Check for supported PHP versions]) PHP_XDEBUG_FOUND_VERSION=`${PHP_CONFIG} --version` PHP_XDEBUG_FOUND_VERNUM=`echo "${PHP_XDEBUG_FOUND_VERSION}" | $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 100 + [$]2) * 100 + [$]3;}'` dnl if test "$PHP_XDEBUG_FOUND_VERNUM" -lt "50400"; then AC_MSG_RESULT([supported ($PHP_XDEBUG_FOUND_VERSION)]) dnl else dnl AC_MSG_ERROR([not supported. Need a PHP version < 5.4.0 (found $PHP_XDEBUG_FOUND_VERSION)]) dnl fi AC_DEFINE(HAVE_XDEBUG,1,[ ]) dnl Check for new current_execute_data field in zend_executor_globals old_CPPFLAGS=$CPPFLAGS CPPFLAGS="$INCLUDES $CPPFLAGS" AC_CHECK_FUNCS(gettimeofday) PHP_CHECK_LIBRARY(m, cos, [ PHP_ADD_LIBRARY(m,, XDEBUG_SHARED_LIBADD) ]) CPPFLAGS=$old_CPPFLAGS PHP_NEW_EXTENSION(xdebug, xdebug.c xdebug_code_coverage.c xdebug_com.c xdebug_compat.c xdebug_handler_dbgp.c xdebug_handlers.c xdebug_llist.c xdebug_hash.c xdebug_private.c xdebug_profiler.c xdebug_set.c xdebug_stack.c xdebug_str.c xdebug_superglobals.c xdebug_tracing.c xdebug_var.c xdebug_xml.c usefulstuff.c, $ext_shared,,,,yes) PHP_SUBST(XDEBUG_SHARED_LIBADD) PHP_ADD_MAKEFILE_FRAGMENT fi xdebug-2.2.3/config.w320000644000175000017500000000100012147043204014046 0ustar derickderick// $Id: config.w32,v 1.6 2009-04-06 20:41:21 derick Exp $ // vim:ft=javascript ARG_WITH("xdebug", "Xdebug support", "no"); if (PHP_XDEBUG == "yes") { EXTENSION("xdebug", "xdebug.c xdebug_code_coverage.c xdebug_com.c xdebug_compat.c xdebug_handler_dbgp.c xdebug_handlers.c xdebug_llist.c xdebug_hash.c xdebug_private.c xdebug_profiler.c xdebug_set.c xdebug_stack.c xdebug_str.c xdebug_superglobals.c xdebug_tracing.c xdebug_var.c xdebug_xml.c usefulstuff.c"); AC_DEFINE("HAVE_XDEBUG", 1, "Xdebug support"); } xdebug-2.2.3/CREDITS0000644000175000017500000000006512147043204013276 0ustar derickderickXdebug Derick Rethans, Ilia Alshanetsky, Harald Radi xdebug-2.2.3/LICENSE0000644000175000017500000000570412147043204013270 0ustar derickderick-------------------------------------------------------------------- The Xdebug License, version 1.01 (Based on "The PHP License", version 3.0) Copyright (c) 2003-2012 Derick Rethans. All rights reserved. -------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, is permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name "Xdebug" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact derick@xdebug.org. 4. Products derived from this software may not be called "Xdebug", nor may "Xdebug" appear in their name, without prior written permission from derick@xdebug.org. 5. Derick Rethans may publish revised and/or new versions of the license from time to time. Each version will be given a distinguishing version number. Once covered code has been published under a particular version of the license, you may always continue to use it under the terms of that version. You may also choose to use such covered code under the terms of any subsequent version of the license published by Derick Rethans. No one other than Derick Rethans has the right to modify the terms applicable to covered code created under this License. 6. Redistributions of any form whatsoever must retain the following acknowledgment: "This product includes Xdebug, freely available from ". THIS SOFTWARE IS PROVIDED BY DERICK RETHANS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------- This software consists of voluntary contributions made by some individuals on behalf of Derick Rethans. Derick Rethans can be contacted via e-mail at derick@xdebug.org. For more information Xdebug, please see . xdebug-2.2.3/Makefile.frag0000644000175000017500000000373412147043204014642 0ustar derickderickinstall: $(all_targets) $(install_targets) show-install-instructions show-install-instructions: @echo @$(top_srcdir)/build/shtool echo -n -e %B @echo " +----------------------------------------------------------------------+" @echo " | |" @echo " | INSTALLATION INSTRUCTIONS |" @echo " | ========================= |" @echo " | |" @echo " | See http://xdebug.org/install.php#configure-php for instructions |" @echo " | on how to enable Xdebug for PHP. |" @echo " | |" @echo " | Documentation is available online as well: |" @echo " | - A list of all settings: http://xdebug.org/docs-settings.php |" @echo " | - A list of all functions: http://xdebug.org/docs-functions.php |" @echo " | - Profiling instructions: http://xdebug.org/docs-profiling2.php |" @echo " | - Remote debugging: http://xdebug.org/docs-debugger.php |" @echo " | |" @echo " | |" @echo " | NOTE: Please disregard the message |" @echo " | You should add \"extension=xdebug.so\" to php.ini |" @echo " | that is emitted by the PECL installer. This does not work for |" @echo " | Xdebug. |" @echo " | |" @echo " +----------------------------------------------------------------------+" @$(top_srcdir)/build/shtool echo -n -e %b @echo @echo xdebug-2.2.3/Makefile.in0000644000175000017500000000067212147043204014327 0ustar derickderick# $Id: Makefile.in,v 1.11 2003-10-12 14:28:58 derick Exp $ LTLIBRARY_NAME = libxdebug.la LTLIBRARY_SOURCES = xdebug.c xdebug_com.c xdebug_llist.c xdebug_hash.c xdebug_handlers.c xdebug_handler_dbgp.c xdebug_handler_php3.c xdebug_handler_gdb.c usefulstuff.c xdebug_str.c xdebug_var.c xdebug_profiler.c LTLIBRARY_SHARED_NAME = xdebug.la LTLIBRARY_SHARED_LIBADD = $(XDEBUG_SHARED_LIBADD) include $(top_srcdir)/build/dynlib.mk xdebug-2.2.3/NEWS0000644000175000017500000013540312147043204012762 0ustar derickderickSun, Jul 15, 2012 - xdebug 2.2.1 = Fixed bugs: - Fixed bug #843: Text output depends on php locale. - Fixed bug #838/#839/#840: Debugging static properties crashes Xdebug. - Fixed bug #821: Variable assignments (beginning with =>) should be indented one more scope. - Fixed bug #811: PHP Documentation Link. - Fixed bug #800: var_dump(get_class(new foo\bar')) add an extra "\" in class name. Tue, May 08, 2012 - xdebug 2.2.0 + Added features: - Support for PHP 5.4. - Added ANSI colour output for the shell. (Including patches by Michael Maclean) - Added var_dump() overloading on the command line (issue #457). - Added better support for closures in stack and function traces. - Added the size of arrays to the overloaded variable output, so that you know how many elements there are. - Added support for X-HTTP-FORWARDED-FOR before falling back to REMOTE_ADDR (issue #660). (Patch by Hannes Magnusson) - Added the method call type to xdebug_get_function_stack() (issue #695). - Added extra information to error printouts to tell that the error suppression operator has been ignored due to xdebug.scream. - Added a error-specific CSS class to stack traces. + New settings: - xdebug.cli_color for colouring output on the command line (Unix only). - Added xdebug.trace_enable_trigger to triger function traces through a GET/POST/COOKIE parameter (issue #517). (Patch by Patrick Allaert) - Added support for the 'U' format specifier for function trace and profiler filenames. + Changes: - Improved performance by lazy-initializing data structures. - Improved code coverage performance. (Including some patches by Taavi Burns) - Improved compatibility with KCacheGrind. - Improved logging of remote debugging connections, by added connection success/failure logging to the xdebug.remote_log functionality. = Fixed bugs: - Fixed bug #827: Enabling Xdebug causes phpt tests to fail because of var_dump() formatting issues. - Fixed bug #823: Single quotes are escaped in var_dumped string output. - Fixed bug #819: Xdebug 2.2.0RC2 can't stand on a breakpoint more than 30 seconds. - Fixed bug #801: Segfault with streamwrapper and unclosed $fp on destruction. - Fixed bug #797: Xdebug crashes when fetching static properties. - Fixed bug #794: Allow coloured output on Windows. - Fixed bug #784: Unlimited feature for var_display_max_data and var_display_max_depth is undocumented. - Fixed bug #774: Apache crashes on header() calls. - Fixed bug #764: Tailored Installation instructions do not work. - Fixed bug #758: php_value xdebug.idekey is ignored in .htaccess files - Fixed bug #728: Profiler reports __call() invocations confusingly/wrongly. - Fixed bug #687: Xdebug does not show dynamically defined variable. - Fixed bug #662: idekey is set to running user. - Fixed bug #627: Added the realpath check. Mon, Mar 12, 2012 - xdebug 2.1.4 = Fixed bugs: - Fixed bug #788: Collect errors eats fatal errors. - Fixed bug #787: Segmentation Fault with PHP header_remove(). - Fixed bug #778: Xdebug session in Eclipse crash whenever it run into simplexml_load_string call. - Fixed bug #756: Added support for ZEND_*_*_OBJ and self::*. - Fixed bug #747: Still problem with error message and soap client / soap server. - Fixed bug #744: new lines in a PHP file from Windows are displayed with an extra white line with var_dump(). - Fixed an issue with debugging and the eval command. - Fixed compilation with ZTS on PHP < 5.3 Wed, Jan 25, 2012 - xdebug 2.1.3 = Fixed bugs: - Fixed bug #725: EG(current_execute_data) is not checked in xdebug.c, xdebug_statement_call. - Fixed bug #723: xdebug is stricter than PHP regarding Exception property types. - Fixed bug #714: Cachegrind files have huge (wrong) numbers in some lines. - Fixed bug #709: Xdebug doesn't understand E_USER_DEPRECATED. - Fixed bug #698: Allow xdebug.remote_connect_back to be set in .htaccess. - Fixed bug #690: Function traces are not appended to file with xdebug_start_trace() and xdebug.trace_options=1. - Fixed bug #623: Static properties of a class can be evaluated only with difficulty. - Fixed bug #614/#619: Viewing private variables in base classes through the debugger. - Fixed bug #609: Xdebug and SOAP extension's error handlers conflict. - Fixed bug #606/#678/#688/#689/#704: crash after using eval on an unparsable, or un-executable statement. - Fixed bug #305: xdebug exception handler doesn't properly handle special chars. + Changes: - Changed xdebug_break() to hint to the statement execution trap instead of breaking forcefully adding an extra stackframe. - Prevent Xdebug 2.1.x to build with PHP 5.4. Thu, Jul 28, 2011 - xdebug 2.1.2 = Fixed bugs: - Fixed bug #622: Working with eval() code is inconvenient and difficult. - Fixed bug #684: xdebug_var_dump - IE does not support &. - Fixed bug #693: Cachegrind files not written when filename is very long. - Fixed bug #697: Incorrect code coverage of function arguments when using XDEBUG_CC_UNUSED. - Fixed bug #699: Xdebug gets the filename wrong for the countable interface. - Fixed bug #703 by adding another opcode to the list that needs to be overridden. Mon, Mar 28, 2011 - xdebug 2.1.1 = Fixed bugs: - Fixed ZTS compilation. Tue, Mar 22, 2011 - xdebug 2.1.1rc1 = Fixed bugs: = Debugger - Fixed bug #518: Removed CLASSNAME pseudo-property optional. - Fixed bug #592: Xdebug crashes with run after detach. - Fixed bug #596: Call breakpoint never works with instance methods, only static methods. - Fixed JIT mode in the debugger so that it works for xdebug_break() too. = Profiler - Fixed bug #631: Summary not written when script ended with "exit()". - Fixed bug #639: Xdebug profiling: output not correct - missing 'cfl='. - Fixed bug #642: Fixed line numbers for offsetGet, offsetSet, __get/__set/__isset/__unset and __call in profile files and stack traces/function traces. - Fixed bug #643: Profiler gets line numbers wrong. - Fixed bug #653: XDebug profiler crashes with %H in file name and non standard port. = Others - Fixed bug #651: Incorrect code coverage after empty() in conditional. - Fixed bug #654: Xdebug hides error message in CLI. - Fixed bug #665: Xdebug does not respect display_errors=stderr. Patch by Ben Spencer - Fixed bug #670: Xdebug crashes with broken "break x" code. Tue, Jun 29, 2010 - xdebug 2.1.0 = Fixed bugs: - Fixed bug #562: Incorrect coverage information for closure function headers. - Fixed bug #566: Xdebug crashes when using conditional breakpoints. - Fixed bug #567: xdebug_debug_zval and xdebug_debug_zval_stdout don't work with PHP 5.3. (Patch by Endo Hiroaki). - Fixed bug #570: undefined symbol: zend_memrchr. Thu, Apr 06, 2010 - xdebug 2.1.0rc1 = Fixed bugs: - Fixed bug #494: Private attributes of parent class unavailable when inheriting. - Fixed bug #400: Xdebug shows errors, even when PHP is request startup mode. - Fixed bug #421: xdebug sends back invalid characters in xml sometimes. - Fixed bug #475: Property names with null chars are not sent fully to the client. - Fixed bug #480: Issues with the reserved resource in multi threaded environments (Patch by Francis.Grolemund@netapp.com). - Fixed bug #558: PHP segfaults when running a nested eval. Sat, Feb 27, 2010 - xdebug 2.1.0beta3 = Fixed bugs: - Fixed memory corruption issues. - Fixed a threading related issue for code-coverage. - Fixed bug #532: XDebug breaks header() function. - DBGP: Prevent Xdebug from returning properties when a too high page number has been requested. Wed, Feb 03, 2010 - xdebug 2.1.0beta2 = Fixed bugs: - Fixed memory leak in breakpoint handling. - Fixed bug #528: Core dump generated with remote_connect_back option set and CLI usage. - Fixed bug #515: declare(ticks) statement confuses code coverage. - Fixed bug #512: DBGP: breakpoint_get doesn't return conditions in its response. - Possible fix for bug #507/#517: Crashes because of uninitalised header globals. - Fixed bug #501: Xdebug's variable tracing misses POST_INC and variants. Sun, Jan 03, 2010 - xdebug 2.1.0beta1 + Added features: - Added error display collection and suppressions. - Added the recording of headers being set in scripts. - Added variable assignment tracing. - Added the ability to turn of the default overriding of var_dump(). - Added "Scream" support, which disables the @ operator. - Added a trace-file analysing script. - Added support for debugging into phars. - Added a default xdebug.ini. (Patch by Martin Schuhfuß ) - Added function parameters in computerized function traces. - PHP 5.3 compatibility. - Improved code coverage accuracy. + New functions: - xdebug_get_formatted_function_stack(), which returns a formatted function stack instead of displaying it. - xdebug_get_headers(), which returns all headers that have been set in a script, both explicitly with things like header(), but also implicitly for things like setcookie(). - xdebug_start_error_collection(), xdebug_stop_error_collection() and xdebug_get_collected_errors(), which allow you to collect all notices, warnings and error messages that Xdebug generates from PHP's error_reporting functionality so that you can output them at a later point in your script by hand. + New settings: - xdebug.collect_assignments, which enables the emitting of variable assignments in function traces. - xdebug.file_line_format, to generate a link with a specific format for every filename that Xdebug outputs. - xdebug.overload_var_dump, which allows you to turn off Xdebug's version of var_dump(). - xdebug.remote_cookie_expire_time, that controls the length of a remote debugging session. (Patch by Rick Pannen ) - xdebug.scream, which makes the @ operator to be ignored. + Changes: - Added return values for xdebug_start_code_coverage() and xdebug_stop_code_coverage() to indicate whether the action was succesfull. xdebug_start_code_coverage() will return TRUE if the call enabled code coverage, and FALSE if it was already enabled. xdebug_stop_code_coverage() will return FALSE when code coverage wasn't started yet and TRUE if it was turned on. - Added an optional argument to xdebug_print_function_stack() to display your own message. (Patch by Mikko Koppanen). - All HTML output as generated by Xdebug now has a HTML "class" attribute for easy CSS formatting. - Removed features: - Support for PHP versions lower than PHP 5.1 have been dropped. - The PHP3 and GDB debugger engines have been removed. = Fixed bugs: - Fixed support for showing $this in remote debugging sessions. - Fixed bug in formatting the display of "Variables in the local scope". - Possible fix for a threading issue where the headers gathering function would create stack overflows. - Possible fix for #324: xdebug_dump_superglobals() only dumps superglobals that were accessed before, and #478: XDebug 2.0.x can't use %R in xdebug.profiler_output_name if register_long_arrays is off. - Fixed bug #505: %s in xdebug.trace_output_name breaks functions traces. - Fixed bug #494: Private attributes of parent class unavailable when inheriting. - Fixed bug #486: feature_get -n breakpoint_types returns out of date list. - Fixed bug #476: Xdebug doesn't support PHP 5.3's exception chaining. - Fixed bug #472: Dead Code Analysis for code coverage messed up after goto. - Fixed bug #470: Catch blocks marked as dead code unless executed. - Fixed bug #469: context_get for function variables always appear as "uninitialized". - Fixed bug #468: Property_get on $GLOBALS works only at top-level, by adding GLOBALS to the super globals context. - Fixed bug #453: Memory leaks. - Fixed bug #445: error_prepend_string and error_append_string are ignored by xdebug_error_cb. (Patch by Kent Davidson ) - Fixed bug #442: configure: error: "you have strange libedit". - Fixed bug #439: Xdebug crash in xdebug_header_handler. - Fixed bug #423: Conflicts with funcall. - Fixed bug #419: Make use of P_tmpdir if defined instead of hard coded '/tmp'. - Fixed bug #417: Response of context_get may lack page and pagesize attributes. - Fixed bug #411: Class/function breakpoint setting does not follow the specs. - Fixed bug #393: eval returns array data at the previous page request. - Fixed bug #391: Xdebug doesn't stop executing script on catchable fatal errors. - Fixed bug #389: Destructors called on fatal error. - Fixed bug #368: Xdebug's debugger bails out on a parse error with the eval command. - Fixed bug #356: Temporary breakpoints persist. - Fixed bug #355: Function numbers in trace files weren't unique. - Fixed bug #340: Segfault while throwing an Exception. - Fixed bug #328: Private properties are incorrectly enumerated in case of extended classes. - Fixed bug #249: Xdebug's error handler messes up with the SOAP extension's error handler. + DBGP: - Fixed cases where private properties where shown for objects, but not accessible. - Added a patch by Lucas Nealan (lucas@php.net) and Brian Shire (shire@php.net) of Facebook to allow connections to the initiating request's IP address for remote debugging. - Added the -p argument to the eval command as well, pending inclusion into DBGP. - Added the retrieval of a file's execution lines. I added a new un-official method called xcmd_get_executable_lines which requires the stack depth as argument (-d). You can only fetch this information for stack frames as it needs an available op-array which is only available when a function is executed. - Added a fake "CLASSNAME" property to objects that are returned in debug requests to facilitate deficiencies in IDEs that fail to show the "classname" XML attribute. Fri, Jul 03, 2009 - xdebug 2.0.5 = Fixed bugs: - Fixed bug #425: memory leak (around 40MB for each request) when using xdebug_start_trace. - Fixed bug #422: Segfaults when using code coverage with a parse error in the script. - Fixed bug #418: compilation breaks with CodeWarrior for NetWare. - Fixed bug #403: 'call' and 'return' breakpoints triggers both on call and return for class method breakpoints. - Fixed TSRM issues for PHP 5.2 and PHP 5.3. (Original patch by Elizabeth M. Smith). - Fixed odd crash bugs, due to GCC 4 sensitivity. Tue, Dec 30, 2008 - xdebug 2.0.4 = Fixed bugs: - Fixed for strange jump positions in path analysis. - Fixed issues with code coverage crashing on parse errors. - Fixed code code coverage by overriding more opcodes. - Fixed issues with Xdebug stalling/crashing when detaching from remote debugging. - Fixed crash on Vista where memory was freed with routines from a different standard-C library than it was allocated with. (Patch by Eric Promislow ). - Link against the correct CRT library. (Patch by Eric Promislow ). - Sort the symbol elements according to name. (Patch by Eric Promislow ). - Fixed support for mapped-drive UNC paths for Windows. (Patch by Eric Promislow ). - Fixed a segfault in interactive mode while including a file. - Fixed a crash in super global dumping in case somebody was strange enough to reassign them to a value type other than an Array. - Simplify version checking for libtool. (Patch by PGNet ). - Fixed display of unused returned variables from functions in PHP 5.3. - Include config.w32 in the packages as well. - Fixed .dsp for building with PHP 4. + Added features: - Support debugging into phars. - Basic PHP 5.3 support. Wed, Apr 09, 2008 - xdebug 2.0.3 = Fixed bugs: - Fixed bug #338: Crash with: xdebug.remote_handler=req. - Fixed bug #334: Code Coverage Regressions. - Fixed abstract method detection for PHP 5.3. - Fixed code coverage dead-code detection. - Ignore ZEND_ADD_INTERFACE, which is on a different line in PHP >= 5.3 for some weird reason. + Changes: - Added a CSS-class for xdebug's var_dump(). - Added support for the new E_DEPRECATED. Sun, Nov 11, 2007 - xdebug 2.0.2 = Fixed bugs: - Fixed bug #325: DBGP: "detach" stops further sessions being established from Apache. - Fixed bug #321: Code coverage crashes on empty PHP files. - Fixed bug #318: Segmentation Fault in code coverage analysis. - Fixed bug #315: Xdebug crashes when including a file that doesn't exist. - Fixed bug #314: PHP CLI Error Logging thwarted when XDebug Loaded. - Fixed bug #300: Direction of var_dump(). - Always set the transaction_id and command. (Related to bug #313). Sat, Oct 20, 2007 - xdebug 2.0.1 + Changes: - Improved code coverage performance dramatically. - PHP 5.3 compatibility (no namespaces yet though). = Fixed bugs: - Fixed bug #301: Loading would cause SIGBUS on Solaris 10 SPARC. (Patch by Sean Chalmers) - Fixed bug #300: Xdebug does not force LTR rendering for its tables. - Fixed bug #299: Computerized traces don't have a newline for return entries if memory limit is not enabled. - Fixed bug #298: xdebug_var_dump() doesn't handle entity replacements correctly concerning string length. - Fixed a memory free error related to remote debugging conditions. (Related to bug #297). Wed, Jul 18, 2007 - xdebug 2.0.0 + Changes: - Put back the disabling of stack traces - apperently people were relying on this. This brings back xdebug_enable(), xdebug_disable() and xdebug_is_enabled(). - xdebug.collect_params is no longer a boolean setting. Although it worked fine, phpinfo() showed only just On or Off here. - Fixed the Xdebug version of raw_url_encode to not encode : and \. This is not necessary according to the RFCs and it makes debug breakpoints work on Windows. = Fixed bugs: - Fixed bug #291: Tests that use SPL do not skip when SPL is not available. - Fixed bug #290: Function calls leak memory. - Fixed bug #289: Xdebug terminates connection when eval() is run in the init stage. - Fixed bug #284: Step_over on breakpointed line made Xdebug break twice. - Fixed bug #283: Xdebug always returns $this with the value of last stack frame. - Fixed bug #282: %s is not usable for xdebug.profiler_output_name on Windows in all stack frames. - Fixed bug #280: var_dump() doesn't display key of array as expected. - Fixed bug #278: Code Coverage Issue. - Fixed bug #273: Remote debugging: context_get does not return context id. - Fixed bug #270: Debugger aborts when PHP's eval() is encountered. - Fixed bug #265: XDebug breaks error_get_last() . - Fixed bug #261: Code coverage issues by overloading zend_assign_dim. + DBGP: - Added support for "breakpoint_languages". Wed, May 17, 2007 - xdebug 2.0.0rc4 + Changes: - Use µ seconds instead of a tenths of µ seconds to avoid confusion in profile information. - Changed xdebug.profiler_output_name and xdebug.trace_output_name to use modifier tags: %c = crc32 of the current working directory %p = pid %r = random number %s = script name %t = timestamp (seconds) %u = timestamp (microseconds) %H = $_SERVER['HTTP_HOST'] %R = $_SERVER['REQUEST_URI'] %S = session_id (from $_COOKIE if set) %% = literal % = Fixed bugs: - Fixed bug #255: Call Stack Table doesn't show Location on Windows. - Fixed bug #251: Using the source command with an invalid filename returns unexpected result. - Fixed bug #243: show_exception_trace="0" ignored. - Fixed bug #241: Crash in xdebug_get_function_stack(). - Fixed bug #240: Crash with xdebug.remote_log on Windows. - Fixed a segfault in rendering stack traces to error logs. - Fixed a bug that prevented variable names from being recorded for remote debug session while xdebug.collect_vars was turned off. - Fixed xdebug_dump_superglobals() in case no super globals were configured. - Removed functions: - Removed support for Memory profiling as that didn't work properly. - Get rid of xdebug.default_enable setting and associated functions: xdebug_disable() and xdebug_enable(). + Added features: - Implemented support for four different xdebug.collect_params settings for stack traces and function traces. - Allow to trigger profiling by the XDEBUG_PROFILE cookie. + DBGP: - Correctly add namespace definitions to XML. - Added the xdebug namespace that adds extra information to breakpoints if available. - Stopped the use of elements for exception breakpoints, as that violates the protocol. Wed, Jan 31, 2007 - xdebug 2.0.0rc3 + Changes: - Removed the bogus "xdebug.allowed_clients" setting - it was not implemented. - Optimized used variable collection by switching to a linked list instead of a hash. This is about 30% faster, but it needed a quick conversion to hash in the case the information had to be shown to remove duplicate variable names. = Fixed bugs: - Fixed bug #232: PHP log_errors functionality lost after enabling xdebug error handler when CLI is used. - Fixed problems with opening files - the filename could cause double free issues. - Fixed memory tracking as memory_limit is always enabled in PHP 5.2.1 and later. - Fixed a segfault that occurred when creating printable stack traces and collect_params was turned off. Sun, Dec 24, 2006 - xdebug 2.0.0rc2 + Added new features: - Implemented the "xdebug.var_display_max_children" setting. The default is set to 128 children. - Added types to fancy var dumping function. - Implemented FR #210: Add a way to stop the debug session without having to execute a script. The GET/POST parameter "XDEBUG_SESSION_STOP_NO_EXEC" works in the same way as XDEBUG_SESSION_STOP, except that the script will not be executed. - DBGP: Allow postmortem analysis. - DBGP: Added the non-standard function xcmd_profiler_name_get. + Changes: - Fixed the issue where xdebug_get_declared_vars() did not know about variables there are in the declared function header, but were not used in the code. Due to this change expected arguments that were not send to a function will now show up as ??? in stack and function traces in PHP 5.1 and PHP 5.2. - Allow xdebug.var_display_max_data and xdebug.var_display_max_depth settings of -1 which will unlimit those settings. - DBGP: Sort super globals in Globals overview. - DBGP: Fixed a bug where error messages where not added upon errors in the protocol. - DBGP: Change context 1 from globals (superglobals + vars in bottom most stack frame) to just superglobals. = Fixed bugs: - Fixed linking error on AIX by adding libm. - Fixed dead code analysis for THROW. - Fixed oparray prefill caching for code coverage. - Fixed the xdebug.remote_log feature work. - DBGP: Fixed a bug where $this did not appear in the local scoped context. - DBGP: Reimplemented property_set to use the same symbol fetching function as property_get. We now only use eval in case no type (-t) argument was given. - DBGP: Fixed some issues with finding out the classname, which is important for fetching private properties. - DBGP: Fixed usage of uninitialized memory that prevented looking up numerical array keys while fetching array elements not work properly. - Fixed bug #228: Binary safety for stream output and property fetches. - Fixed bug #227: The SESSION super global does not show up in the Globals scope. - Fixed bug #225: xdebug dumps core when protocol is GDB. - Fixed bug #224: Compile failure on Solaris. - Fixed bug #219: Memory usage delta in traces don't work on PHP 5.2.0. - Fixed bug #215: Cannot retrieve nested arrays when the array key is a numeric index. - Fixed bug #214: The depth level of arrays was incorrectly checked so it would show the first page of a level too deep as well. - Fixed bug #213: Dead code analysis doesn't take catches for throws into account. - Fixed bug #211: When starting a new session with a different idekey, the cookie is not updated. - Fixed bug #209: Additional remote debugging session started when triggering shutdown function. - Fixed bug #208: Socket connection attempted when XDEBUG_SESSION_STOP. - Fixed PECL bug #8989: Compile error with PHP 5 and GCC 2.95. Sun, Oct 08, 2006 - xdebug 2.0.0rc1 + Added new features: - Implemented FR #70: Provide optional depth on xdebug_call_* functions. - Partially implemented FR #50: Resource limiting for variable display. By default only two levels of nested variables and max string lengths of 512 are shown. This can be changed by setting the ini settings xdebug.var_display_max_depth and xdebug.var_display_max_data. - Implemented breakpoints for different types of PHP errors. You can now set an 'exception' breakpoint on "Fatal error", "Warning", "Notice" etc. This is related to bug #187. - Added the xdebug_print_function_trace() function to display a stack trace on demand. - Reintroduce HTML tracing by adding a new tracing option "XDEBUG_TRACE_HTML" (4). - Made xdebug_stop_trace() return the trace file name, so that the following works: - Added the xdebug.collect_vars setting to tell Xdebug to collect information about which variables are used in a scope. Now you don't need to show variables with xdebug.show_local_vars anymore for xdebug_get_declared_vars() to work. - Make the filename parameter to the xdebug_start_trace() function optional. If left empty it will use the same algorithm to pick a filename as when you are using the xdebug.auto_trace setting. + Changes: - Implemented dead code analysis during code coverage for: * abstract methods. * dead code after return, throw and exit. * implicit returns when a normal return is present. - Improved readability of stack traces. - Use PG(html_errors) instead of checking whether we run with CLI when deciding when to use HTML messages or plain text messages. = Fixed bugs: - Fixed bug #203: PHP errors with HTML content processed incorrectly. This patch backs out the change that was made to fix bug #182. - Fixed bug #198: Segfault when trying to use a non-existing debug handler. - Fixed bug #197: Race condition fixes created too many files. - Fixed bug #196: Profile timing on Windows does not work. - Fixed bug #195: CLI Error after debugging session. - Fixed bug #193: Compile problems with PHP 5.2. - Fixed bug #191: File/line breakpoints are case-sensitive on Windows. - Fixed bug #181: Xdebug doesn't handle uncaught exception output correctly. - Fixed bug #173: Coverage produces wrong coverage. - Fixed a typo that prevented the XDEBUG_CONFIG option "profiler_enable" from working. Fri, Jun 30, 2006 - xdebug 2.0.0beta6 + Added new features: - Implemented FR #137: feature_get for general commands doesn't have a text field. - Implemented FR #131: XDebug needs to implement paged child object requests. - Implemented FR #124: Add backtrace dumping information when exception thrown. - Implemented FR #70: Add feature_get breakpoint_types. - Added profiling aggregation functions (patch by Andrei Zmievski) - Implemented the "timestamp" option for the xdebug.trace_output_name and xdebug.profiler_output_name settings. - Added the xdebug.remote_log setting that allows you to log debugger communication to a log file for debugging. This can also be set through the "remote_log" element in the XDEBUG_CONFIG environment variable. - Added a "script" value to the profiler_output_name option. This will write the profiler output to a filename that consists of the script's full path (using underscores). ie: /var/www/index.php becomes var_www_index_php_cachegrind.out. (Patch by Brian Shire). - DBGp: Implemented support for hit conditions for breakpoints. - DBGp: Added support for conditions for file/line breakpoints. - DBGp: Added support for hit value checking to file/line breakpoints. - DBGp: Added support for "exception" breakpoints. + Performance improvements: - Added a cache that prevents the code coverage functionality from running a "which code is executable check" on every function call, even if they were executed multiple times. This should speed up code coverage a lot. - Speedup Xdebug but only gathering information about variables in scopes when either remote debugging is used, or show_local_vars is enabled. = Fixed bugs: - Fixed bug #184: problem with control chars in code traces - Fixed bug #183: property_get -n $this->somethingnonexistent crashes the debugger. - Fixed bug #182: Errors are not html escaped when being displayed. - Fixed bug #180: collected includes not shown in trace files. (Patch by Cristian Rodriguez) - Fixed bug #178: $php_errormsg and Track errors unavailable. - Fixed bug #177: debugclient fails to compile due to Bison. - Fixed bug #176: Segfault using SplTempFileObject. - Fixed bug #173: Xdebug segfaults using SPL ArrayIterator. - Fixed bug #171: set_time_limit stack overflow on 2nd request. - Fixed bug #168: Xdebug's DBGp crashes on an eval command where the result is an array. - Fixed bug #125: show_mem_delta does not calculate correct negative values on 64bit machines. - Fixed bug #121: property_get -n $r[2] returns the whole hash. - Fixed bug #111: xdebug does not ignore set_time_limit() function during debug session. - Fixed bug #87: Warning about headers when "register_shutdown_function" used. - Fixed PECL bug #6940 (XDebug ignores set_time_limit) - Fixed Komodo bug 45484: no member data for objects in PHP debugger. - Suppress NOP/EXT_NOP from being marked as executable code with Code Coverage. Sat, Dec 31, 2005 - xdebug 2.0.0beta5 + Added new features: - Implemented FR #161: var_dump doesn't show lengths for strings. - Implemented FR #158: Function calls from the {main} scope always have the line number 0. - Implemented FR #156: it's impossible to know the time taken by the last func call in xdebug trace mode 0. - Implemented FR #153: xdebug_get_declared_vars(). = Fixed bugs: - Fixed shutdown crash with ZTS on Win32 - Fixed bad memory leak when a E_ERROR of exceeding memory_limit was thrown. - Fixed bug #154: GCC 4.0.2 optimizes too much out with -O2. - Fixed bug #141: Remote context_get causes segfault. Thu, Sep 24, 2005 - xdebug 2.0.0beta4 + Added new features: - Added xdebug_debug_zval_stdout(). - Added xdebug_get_profile_filename() function which returns the current profiler dump file. - Updated for latest 5.1 and 6.0 CVS versions of PHP. - Added FR #148: Option to append to cachegrind files, instead of overwriting. - Implemented FR #114: Rename tests/*.php to tests/*.inc - Changed features: - Allow "xdebug.default_enable" to be set everywhere. = Fixed bugs: - DBGP: Xdebug should return "array" with property get, which is defined in the typemap to the common type "hash". - Debugclient: Will now build with an older libedit as found in FreeBSD 4.9. - Fixed bug #142: xdebug crashes with implicit destructor calls. - Fixed bug #136: The "type" attribute is missing from stack_get returns. - Fixed bug #133: PHP scripts exits with 0 on PHP error. - Fixed bug #132: use of eval causes a segmentation fault. Thu, May 12, 2005 - xdebug 2.0.0beta3 + Added new features: - Added the possibility to trigger the profiler by setting "xdebug.profiler_enable_trigger" to 1 and using XDEBUG_PROFILE as a get parameter. + Added new functions: - xdebug_get_profiler_filename() to retrieve the name of the dump file used by profiler. = Fixed bugs: - Fixed a segfault for when an attribute value is NULL on XML string generation. - Fixed bug #118: Segfault with exception when remote debugging. - Fixed bug #117: var_dump dows not work with "private". - Fixed bug #109: DBGP's eval will abort the script when the eval statement is invalid. - Fixed bug #108: log_only still displays some text for errors in included files. - Fixed bug #107: Code Coverage only detects executable code in used functions and classes. - Fixed bug #103: crash when running the DBGp command 'eval' on a global variable - Fixed bug #95: Segfault when deinitializing Xdebug module. (Patch by Maxim Poltarak ) Sun, Nov 28, 2004 - xdebug 2.0.0beta2 + Added new features: - DBGP: Added error messages to returned errors (in most cases) + Added new functions: - xdebug_debug_zval() to debug zvals by printing its refcounts and is_ref values. = Changed features: - xdebug_code_coverage_stop() will now clean up the code coverage array, unless you specify FALSE as parameter. - The proper Xdebug type is "hash" for associative arrays. - Extended the code-coverage functionality by returning lines with executable code on them, but where not executed with a count value of -1. = Fixed bugs: - DBGP: Make property_get and property_value finally work as they should, including retrieving information from different depths then the most top stack frame. - DBGP: Fix eval'ed $varnames in property_get. - DBGP: Support the -d option for property_get. - Fixed the exit handler hook to use the new "5.1" way of handling it; which fortunately also works with PHP 5.0. - Fixed bug #102: Problems with configure for automake 1.8. - Fixed bug #101: crash with set_exeception_handler() and uncatched exceptions. - Fixed bug #99: unset variables return the name as a string with property_get. - Fixed bug #98: 'longname' attribute not returned for unintialized property in context_get request. - Fixed bug #94: xdebug_sprintf misbehaves with x86_64/glibc-2.3.3 - Fixed bug #93: Crash in lookup_hostname on x86_64 - Fixed bug #92: xdebug_disable() doesn't disable the exception handler. - Fixed bug #68: Summary not written when script ended with "exit()". Wed, Sep 15, 2004 - xdebug 2.0.0beta1 + Added new features: - Added support for the new DBGp protocol for communicating with the debug engine. - A computerized trace format for easier parsing by external programs. - The ability to set remote debugging features via the environment. This allows an IDE to emulate CGI and still pass the configuration through to the debugger. In CGI mode, PHP does not allow -d arguments. - Reimplementation of the tracing code, you can now only trace to file; this greatly enhances performance as no string representation of variables need to be kept in memory any more. - Re-implemented profiling support. Xdebug outputs information the same way that cachegrind does so it is possible to use Kcachegrind as front-end. - Xdebug emits warnings when it was not loaded as a Zend extension. - Added showing private, protected and public to the fancy var_dump() replacement function. - Added the setting of the TCP_NODELAY socket option to stop delays in transferring data to the remote debugger client. (Patch by Christof J. Reetz) + DebugClient: Added setting for port to listen on and implemented running the previous command when pressing just enter. + Added new functions: - xdebug_get_stack_depth() to return the current stack depth level. - xdebug_get_tracefile_name() to retrieve the name of the tracefile. This is useful in case auto trace is enabled and you want to clean the trace file. - xdebug_peak_memory_usage() which returns the peak memory used in a script. (Only works when --enable-memory-limit was enabled) + Added feature requests: - FR #5: xdebug_break() function which interupts the script for the debug engine. - FR #30: Dump current scope information in stack traces on error. - FR #88: Make the url parameter XDEBUG_SESSION_START optional. So it can be disabled and the user does not need to add it. + Added new php.ini settings: - xdebug.auto_trace_file: to configure a trace file to write to as addition to the xdebug.auto_trace setting which just turns on tracing. - xdebug.collect_includes: separates collecting names of include files from the xdebug.collect_params setting. - xdebug.collect_return: showing return values in traces. - xdebug.dump_global: with which you can turn off dumping of super globals even in you have that configured. - xdebug.extended_info: turns off the generation of extended opcodes that are needed for stepping and breakpoints for the remote debugger. This is useful incase you want to profile memory usage as the generation of this extended info increases memory usage of oparrrays by about 33%. - xdebug.profiler_output_dir: profiler output directory. - xdebug.profiler_enable: enable the profiler. - xdebug.show_local_vars: turn off the showing of local variables in the top most stack frame on errors. - xdebug.show_mem_delta: show differences between current and previous memory usage on a function call level. - xdebug.trace_options: to configure extra options for trace dumping: o XDEBUG_TRACE_APPEND option (1) = Changed features: - xdebug_start_trace() now returns the filename of the tracefile (.xt is added to the requested name). - Changed default debugging protocol to dbgp instead of gdb. - Changed default debugger port from 17869 to 9000. - Changed trace file naming: xdebug.trace_output_dir is now used to configure a directory to dump automatic traces; the trace file name now also includes the pid (xdebug.trace_output_name=pid) or a crc32 checksum of the current working dir (xdebug.trace_output_name=crc32) and traces are not being appended to an existing file anymore, but simply overwritten. - Removed $this and $GLOBALS from showing variables in the local scope. - Removed functions: - xdebug_get_function_trace/xdebug_dump_function_trace() because of the new idea of tracing. = Fixed bugs: - Fixed bug #89: var_dump shows empty strings garbled. - Fixed bug #85: Xdebug segfaults when no idekey is set. - Fixed bug #83: More than 32 parameters functions make xdebug crash. - Fixed bug #75: xdebug's var_dump implementation is not binary safe. - Fixed bug #73: komodo beta 4.3.7 crash. - Fixed bug #72: breakpoint_get returns wrong structure. - Fixed bug #69: Integer overflow in cachegrind summary. - Fixed bug #67: Filenames in Xdebug break URI RFC with spaces. - Fixed bug #64: Missing include of xdebug_compat.h. - Fixed bug #57: Crash with overloading functions. - Fixed bug #54: source command did not except missing -f parameter. - Fixed bug #53: Feature get misusing the supported attribute. - Fixed bug #51: Only start a debug session if XDEBUG_SESSION_START is passed as GET or POST parameter, or the DBGP_COOKIE is send to the server. Passing XDEBUG_SESSION_STOP as GET/POST parameter will end the debug session and removes the cookie again. The cookie is also passed to the remote handler backends; for DBGp it is added to the packet. - Fixed bug #49: Included file's names should not be stored by address. - Fixed bug #44: Script time-outs should be disabled when debugging. - Fixed bug #36: GDB handler using print causes segfault with wrong syntax - Fixed bug #33: Implemented the use of the ZEND_POST_DEACTIVATE hook. Now we can handle destructors safely too. - Fixed bug #32: Unusual dynamic variables cause xdebug to crash. Fri, Dec 26, 2003 - xdebug 1.3.0 + GDB: Added file/line to signals. (Derick) = Fixed logging to adhere to the error_reporting setting. (Derick) = Fixed bug #32: Unusual dynamic variables cause xdebug to crash. (Ilia) = Fixed bug #31: & entity replaced after others, wrong HTML output. (Derick) = Fixed bug #22: Segmentation fault with xdebug_get_function_stack() and collect_params=1. (Derick) Tue, Nov 08, 2003 - xdebug 1.3.0rc2 + Added version info to handlers which show in phpinfo() output. (Derick) = GDB: Fixed bug with continuing after breakpoint where only 'cont' worked. (Derick) = GDB: Fixed bug in deleting absolute breakpoints on Windows. (Derick) = Fixed bug #27: Repeated connect attempts when no debugger is listening. (Derick) = Fixed bug #19: The value of xdebug.output_dir in a .htaccess never takes effect. (Derick) = Fixed bug #18: Mistyped sizeof()'s for array indexes in profiler output. (Derick) = Fixed handling stack traces for when display_errors was set to Off. (Derick) = Fixed segfault where a function name didn't exist in case of a "call_user_function". (Derick) = Fixed reading a filename in case of an callback to a PHP function from an internal function (like "array_map()"). (Derick) Thu, Sep 18, 2003 - xdebug 1.3.0rc1 = Fixed bug with wrong file names for functions called from call_user_*(). (Derick) + Added the option "dump_superglobals" to the remote debugger. If you set this option to 0 the "show-local" and similar commands will not return any data from superglobals anymore. (Derick) = Fixed bug #2: "pear package" triggers a segfault. (Derick) = Fixed crash bug when a function had sprintf style parameters (ie. strftime()). (Derick) + Added "id" attribute to elements in responses from the remove debugger when the response method is XML. This makes it possible to distinguish between unique elements by use of recursion for example. (Derick) = Improved performance greatly by doing lazy folding of variables outside trace mode. (Derick) = Fixed a bug with "quit", if it was used it disabled the extension for the current process. (Derick) + Added the "full" argument to the remote command "backtrace". When this argument is passed, the local variables will be returned to for each frame in the stack. (Derick) + Implemented xdebug_time_index() which returns the time passed since the start of the script. This change also changes the output of the tracing functions as the start time will no longer be the first function call, but the real start time of the script. (Derick) + Implemented the "show-local" command (shows all local variables in the current scope including all contents). (Derick) + Implemented conditions for breakpoints in the "break" command. (Derick) Mon, Apr 21, 2003 - xdebug 1.2.0 = Fixed compilation on MacOSX. (Derick) Tue, Apr 15, 2003 - xdebug 1.2.0rc2 = Fixed handling Windows paths in the debugger. (Derick) = Fixed getting zvals out of Zend Engine 2. (Derick) Sun, Apr 6, 2003 - xdebug 1.2.0rc1 + Added code coverage functions to check which lines and how often they were touched during execution. (Derick) + Made Xdebug compatible with Zend Engine 2. (Derick) + Added dumping of super globals on errors. (Harald Radi) + Added XML protocol for the debugger client. (Derick) = Fixed handling of "continue" (so that it also continues with the script). (Derick) + Additions to the remote debugger: "eval" (evaluate any PHP code from the debugger client). (Derick) + Added profiling support to xdebug. This introduces 3 new functions, xdebug_start_profiling() that begins profiling process, xdebug_stop_profiling() that ends the profiling process and xdebug_dump_function_trace() that dumps the profiling data. (Ilia) + Implemented the "kill" (kills the running script) and "delete" (removes a breakpoint on a specified element) command. (Derick) Wed Nov 11, 2002 - xdebug 1.1.0 + Implemented the "list" (source listing), "print" (printing variable contents), "show" (show all variables in the scope), "step" (step through execution), "pwd" (print working directory), "next" (step over) and "finish" (step out) commands for the remote debugger. (Derick) = Fixed lots of small bugs, under them memory leaks and crash bugs. (Derick) = Parameters to functions are no longer recorded by default; use the xdebug.collect_params=1 setting in php.ini to turn it on again. Tue Oct 29, 2002 - xdebug 1.1.0pre2 + Implemented class::method, object->method and file.ext:line style breakpoints. (Derick) = Changed debugger port from 7869 to 17869. (Derick) + Added xdebug.collect_params setting. If this setting is on (the default) then Xdebug collects all parameters passed to functions, otherwise they are not collected at all. (Derick) + Implemented correct handling of include/require and eval. (Derick) Mon Oct 22, 2002 - xdebug 1.1.0pre1 + Added automatic starting of function traces (xdebug.auto_trace, defaulting to "off"). (Derick) - Xdebug no longer supports PHP versions below PHP 4.3.0pre1. (Derick) + Added gdb compatible debugger handler with support for simple (function only) breakpoints. (Derick) = Implemented a new way to get class names and file names. (Derick, Thies C. Arntzen ) + Added time-index and memory footprint to CLI dumps. (Derick) + Implemented remote debugger handler abstraction. (Derick) + Added a php3 compatible debugger handler. (Derick) Sun Sep 1, 2002 - xdebug 1.0.0rc1 + Implemented gathering of parameters to internal functions (only available in combination with PHP 4.3.0-dev). (Derick) = Implemented a new way to get class names and file names. (Derick, Thies C. Arntzen ) + Added support for error messages with stack trace in syslog. (Sergio Ballestrero ) = Windows compilation fixes. (Derick) Sun Jun 23, 2002 - xdebug 0.9.0 = Fixed a problem with output buffering in PHP. (Derick) = Fixed a memory leak in delayed included files. (Derick) + Added support for PHP 4.1.2. (Derick) = Rewrote xdebug_get_function_stack() and xdebug_get_function_trace() to return data in multidimensional arrays. (Derick) = Fixed compiling without memory limit enabled (Sander Roobol, Derick) + Add support for classnames, variable include files and variable function names. (Derick) + Implemented links to the PHP Manual in traces. (Derick) + Added timestamps and memory usage to function traces. (Derick) = Fixed crash when using an user defined session handler. (Derick) + Implemented variable function names ($a = 'foo'; $f();) for use in traces. (Derick) Sun May 26, 2002 - xdebug 0.8.0 - Yoda + Implemented much better parameter tracing for user defined functions. (Derick) = Renamed xdebug_get_function_trace() to xdebug_dump_function_trace(). (Derick) = Implemented new xdebug_get_function_trace() to return the function trace in an array. (Derick) + Added a parameter to xdebug_start_trace(). When this parameter is used, xdebug will dump a function trace to the filename which this parameter speficies. (Derick) + Fix a problem with nested member functions. (Derick) = Make configure scripts work with PHP 4.2.x. (Derick) + Implemented handling single-dimensional constant arrays passed to a function. (Derick) = Fix function traces in windows. (Derick) + Implemented function traces, which you can start and stop with xdebug_start_trace() and xdebug_stop_trace(). You can view the trace by using the return array from xdebug_get_function_trace(). (Derick) = Fixed segfaults with xdebug_call_*(). (Derick) Wed May 08, 2002 - xdebug 0.7.0 - Freedom + Implemented handling of static method calls (foo::bar). (Derick) + Added correct handling of include(_once)/require(_once) and eval(). (Derick) + Added ini setting to change the default setting for enabling showing enhanced error messages. (Defaults to "On"). (Derick) + Added the functions xdebug_enable() and xdebug_disable() to change the showing of stack traces from within your code. (Derick) = Fixed the extension to show all errors. (Derick) + Implemented xdebug_memory_usage() which returns the memory in use by PHPs engine. (Derick) Legenda: + New additions - Removed functions = Bug fixes / Changes xdebug-2.2.3/php_xdebug.h0000644000175000017500000002061012147043204014552 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #ifndef PHP_XDEBUG_H #define PHP_XDEBUG_H #define XDEBUG_NAME "Xdebug" #define XDEBUG_VERSION "2.2.3" #define XDEBUG_AUTHOR "Derick Rethans" #define XDEBUG_COPYRIGHT "Copyright (c) 2002-2013 by Derick Rethans" #define XDEBUG_COPYRIGHT_SHORT "Copyright (c) 2002-2013" #define XDEBUG_URL "http://xdebug.org" #define XDEBUG_URL_FAQ "http://xdebug.org/docs/faq#api" #include "php.h" #include "xdebug_handlers.h" #include "xdebug_hash.h" #include "xdebug_llist.h" #include "xdebug_code_coverage.h" extern zend_module_entry xdebug_module_entry; #define phpext_xdebug_ptr &xdebug_module_entry #define MICRO_IN_SEC 1000000.00 #define OUTPUT_NOT_CHECKED -1 #define OUTPUT_IS_TTY 1 #define OUTPUT_NOT_TTY 0 #ifdef PHP_WIN32 #define PHP_XDEBUG_API __declspec(dllexport) #else #define PHP_XDEBUG_API #endif #ifdef ZTS #include "TSRM.h" #endif #include "main/SAPI.h" #if MEMORY_LIMIT # define HAVE_PHP_MEMORY_USAGE 1 #elif PHP_VERSION_ID >= 50201 # define HAVE_PHP_MEMORY_USAGE 1 #else # define HAVE_PHP_MEMORY_USAGE 0 #endif #if PHP_VERSION_ID >= 50200 # define XG_MEMORY_USAGE() zend_memory_usage(0 TSRMLS_CC) # define XG_MEMORY_PEAK_USAGE() zend_memory_peak_usage(0 TSRMLS_CC) #else # define XG_MEMORY_USAGE() AG(allocated_memory) # define XG_MEMORY_PEAK_USAGE() AG(allocated_memory_peak) #endif #if PHP_VERSION_ID >= 50300 # define XG_SAPI_HEADER_OP_DC , sapi_header_op_enum op # define XG_SAPI_HEADER_OP_CC , op #else # define XG_SAPI_HEADER_OP_DC # define XG_SAPI_HEADER_OP_CC #endif PHP_MINIT_FUNCTION(xdebug); PHP_MSHUTDOWN_FUNCTION(xdebug); PHP_RINIT_FUNCTION(xdebug); PHP_RSHUTDOWN_FUNCTION(xdebug); PHP_MINFO_FUNCTION(xdebug); ZEND_MODULE_POST_ZEND_DEACTIVATE_D(xdebug); #ifndef PHP_WIN32 int xdebug_is_output_tty(); #endif /* call stack functions */ PHP_FUNCTION(xdebug_get_stack_depth); PHP_FUNCTION(xdebug_get_function_stack); PHP_FUNCTION(xdebug_get_formatted_function_stack); PHP_FUNCTION(xdebug_print_function_stack); PHP_FUNCTION(xdebug_get_declared_vars); PHP_FUNCTION(xdebug_call_class); PHP_FUNCTION(xdebug_call_function); PHP_FUNCTION(xdebug_call_file); PHP_FUNCTION(xdebug_call_line); PHP_FUNCTION(xdebug_set_time_limit); PHP_FUNCTION(xdebug_var_dump); PHP_FUNCTION(xdebug_debug_zval); PHP_FUNCTION(xdebug_debug_zval_stdout); /* activation functions */ PHP_FUNCTION(xdebug_enable); PHP_FUNCTION(xdebug_disable); PHP_FUNCTION(xdebug_is_enabled); /* breaking functions */ PHP_FUNCTION(xdebug_break); /* tracing functions */ PHP_FUNCTION(xdebug_start_trace); PHP_FUNCTION(xdebug_stop_trace); PHP_FUNCTION(xdebug_get_tracefile_name); /* error collecting functions */ PHP_FUNCTION(xdebug_start_error_collection); PHP_FUNCTION(xdebug_stop_error_collection); PHP_FUNCTION(xdebug_get_collected_errors); /* profiling functions */ PHP_FUNCTION(xdebug_get_profiler_filename); PHP_FUNCTION(xdebug_dump_aggr_profiling_data); PHP_FUNCTION(xdebug_clear_aggr_profiling_data); /* misc functions */ PHP_FUNCTION(xdebug_dump_superglobals); PHP_FUNCTION(xdebug_get_headers); #if HAVE_PHP_MEMORY_USAGE PHP_FUNCTION(xdebug_memory_usage); PHP_FUNCTION(xdebug_peak_memory_usage); #endif PHP_FUNCTION(xdebug_time_index); ZEND_BEGIN_MODULE_GLOBALS(xdebug) int status; int reason; long level; xdebug_llist *stack; long max_nesting_level; zend_bool default_enable; zend_bool collect_includes; long collect_params; zend_bool collect_return; zend_bool collect_vars; zend_bool collect_assignments; zend_bool extended_info; zend_bool show_ex_trace; zend_bool show_local_vars; zend_bool show_mem_delta; double start_time; HashTable *active_symbol_table; zend_execute_data *active_execute_data; zend_op_array *active_op_array; zval *This; function_stack_entry *active_fse; unsigned int prev_memory; char *file_link_format; zend_bool overload_var_dump; zend_bool var_dump_overloaded; void (*orig_var_dump_func)(INTERNAL_FUNCTION_PARAMETERS); void (*orig_set_time_limit_func)(INTERNAL_FUNCTION_PARAMETERS); FILE *trace_file; zend_bool do_trace; zend_bool auto_trace; zend_bool trace_enable_trigger; char *trace_output_dir; char *trace_output_name; long trace_options; long trace_format; char *tracefile_name; char *last_exception_trace; char *last_eval_statement; /* variable dumping limitation settings */ long display_max_children; long display_max_data; long display_max_depth; zend_bool cli_color; int output_is_tty; /* used for code coverage */ zend_bool coverage_enable; zend_bool do_code_coverage; xdebug_hash *code_coverage; zend_bool code_coverage_unused; zend_bool code_coverage_dead_code_analysis; unsigned int function_count; int reserved_offset; char *previous_filename; xdebug_coverage_file *previous_file; /* used for collection errors */ zend_bool do_collect_errors; xdebug_llist *collected_errors; /* superglobals */ zend_bool dump_globals; zend_bool dump_once; zend_bool dump_undefined; zend_bool dumped; xdebug_llist server; xdebug_llist get; xdebug_llist post; xdebug_llist cookie; xdebug_llist files; xdebug_llist env; xdebug_llist request; xdebug_llist session; /* headers */ xdebug_llist *headers; /* remote settings */ zend_bool remote_enable; /* 0 */ long remote_port; /* 9000 */ char *remote_host; /* localhost */ long remote_mode; /* XDEBUG_NONE, XDEBUG_JIT, XDEBUG_REQ */ char *remote_handler; /* php3, gdb, dbgp */ zend_bool remote_autostart; /* Disables the requirement for XDEBUG_SESSION_START */ zend_bool remote_connect_back; /* connect back to the HTTP requestor */ char *remote_log; /* Filename to log protocol communication to */ FILE *remote_log_file; /* File handler for protocol log */ long remote_cookie_expire_time; /* Expire time for the remote-session cookie */ char *ide_key; /* As Xdebug uses it, from environment, USER, USERNAME or empty */ char *ide_key_setting; /* Set through php.ini and friends */ /* remote debugging globals */ zend_bool remote_enabled; zend_bool breakpoints_allowed; xdebug_con context; unsigned int breakpoint_count; unsigned int no_exec; /* profiler settings */ zend_bool profiler_enable; char *profiler_output_dir; char *profiler_output_name; /* "pid" or "crc32" */ zend_bool profiler_enable_trigger; zend_bool profiler_append; /* profiler globals */ zend_bool profiler_enabled; FILE *profile_file; char *profile_filename; /* DBGp globals */ char *lastcmd; char *lasttransid; /* output redirection */ int stdout_mode; /* aggregate profiling */ HashTable aggr_calls; zend_bool profiler_aggregate; /* scream */ zend_bool do_scream; zend_bool in_at; /* in-execution checking */ zend_bool in_execution; ZEND_END_MODULE_GLOBALS(xdebug) #ifdef ZTS #define XG(v) TSRMG(xdebug_globals_id, zend_xdebug_globals *, v) #else #define XG(v) (xdebug_globals.v) #endif #endif /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: */ xdebug-2.2.3/README0000644000175000017500000000314312147043204013136 0ustar derickderickXDEBUG ------ You need to compile Xdebug separately from the rest of PHP. Note, however, that you need access to the scripts "phpize" and "php-config". If your system does not have "phpize" and "php-config", you will need to compile and install PHP from a source tarball first, as these script are by-products of the PHP compilation and installation processes. It is important that the source version matches the installed version as there are slight, but important, differences between PHP versions. Once you have access to "phpize" and "php-config", do the following: 1. Unpack the tarball: tar -xzf xdebug-2.2.x.tgz. Note that you do not need to unpack the tarball inside the PHP source code tree. Xdebug is compiled separately, all by itself, as stated above. 2. cd xdebug-2.2.x 3. Run phpize: phpize (or /path/to/phpize if phpize is not in your path). 4. ./configure --enable-xdebug (or: ../configure --enable-xdebug --with-php-config=/path/to/php-config if php-config is not in your path) 5. Run: make 6. cp modules/xdebug.so /to/wherever/you/want/it 7. add the following line to php.ini: zend_extension="/wherever/you/put/it/xdebug.so" 8. Restart your webserver. 9. Write a PHP page that calls "phpinfo();" Load it in a browser and look for the info on the xdebug module. If you see it, you have been successful! SUPPORT ------- If you think that you encountered a bug, please file a detailed bugreport at http://bugs.xdebug.org . You are required to create an account, this is so that you can be contacted for additional information and to keep out spam. Derick Rethans derick@xdebug.org xdebug-2.2.3/usefulstuff.c0000644000175000017500000004413312147043204015001 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #include #include #ifndef WIN32 #include #include #include #include #include #include #else #define PATH_MAX MAX_PATH #include #include #include "win32/time.h" #include #endif #include "php_xdebug.h" #include "xdebug_mm.h" #include "xdebug_str.h" #include "usefulstuff.h" #include "ext/standard/php_lcg.h" #include "ext/standard/flock_compat.h" #include "main/php_ini.h" #ifndef NAME_MAX # ifdef _AIX # include # define NAME_MAX pathconf("/dev/null",_PC_NAME_MAX) # else # define NAME_MAX (MAXNAMELEN-1) # endif #endif ZEND_EXTERN_MODULE_GLOBALS(xdebug) #define READ_BUFFER_SIZE 128 char* xdebug_fd_read_line_delim(int socket, fd_buf *context, int type, unsigned char delim, int *length) { int size = 0, newl = 0, nbufsize = 0; char *tmp; char *tmp_buf = NULL; char *ptr; char buffer[READ_BUFFER_SIZE + 1]; if (!context->buffer) { context->buffer = calloc(1,1); context->buffer_size = 0; } while (context->buffer_size < 1 || context->buffer[context->buffer_size - 1] != delim) { ptr = context->buffer + context->buffer_size; if (type == FD_RL_FILE) { newl = read(socket, buffer, READ_BUFFER_SIZE); } else { newl = recv(socket, buffer, READ_BUFFER_SIZE, 0); } if (newl > 0) { context->buffer = realloc(context->buffer, context->buffer_size + newl + 1); memcpy(context->buffer + context->buffer_size, buffer, newl); context->buffer_size += newl; context->buffer[context->buffer_size] = '\0'; } else { return NULL; } } ptr = memchr(context->buffer, delim, context->buffer_size); size = ptr - context->buffer; /* Copy that line into tmp */ tmp = malloc(size + 1); tmp[size] = '\0'; memcpy(tmp, context->buffer, size); /* Rewrite existing buffer */ if ((nbufsize = context->buffer_size - size - 1) > 0) { tmp_buf = malloc(nbufsize + 1); memcpy(tmp_buf, ptr + 1, nbufsize); tmp_buf[nbufsize] = 0; } free(context->buffer); context->buffer = tmp_buf; context->buffer_size = context->buffer_size - (size + 1); /* Return normal line */ if (length) { *length = size; } return tmp; } char *xdebug_join(char *delim, xdebug_arg *args, int begin, int end) { int i; xdebug_str *ret; xdebug_str_ptr_init(ret); if (begin < 0) { begin = 0; } if (end > args->c - 1) { end = args->c - 1; } for (i = begin; i < end; i++) { xdebug_str_add(ret, args->args[i], 0); xdebug_str_add(ret, delim, 0); } xdebug_str_add(ret, args->args[end], 0); return ret->d; } void xdebug_explode(char *delim, char *str, xdebug_arg *args, int limit) { char *p1, *p2, *endp; endp = str + strlen(str); p1 = str; p2 = xdebug_memnstr(str, delim, strlen(delim), endp); if (p2 == NULL) { args->c++; args->args = (char**) xdrealloc(args->args, sizeof(char*) * args->c); args->args[args->c - 1] = (char*) xdmalloc(strlen(str) + 1); memcpy(args->args[args->c - 1], p1, strlen(str)); args->args[args->c - 1][strlen(str)] = '\0'; } else { do { args->c++; args->args = (char**) xdrealloc(args->args, sizeof(char*) * args->c); args->args[args->c - 1] = (char*) xdmalloc(p2 - p1 + 1); memcpy(args->args[args->c - 1], p1, p2 - p1); args->args[args->c - 1][p2 - p1] = '\0'; p1 = p2 + strlen(delim); } while ((p2 = xdebug_memnstr(p1, delim, strlen(delim), endp)) != NULL && (limit == -1 || --limit > 1)); if (p1 <= endp) { args->c++; args->args = (char**) xdrealloc(args->args, sizeof(char*) * args->c); args->args[args->c - 1] = (char*) xdmalloc(endp - p1 + 1); memcpy(args->args[args->c - 1], p1, endp - p1); args->args[args->c - 1][endp - p1] = '\0'; } } } char* xdebug_memnstr(char *haystack, char *needle, int needle_len, char *end) { char *p = haystack; char first = *needle; /* let end point to the last character where needle may start */ end -= needle_len; while (p <= end) { while (*p != first) if (++p > end) return NULL; if (memcmp(p, needle, needle_len) == 0) return p; p++; } return NULL; } double xdebug_get_utime(void) { #ifdef HAVE_GETTIMEOFDAY struct timeval tp; long sec = 0L; double msec = 0.0; if (gettimeofday((struct timeval *) &tp, NULL) == 0) { sec = tp.tv_sec; msec = (double) (tp.tv_usec / MICRO_IN_SEC); if (msec >= 1.0) { msec -= (long) msec; } return msec + sec; } #endif return 0; } char* xdebug_get_time(void) { time_t cur_time; char *str_time; str_time = xdmalloc(24); cur_time = time(NULL); strftime(str_time, 24, "%Y-%m-%d %H:%M:%S", gmtime (&cur_time)); return str_time; } /* not all versions of php export this */ static int xdebug_htoi(char *s) { int value; int c; c = s[0]; if (isupper(c)) { c = tolower(c); } value = (c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10) * 16; c = s[1]; if (isupper(c)) { c = tolower(c); } value += c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10; return value; } /* not all versions of php export this */ int xdebug_raw_url_decode(char *str, int len) { char *dest = str; char *data = str; while (len--) { if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && isxdigit((int) *(data + 2))) { *dest = (char) xdebug_htoi(data + 1); data += 2; len -= 2; } else { *dest = *data; } data++; dest++; } *dest = '\0'; return dest - str; } static unsigned char hexchars[] = "0123456789ABCDEF"; char *xdebug_raw_url_encode(char const *s, int len, int *new_length, int skip_slash) { register int x, y; unsigned char *str; str = (unsigned char *) xdmalloc(3 * len + 1); for (x = 0, y = 0; len--; x++, y++) { str[y] = (unsigned char) s[x]; if ((str[y] < '0' && str[y] != '-' && str[y] != '.' && (str[y] != '/' || !skip_slash)) || (str[y] < 'A' && str[y] > '9' && str[y] != ':') || (str[y] > 'Z' && str[y] < 'a' && str[y] != '_' && (str[y] != '\\' || !skip_slash)) || (str[y] > 'z')) { str[y++] = '%'; str[y++] = hexchars[(unsigned char) s[x] >> 4]; str[y] = hexchars[(unsigned char) s[x] & 15]; } } str[y] = '\0'; if (new_length) { *new_length = y; } return ((char *) str); } /* fake URI's per IETF RFC 1738 and 2396 format */ char *xdebug_path_from_url(const char *fileurl TSRMLS_DC) { /* deal with file: url's */ char dfp[PATH_MAX * 2]; const char *fp = dfp, *efp = fileurl; int l = 0; #ifdef PHP_WIN32 int i; #endif char *tmp = NULL, *ret = NULL;; memset(dfp, 0, sizeof(dfp)); strncpy(dfp, efp, sizeof(dfp) - 1); xdebug_raw_url_decode(dfp, strlen(dfp)); tmp = strstr(fp, "file://"); if (tmp) { fp = tmp + 7; if (fp[0] == '/' && fp[2] == ':') { fp++; } ret = xdstrdup(fp); l = strlen(ret); #ifdef PHP_WIN32 /* convert '/' to '\' */ for (i = 0; i < l; i++) { if (ret[i] == '/') { ret[i] = '\\'; } } #endif } else { ret = xdstrdup(fileurl); } return ret; } #if PHP_VERSION_ID >= 50400 # define VIRTUAL_FILE_EX_TSRMLS_CC TSRMLS_CC #else # define VIRTUAL_FILE_EX_TSRMLS_CC #endif /* fake URI's per IETF RFC 1738 and 2396 format */ char *xdebug_path_to_url(const char *fileurl TSRMLS_DC) { int l, i, new_len; char *tmp = NULL; char *encoded_fileurl; /* encode the url */ encoded_fileurl = xdebug_raw_url_encode(fileurl, strlen(fileurl), &new_len, 1); if (strncmp(fileurl, "phar://", 7) == 0) { /* ignore, phar is cool */ tmp = xdstrdup(fileurl); } else if (fileurl[0] != '/' && fileurl[0] != '\\' && fileurl[1] != ':') { /* convert relative paths */ cwd_state new_state; char cwd[MAXPATHLEN]; char *result; result = VCWD_GETCWD(cwd, MAXPATHLEN); if (!result) { cwd[0] = '\0'; } new_state.cwd = strdup(cwd); new_state.cwd_length = strlen(cwd); if (!virtual_file_ex(&new_state, fileurl, NULL, 1 VIRTUAL_FILE_EX_TSRMLS_CC)) { char *s = estrndup(new_state.cwd, new_state.cwd_length); tmp = xdebug_sprintf("file://%s",s); efree(s); } free(new_state.cwd); } else if (fileurl[1] == '/' || fileurl[1] == '\\') { /* convert UNC paths (eg. \\server\sharepath) */ /* See http://blogs.msdn.com/ie/archive/2006/12/06/file-uris-in-windows.aspx */ tmp = xdebug_sprintf("file:%s", encoded_fileurl); } else if (fileurl[0] == '/' || fileurl[0] == '\\') { /* convert *nix paths (eg. /path) */ tmp = xdebug_sprintf("file://%s", encoded_fileurl); } else if (fileurl[1] == ':') { /* convert windows drive paths (eg. c:\path) */ tmp = xdebug_sprintf("file:///%s", encoded_fileurl); } else { /* no clue about it, use it raw */ tmp = xdstrdup(encoded_fileurl); } l = strlen(tmp); /* convert '\' to '/' */ for (i = 0; i < l; i++) { if (tmp[i] == '\\') { tmp[i]='/'; } } xdfree(encoded_fileurl); return tmp; } long xdebug_crc32(const char *string, int str_len) { unsigned int crc = ~0; int len; len = 0 ; for (len += str_len; str_len--; ++string) { XDEBUG_CRC32(crc, *string); } return ~crc; } #ifndef PHP_WIN32 static FILE *xdebug_open_file(char *fname, char *mode, char *extension, char **new_fname) { FILE *fh; char *tmp_fname; if (extension) { tmp_fname = xdebug_sprintf("%s.%s", fname, extension); } else { tmp_fname = xdstrdup(fname); } fh = fopen(tmp_fname, mode); if (fh && new_fname) { *new_fname = tmp_fname; } else { xdfree(tmp_fname); } return fh; } static FILE *xdebug_open_file_with_random_ext(char *fname, char *mode, char *extension, char **new_fname) { FILE *fh; char *tmp_fname; TSRMLS_FETCH(); if (extension) { tmp_fname = xdebug_sprintf("%s.%06x.%s", fname, (long) (1000000 * php_combined_lcg(TSRMLS_C)), extension); } else { tmp_fname = xdebug_sprintf("%s.%06x", fname, (long) (1000000 * php_combined_lcg(TSRMLS_C)), extension); } fh = fopen(tmp_fname, mode); if (fh && new_fname) { *new_fname = tmp_fname; } else { xdfree(tmp_fname); } return fh; } FILE *xdebug_fopen(char *fname, char *mode, char *extension, char **new_fname) { int r; FILE *fh; struct stat buf; char *tmp_fname = NULL; int filename_len = 0; /* We're not doing any tricks for append mode... as that has atomic writes * anyway. And we ignore read mode as well. */ if (mode[0] == 'a' || mode[0] == 'r') { return xdebug_open_file(fname, mode, extension, new_fname); } /* Make sure we don't open a file with a path that's too long */ filename_len += (fname ? strlen(fname) : 0); /* filename */ filename_len += (extension ? strlen(extension) : 0) + 1; /* extension (+ ".") */ filename_len += 8; /* possible random extension (+ ".") */ if (filename_len > NAME_MAX) { fname[NAME_MAX - (extension ? strlen(extension) : 0 )] = '\0'; } /* In write mode however we do have to do some stuff. */ /* 1. Check if the file exists */ if (extension) { tmp_fname = xdebug_sprintf("%s.%s", fname, extension); } else { tmp_fname = xdstrdup(fname); } r = stat(tmp_fname, &buf); /* We're not freeing "tmp_fname" as that is used in the freopen as well. */ if (r == -1) { /* 2. Cool, the file doesn't exist so we can open it without probs now. */ fh = xdebug_open_file(fname, "w", extension, new_fname); goto lock; } /* 3. It exists, check if we can open it. */ fh = xdebug_open_file(fname, "r+", extension, new_fname); if (!fh) { /* 4. If fh == null we couldn't even open the file, so open a new one with a new name */ fh = xdebug_open_file_with_random_ext(fname, "w", extension, new_fname); goto lock; } /* 5. It exists and we can open it, check if we can exclusively lock it. */ r = flock(fileno(fh), LOCK_EX | LOCK_NB); if (r == -1) { if (errno == EWOULDBLOCK) { fclose(fh); /* 6. The file is in use, so we open one with a new name. */ fh = xdebug_open_file_with_random_ext(fname, "w", extension, new_fname); goto lock; } } /* 7. We established a lock, now we truncate and return the handle */ fh = freopen(tmp_fname, "w", fh); lock: /* Yes yes, an evil goto label here!!! */ if (fh) { /* 8. We have to lock again after the reopen as that basically closes * the file and opens it again. There is a small race condition here... */ flock(fileno(fh), LOCK_EX | LOCK_NB); } xdfree(tmp_fname); return fh; } #else FILE *xdebug_fopen(char *fname, char *mode, char *extension, char **new_fname) { char *tmp_fname; FILE *ret; if (extension) { tmp_fname = xdebug_sprintf("%s.%s", fname, extension); } else { tmp_fname = xdstrdup(fname); } ret = fopen(tmp_fname, mode); if (new_fname) { *new_fname = tmp_fname; } else { xdfree(tmp_fname); } return ret; } #endif int xdebug_format_output_filename(char **filename, char *format, char *script_name) { xdebug_str fname = {0, 0, NULL}; char cwd[128]; TSRMLS_FETCH(); while (*format) { if (*format != '%') { xdebug_str_addl(&fname, (char *) format, 1, 0); } else { format++; switch (*format) { case 'c': /* crc32 of the current working directory */ if (VCWD_GETCWD(cwd, 127)) { xdebug_str_add(&fname, xdebug_sprintf("%lu", xdebug_crc32(cwd, strlen(cwd))), 1); } break; case 'p': /* pid */ xdebug_str_add(&fname, xdebug_sprintf("%ld", getpid()), 1); break; case 'r': /* random number */ xdebug_str_add(&fname, xdebug_sprintf("%06x", (long) (1000000 * php_combined_lcg(TSRMLS_C))), 1); break; case 's': { /* script fname */ char *char_ptr, *script_name_tmp; /* we do not always have script_name available, so if we * don't have it and this format specifier is used then we * simple do nothing for this specifier */ if (!script_name) { break; } /* create a copy to work on */ script_name_tmp = xdstrdup(script_name); /* replace slashes, whitespace and colons with underscores */ while ((char_ptr = strpbrk(script_name_tmp, "/\\: ")) != NULL) { char_ptr[0] = '_'; } /* replace .php with _php */ char_ptr = strrchr(script_name_tmp, '.'); if (char_ptr) { char_ptr[0] = '_'; } xdebug_str_add(&fname, script_name_tmp, 0); xdfree(script_name_tmp); } break; case 't': { /* timestamp (in seconds) */ time_t the_time = time(NULL); xdebug_str_add(&fname, xdebug_sprintf("%ld", the_time), 1); } break; case 'u': { /* timestamp (in microseconds) */ char *char_ptr, *utime = xdebug_sprintf("%f", xdebug_get_utime()); /* Replace . with _ (or should it be nuked?) */ char_ptr = strrchr(utime, '.'); if (char_ptr) { char_ptr[0] = '_'; } xdebug_str_add(&fname, utime, 1); } break; case 'H': /* $_SERVER['HTTP_HOST'] */ case 'U': /* $_SERVER['UNIQUE_ID'] */ case 'R': { /* $_SERVER['REQUEST_URI'] */ zval **data; char *char_ptr, *strval; int retval = FAILURE; if (PG(http_globals)[TRACK_VARS_SERVER]) { switch (*format) { case 'H': retval = zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_HOST", sizeof("HTTP_HOST"), (void **) &data); break; case 'R': retval = zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "REQUEST_URI", sizeof("REQUEST_URI"), (void **) &data); break; case 'U': retval = zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "UNIQUE_ID", sizeof("UNIQUE_ID"), (void **) &data); break; } if (retval == SUCCESS) { strval = estrdup(Z_STRVAL_PP(data)); /* replace slashes, dots, question marks, plus * signs, ampersands, spaces and other evil chars * with underscores */ while ((char_ptr = strpbrk(strval, "/\\.?&+:*\"<>| ")) != NULL) { char_ptr[0] = '_'; } xdebug_str_add(&fname, strval, 0); efree(strval); } } } break; case 'S': { /* session id */ zval **data; char *char_ptr, *strval; char *sess_name; sess_name = zend_ini_string("session.name", sizeof("session.name"), 0); if (sess_name && PG(http_globals)[TRACK_VARS_COOKIE] && zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]), sess_name, strlen(sess_name) + 1, (void **) &data) == SUCCESS && Z_STRLEN_PP(data) < 100 /* Prevent any unrealistically long data being set as filename */ ) { strval = estrdup(Z_STRVAL_PP(data)); /* replace slashes, dots, question marks, plus signs, * ampersands and spaces with underscores */ while ((char_ptr = strpbrk(strval, "/\\.?&+ ")) != NULL) { char_ptr[0] = '_'; } xdebug_str_add(&fname, strval, 0); efree(strval); } } break; case '%': /* literal % */ xdebug_str_addl(&fname, "%", 1, 0); break; } } format++; } *filename = fname.d; return fname.l; } void xdebug_open_log(TSRMLS_D) { /* initialize remote log file */ XG(remote_log_file) = NULL; if (XG(remote_log) && strlen(XG(remote_log))) { XG(remote_log_file) = xdebug_fopen(XG(remote_log), "a", NULL, NULL); } if (XG(remote_log_file)) { char *timestr = xdebug_get_time(); fprintf(XG(remote_log_file), "Log opened at %s\n", timestr); fflush(XG(remote_log_file)); xdfree(timestr); } } void xdebug_close_log(TSRMLS_D) { if (XG(remote_log_file)) { char *timestr = xdebug_get_time(); fprintf(XG(remote_log_file), "Log closed at %s\n\n", timestr); fflush(XG(remote_log_file)); xdfree(timestr); fclose(XG(remote_log_file)); XG(remote_log_file) = NULL; } } xdebug-2.2.3/usefulstuff.h0000644000175000017500000001354212147043204015006 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #ifndef __HAVE_USEFULSTUFF_H__ #define __HAVE_USEFULSTUFF_H__ #define FD_RL_FILE 0 #define FD_RL_SOCKET 1 typedef struct _fd_buf fd_buf; struct _fd_buf { char *buffer; int buffer_size; }; typedef struct xdebug_arg { int c; char **args; } xdebug_arg; #define xdebug_arg_init(arg) { \ arg->args = NULL; \ arg->c = 0; \ } #define xdebug_arg_dtor(arg) { \ int i; \ for (i = 0; i < arg->c; i++) { \ xdfree(arg->args[i]); \ } \ if (arg->args) { \ xdfree(arg->args); \ } \ xdfree(arg); \ } #define xdebug_fd_read_line(s,c,t) xdebug_fd_read_line_delim(s, c, t, '\n', NULL) char* xdebug_fd_read_line_delim(int socket, fd_buf *context, int type, unsigned char delim, int *length); char *xdebug_join(char *delim, xdebug_arg *args, int begin, int end); void xdebug_explode(char *delim, char *str, xdebug_arg *args, int limit); char* xdebug_memnstr(char *haystack, char *needle, int needle_len, char *end); double xdebug_get_utime(void); char* xdebug_get_time(void); char *xdebug_path_to_url(const char *fileurl TSRMLS_DC); char *xdebug_path_from_url(const char *fileurl TSRMLS_DC); FILE *xdebug_fopen(char *fname, char *mode, char *extension, char **new_fname); int xdebug_format_output_filename(char **filename, char *format, char *script_name); void xdebug_open_log(TSRMLS_D); void xdebug_close_log(TSRMLS_D); #define XDEBUG_CRC32(crc, ch) (crc = (crc >> 8) ^ xdebug_crc32tab[(crc ^ (ch)) & 0xff]) static const unsigned int xdebug_crc32tab[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, }; long xdebug_crc32(const char *string, int str_len); #endif xdebug-2.2.3/xdebug.c0000644000175000017500000020745512147043204013714 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | | Ilia Alshanetsky | | Harald Radi | +----------------------------------------------------------------------+ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "php.h" #include "main/php_version.h" #include "xdebug_compat.h" #if HAVE_XDEBUG #ifndef PHP_WIN32 #include #include #else #include "win32/time.h" #include #endif #include "TSRM.h" #include "SAPI.h" #include "main/php_ini.h" #include "ext/standard/head.h" #include "ext/standard/html.h" #include "ext/standard/info.h" #include "ext/standard/php_string.h" #include "php_globals.h" #include "main/php_output.h" #include "ext/standard/php_var.h" #include "php_xdebug.h" #include "xdebug_private.h" #include "xdebug_code_coverage.h" #include "xdebug_com.h" #include "xdebug_llist.h" #include "xdebug_mm.h" #include "xdebug_var.h" #include "xdebug_profiler.h" #include "xdebug_stack.h" #include "xdebug_superglobals.h" #include "xdebug_tracing.h" #include "usefulstuff.h" /* execution redirection functions */ zend_op_array* (*old_compile_file)(zend_file_handle* file_handle, int type TSRMLS_DC); zend_op_array* xdebug_compile_file(zend_file_handle*, int TSRMLS_DC); #if PHP_VERSION_ID < 50500 void (*xdebug_old_execute)(zend_op_array *op_array TSRMLS_DC); void xdebug_execute(zend_op_array *op_array TSRMLS_DC); void (*xdebug_old_execute_internal)(zend_execute_data *current_execute_data, int return_value_used TSRMLS_DC); void xdebug_execute_internal(zend_execute_data *current_execute_data, int return_value_used TSRMLS_DC); #else void (*xdebug_old_execute_ex)(zend_execute_data *execute_data TSRMLS_DC); void xdebug_execute_ex(zend_execute_data *execute_data TSRMLS_DC); void (*xdebug_old_execute_internal)(zend_execute_data *current_execute_data, struct _zend_fcall_info *fci, int return_value_used TSRMLS_DC); void xdebug_execute_internal(zend_execute_data *current_execute_data, struct _zend_fcall_info *fci, int return_value_used TSRMLS_DC); #endif /* error callback replacement functions */ void (*xdebug_old_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); void (*xdebug_new_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); void xdebug_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); static int xdebug_header_handler(sapi_header_struct *h XG_SAPI_HEADER_OP_DC, sapi_headers_struct *s TSRMLS_DC); static int xdebug_ub_write(const char *string, unsigned int lenght TSRMLS_DC); static void xdebug_throw_exception_hook(zval *exception TSRMLS_DC); int xdebug_exit_handler(ZEND_OPCODE_HANDLER_ARGS); int zend_xdebug_initialised = 0; int zend_xdebug_global_offset = -1; int (*xdebug_orig_header_handler)(sapi_header_struct *h XG_SAPI_HEADER_OP_DC, sapi_headers_struct *s TSRMLS_DC); int (*xdebug_orig_ub_write)(const char *string, unsigned int len TSRMLS_DC); static int xdebug_trigger_enabled(int setting, char *var_name TSRMLS_DC); zend_function_entry xdebug_functions[] = { PHP_FE(xdebug_get_stack_depth, NULL) PHP_FE(xdebug_get_function_stack, NULL) PHP_FE(xdebug_get_formatted_function_stack, NULL) PHP_FE(xdebug_print_function_stack, NULL) PHP_FE(xdebug_get_declared_vars, NULL) PHP_FE(xdebug_call_class, NULL) PHP_FE(xdebug_call_function, NULL) PHP_FE(xdebug_call_file, NULL) PHP_FE(xdebug_call_line, NULL) PHP_FE(xdebug_var_dump, NULL) PHP_FE(xdebug_debug_zval, NULL) PHP_FE(xdebug_debug_zval_stdout, NULL) PHP_FE(xdebug_enable, NULL) PHP_FE(xdebug_disable, NULL) PHP_FE(xdebug_is_enabled, NULL) PHP_FE(xdebug_break, NULL) PHP_FE(xdebug_start_trace, NULL) PHP_FE(xdebug_stop_trace, NULL) PHP_FE(xdebug_get_tracefile_name, NULL) PHP_FE(xdebug_get_profiler_filename, NULL) PHP_FE(xdebug_dump_aggr_profiling_data, NULL) PHP_FE(xdebug_clear_aggr_profiling_data, NULL) #if HAVE_PHP_MEMORY_USAGE PHP_FE(xdebug_memory_usage, NULL) PHP_FE(xdebug_peak_memory_usage, NULL) #endif PHP_FE(xdebug_time_index, NULL) PHP_FE(xdebug_start_error_collection, NULL) PHP_FE(xdebug_stop_error_collection, NULL) PHP_FE(xdebug_get_collected_errors, NULL) PHP_FE(xdebug_start_code_coverage, NULL) PHP_FE(xdebug_stop_code_coverage, NULL) PHP_FE(xdebug_get_code_coverage, NULL) PHP_FE(xdebug_get_function_count, NULL) PHP_FE(xdebug_dump_superglobals, NULL) PHP_FE(xdebug_get_headers, NULL) {NULL, NULL, NULL} }; zend_module_entry xdebug_module_entry = { STANDARD_MODULE_HEADER, "xdebug", xdebug_functions, PHP_MINIT(xdebug), PHP_MSHUTDOWN(xdebug), PHP_RINIT(xdebug), PHP_RSHUTDOWN(xdebug), PHP_MINFO(xdebug), XDEBUG_VERSION, #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 2) || PHP_MAJOR_VERSION >= 6 NO_MODULE_GLOBALS, #endif ZEND_MODULE_POST_ZEND_DEACTIVATE_N(xdebug), STANDARD_MODULE_PROPERTIES_EX }; ZEND_DECLARE_MODULE_GLOBALS(xdebug) #if COMPILE_DL_XDEBUG ZEND_GET_MODULE(xdebug) #endif static PHP_INI_MH(OnUpdateServer) { DUMP_TOK(server); } static PHP_INI_MH(OnUpdateGet) { DUMP_TOK(get); } static PHP_INI_MH(OnUpdatePost) { DUMP_TOK(post); } static PHP_INI_MH(OnUpdateCookie) { DUMP_TOK(cookie); } static PHP_INI_MH(OnUpdateFiles) { DUMP_TOK(files); } static PHP_INI_MH(OnUpdateEnv) { DUMP_TOK(env); } static PHP_INI_MH(OnUpdateRequest) { DUMP_TOK(request); } static PHP_INI_MH(OnUpdateSession) { DUMP_TOK(session); } static PHP_INI_MH(OnUpdateDebugMode) { if (!new_value) { XG(remote_mode) = XDEBUG_NONE; } else if (strcmp(new_value, "jit") == 0) { XG(remote_mode) = XDEBUG_JIT; } else if (strcmp(new_value, "req") == 0) { XG(remote_mode) = XDEBUG_REQ; } else { XG(remote_mode) = XDEBUG_NONE; } return SUCCESS; } #ifdef P_tmpdir # define XDEBUG_TEMP_DIR P_tmpdir #else # define XDEBUG_TEMP_DIR "/tmp" #endif PHP_INI_BEGIN() /* Debugger settings */ STD_PHP_INI_BOOLEAN("xdebug.auto_trace", "0", PHP_INI_ALL, OnUpdateBool, auto_trace, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.trace_enable_trigger", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, trace_enable_trigger, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.trace_output_dir", XDEBUG_TEMP_DIR, PHP_INI_ALL, OnUpdateString, trace_output_dir, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.trace_output_name", "trace.%c", PHP_INI_ALL, OnUpdateString, trace_output_name, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.trace_format", "0", PHP_INI_ALL, OnUpdateLong, trace_format, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.trace_options", "0", PHP_INI_ALL, OnUpdateLong, trace_options, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.coverage_enable", "1", PHP_INI_SYSTEM, OnUpdateBool, coverage_enable, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.collect_includes","1", PHP_INI_ALL, OnUpdateBool, collect_includes, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.collect_params", "0", PHP_INI_ALL, OnUpdateLong, collect_params, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.collect_return", "0", PHP_INI_ALL, OnUpdateBool, collect_return, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.collect_vars", "0", PHP_INI_ALL, OnUpdateBool, collect_vars, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.collect_assignments", "0", PHP_INI_ALL, OnUpdateBool, collect_assignments, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.default_enable", "1", PHP_INI_ALL, OnUpdateBool, default_enable, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.extended_info", "1", PHP_INI_SYSTEM, OnUpdateBool, extended_info, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.file_link_format", "", PHP_INI_ALL, OnUpdateString, file_link_format, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.max_nesting_level", "100", PHP_INI_ALL, OnUpdateLong, max_nesting_level, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.overload_var_dump", "1", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, overload_var_dump, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.show_exception_trace", "0", PHP_INI_ALL, OnUpdateBool, show_ex_trace, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.show_local_vars", "0", PHP_INI_ALL, OnUpdateBool, show_local_vars, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.show_mem_delta", "0", PHP_INI_ALL, OnUpdateBool, show_mem_delta, zend_xdebug_globals, xdebug_globals) /* Dump superglobals settings */ PHP_INI_ENTRY("xdebug.dump.COOKIE", NULL, PHP_INI_ALL, OnUpdateCookie) PHP_INI_ENTRY("xdebug.dump.ENV", NULL, PHP_INI_ALL, OnUpdateEnv) PHP_INI_ENTRY("xdebug.dump.FILES", NULL, PHP_INI_ALL, OnUpdateFiles) PHP_INI_ENTRY("xdebug.dump.GET", NULL, PHP_INI_ALL, OnUpdateGet) PHP_INI_ENTRY("xdebug.dump.POST", NULL, PHP_INI_ALL, OnUpdatePost) PHP_INI_ENTRY("xdebug.dump.REQUEST", NULL, PHP_INI_ALL, OnUpdateRequest) PHP_INI_ENTRY("xdebug.dump.SERVER", NULL, PHP_INI_ALL, OnUpdateServer) PHP_INI_ENTRY("xdebug.dump.SESSION", NULL, PHP_INI_ALL, OnUpdateSession) STD_PHP_INI_BOOLEAN("xdebug.dump_globals", "1", PHP_INI_ALL, OnUpdateBool, dump_globals, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.dump_once", "1", PHP_INI_ALL, OnUpdateBool, dump_once, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.dump_undefined", "0", PHP_INI_ALL, OnUpdateBool, dump_undefined, zend_xdebug_globals, xdebug_globals) /* Profiler settings */ STD_PHP_INI_BOOLEAN("xdebug.profiler_enable", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, profiler_enable, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.profiler_output_dir", XDEBUG_TEMP_DIR, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, profiler_output_dir, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.profiler_output_name", "cachegrind.out.%p", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, profiler_output_name, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.profiler_enable_trigger", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, profiler_enable_trigger, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.profiler_append", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, profiler_append, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.profiler_aggregate", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, profiler_aggregate, zend_xdebug_globals, xdebug_globals) /* Remote debugger settings */ STD_PHP_INI_BOOLEAN("xdebug.remote_enable", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, remote_enable, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.remote_handler", "dbgp", PHP_INI_ALL, OnUpdateString, remote_handler, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.remote_host", "localhost", PHP_INI_ALL, OnUpdateString, remote_host, zend_xdebug_globals, xdebug_globals) PHP_INI_ENTRY("xdebug.remote_mode", "req", PHP_INI_ALL, OnUpdateDebugMode) STD_PHP_INI_ENTRY("xdebug.remote_port", "9000", PHP_INI_ALL, OnUpdateLong, remote_port, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.remote_autostart","0", PHP_INI_ALL, OnUpdateBool, remote_autostart, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_BOOLEAN("xdebug.remote_connect_back","0", PHP_INI_ALL, OnUpdateBool, remote_connect_back, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.remote_log", "", PHP_INI_ALL, OnUpdateString, remote_log, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.idekey", "", PHP_INI_ALL, OnUpdateString, ide_key_setting, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.remote_cookie_expire_time", "3600", PHP_INI_ALL, OnUpdateLong, remote_cookie_expire_time, zend_xdebug_globals, xdebug_globals) /* Variable display settings */ STD_PHP_INI_ENTRY("xdebug.var_display_max_children", "128", PHP_INI_ALL, OnUpdateLong, display_max_children, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.var_display_max_data", "512", PHP_INI_ALL, OnUpdateLong, display_max_data, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.var_display_max_depth", "3", PHP_INI_ALL, OnUpdateLong, display_max_depth, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.cli_color", "0", PHP_INI_ALL, OnUpdateBool, cli_color, zend_xdebug_globals, xdebug_globals) /* Scream support */ STD_PHP_INI_BOOLEAN("xdebug.scream", "0", PHP_INI_ALL, OnUpdateBool, do_scream, zend_xdebug_globals, xdebug_globals) PHP_INI_END() static void php_xdebug_init_globals (zend_xdebug_globals *xg TSRMLS_DC) { xg->stack = NULL; xg->level = 0; xg->do_trace = 0; xg->trace_file = NULL; xg->coverage_enable = 0; xg->previous_filename = ""; xg->previous_file = NULL; xg->do_code_coverage = 0; xg->breakpoint_count = 0; xg->ide_key = NULL; xg->output_is_tty = OUTPUT_NOT_CHECKED; xg->stdout_mode = 0; xg->in_at = 0; xdebug_llist_init(&xg->server, xdebug_superglobals_dump_dtor); xdebug_llist_init(&xg->get, xdebug_superglobals_dump_dtor); xdebug_llist_init(&xg->post, xdebug_superglobals_dump_dtor); xdebug_llist_init(&xg->cookie, xdebug_superglobals_dump_dtor); xdebug_llist_init(&xg->files, xdebug_superglobals_dump_dtor); xdebug_llist_init(&xg->env, xdebug_superglobals_dump_dtor); xdebug_llist_init(&xg->request, xdebug_superglobals_dump_dtor); xdebug_llist_init(&xg->session, xdebug_superglobals_dump_dtor); /* Get reserved offset */ xg->reserved_offset = zend_xdebug_global_offset; /* Override header generation in SAPI */ if (sapi_module.header_handler != xdebug_header_handler) { xdebug_orig_header_handler = sapi_module.header_handler; sapi_module.header_handler = xdebug_header_handler; } xg->headers = NULL; /* Capturing output */ if (sapi_module.ub_write != xdebug_ub_write) { xdebug_orig_ub_write = sapi_module.ub_write; sapi_module.ub_write = xdebug_ub_write; } } static void php_xdebug_shutdown_globals (zend_xdebug_globals *xg TSRMLS_DC) { xdebug_llist_empty(&xg->server, NULL); xdebug_llist_empty(&xg->get, NULL); xdebug_llist_empty(&xg->post, NULL); xdebug_llist_empty(&xg->cookie, NULL); xdebug_llist_empty(&xg->files, NULL); xdebug_llist_empty(&xg->env, NULL); xdebug_llist_empty(&xg->request, NULL); xdebug_llist_empty(&xg->session, NULL); } char *xdebug_env_key(TSRMLS_D) { char *ide_key; ide_key = XG(ide_key_setting); if (ide_key && *ide_key) { return ide_key; } ide_key = getenv("DBGP_IDEKEY"); if (ide_key && *ide_key) { return ide_key; } ide_key = getenv("USER"); if (ide_key && *ide_key) { return ide_key; } ide_key = getenv("USERNAME"); if (ide_key && *ide_key) { return ide_key; } return NULL; } void xdebug_env_config(TSRMLS_D) { char *config = getenv("XDEBUG_CONFIG"); xdebug_arg *parts; int i; /* XDEBUG_CONFIG format: XDEBUG_CONFIG=var=val var=val */ if (!config) { return; } parts = (xdebug_arg*) xdmalloc(sizeof(xdebug_arg)); xdebug_arg_init(parts); xdebug_explode(" ", config, parts, -1); for (i = 0; i < parts->c; ++i) { char *name = NULL; char *envvar = parts->args[i]; char *envval = NULL; char *eq = strchr(envvar, '='); if (!eq || !*eq) { continue; } *eq = 0; envval = eq + 1; if (!*envval) { continue; } if (strcasecmp(envvar, "remote_enable") == 0) { name = "xdebug.remote_enable"; } else if (strcasecmp(envvar, "remote_port") == 0) { name = "xdebug.remote_port"; } else if (strcasecmp(envvar, "remote_host") == 0) { name = "xdebug.remote_host"; } else if (strcasecmp(envvar, "remote_handler") == 0) { name = "xdebug.remote_handler"; } else if (strcasecmp(envvar, "remote_mode") == 0) { name = "xdebug.remote_mode"; } else if (strcasecmp(envvar, "idekey") == 0) { if (XG(ide_key)) { xdfree(XG(ide_key)); } XG(ide_key) = xdstrdup(envval); } else if (strcasecmp(envvar, "profiler_enable") == 0) { name = "xdebug.profiler_enable"; } else if (strcasecmp(envvar, "profiler_output_dir") == 0) { name = "xdebug.profiler_output_dir"; } else if (strcasecmp(envvar, "profiler_output_name") == 0) { name = "xdebug.profiler_output_name"; } else if (strcasecmp(envvar, "profiler_enable_trigger") == 0) { name = "xdebug.profiler_enable_trigger"; } else if (strcasecmp(envvar, "remote_log") == 0) { name = "xdebug.remote_log"; } else if (strcasecmp(envvar, "remote_cookie_expire_time") == 0) { name = "xdebug.remote_cookie_expire_time"; } else if (strcasecmp(envvar, "cli_color") == 0) { name = "xdebug.cli_color"; } if (name) { zend_alter_ini_entry(name, strlen(name) + 1, envval, strlen(envval), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); } } xdebug_arg_dtor(parts); } static int xdebug_silence_handler(ZEND_OPCODE_HANDLER_ARGS) { zend_op *cur_opcode = *EG(opline_ptr); if (XG(do_scream)) { execute_data->opline++; if (cur_opcode->opcode == ZEND_BEGIN_SILENCE) { XG(in_at) = 1; } else { XG(in_at) = 0; } return ZEND_USER_OPCODE_CONTINUE; } return ZEND_USER_OPCODE_DISPATCH; } static int xdebug_include_or_eval_handler(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = execute_data->opline; #if PHP_VERSION_ID >= 50399 if (opline->extended_value == ZEND_EVAL) { #else if (Z_LVAL(opline->op2.u.constant) == ZEND_EVAL) { #endif zval *inc_filename; zval tmp_inc_filename; int is_var; inc_filename = xdebug_get_zval(execute_data, opline->XDEBUG_TYPE(op1), &opline->op1, &is_var); /* If there is no inc_filename, we're just bailing out instead */ if (!inc_filename) { return ZEND_USER_OPCODE_DISPATCH; } if (inc_filename->type != IS_STRING) { tmp_inc_filename = *inc_filename; zval_copy_ctor(&tmp_inc_filename); convert_to_string(&tmp_inc_filename); inc_filename = &tmp_inc_filename; } /* Now let's store this info */ if (XG(last_eval_statement)) { efree(XG(last_eval_statement)); } XG(last_eval_statement) = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename)); if (inc_filename == &tmp_inc_filename) { zval_dtor(&tmp_inc_filename); } } return ZEND_USER_OPCODE_DISPATCH; } int xdebug_is_output_tty(TSRMLS_D) { if (XG(output_is_tty) == OUTPUT_NOT_CHECKED) { #ifndef PHP_WIN32 XG(output_is_tty) = isatty(STDOUT_FILENO); #else XG(output_is_tty) = getenv("ANSICON"); #endif } return (XG(output_is_tty)); } #if 0 int static xdebug_stack_insert_top(zend_stack *stack, const void *element, int size) { int i; if (stack->top >= stack->max) { /* we need to allocate more memory */ stack->elements = (void **) erealloc(stack->elements, (sizeof(void **) * (stack->max += 64))); if (!stack->elements) { return FAILURE; } } /* move all existing ones up */ for (i = stack->top; i >= 0; i--) { stack->elements[i + 1] = stack->elements[i]; } /* replace top handler */ stack->elements[0] = (void *) emalloc(size); memcpy(stack->elements[0], element, size); return stack->top++; } #endif PHP_MINIT_FUNCTION(xdebug) { zend_extension dummy_ext; ZEND_INIT_MODULE_GLOBALS(xdebug, php_xdebug_init_globals, php_xdebug_shutdown_globals); REGISTER_INI_ENTRIES(); /* initialize aggregate call information hash */ zend_hash_init_ex(&XG(aggr_calls), 50, NULL, (dtor_func_t) xdebug_profile_aggr_call_entry_dtor, 1, 0); /* Redirect compile and execute functions to our own */ old_compile_file = zend_compile_file; zend_compile_file = xdebug_compile_file; #if PHP_VERSION_ID < 50500 xdebug_old_execute = zend_execute; zend_execute = xdebug_execute; #else xdebug_old_execute_ex = zend_execute_ex; zend_execute_ex = xdebug_execute_ex; #endif xdebug_old_execute_internal = zend_execute_internal; zend_execute_internal = xdebug_execute_internal; /* Replace error handler callback with our own */ xdebug_old_error_cb = zend_error_cb; xdebug_new_error_cb = xdebug_error_cb; /* Get reserved offset */ zend_xdebug_global_offset = zend_get_resource_handle(&dummy_ext); /* Overload the "exit" opcode */ XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(exit, ZEND_EXIT); /* Overload opcodes for code coverage */ if (XG(coverage_enable)) { XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_JMP); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_JMPZ); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_JMPZ_EX); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_JMPNZ); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_IS_IDENTICAL); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_IS_NOT_IDENTICAL); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_IS_EQUAL); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_IS_NOT_EQUAL); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_IS_SMALLER); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_IS_SMALLER_OR_EQUAL); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_BOOL_NOT); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_ADD); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_SUB); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_MUL); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_DIV); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_ADD_ARRAY_ELEMENT); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_RETURN); #if PHP_VERSION_ID >= 50400 XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_RETURN_BY_REF); #endif XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_EXT_STMT); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_RAISE_ABSTRACT_ERROR); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_SEND_VAR); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_SEND_VAR_NO_REF); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_SEND_VAL); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_NEW); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_EXT_FCALL_BEGIN); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_CATCH); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_BOOL); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_ADD_CHAR); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_ADD_STRING); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_INIT_ARRAY); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_FETCH_DIM_R); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_FETCH_OBJ_R); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_FETCH_OBJ_W); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_FETCH_OBJ_FUNC_ARG); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_FETCH_DIM_FUNC_ARG); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_FETCH_DIM_UNSET); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_FETCH_OBJ_UNSET); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_FETCH_CLASS); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_FETCH_CONSTANT); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_CONCAT); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_ISSET_ISEMPTY_DIM_OBJ); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_PRE_INC_OBJ); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_SWITCH_FREE); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_QM_ASSIGN); #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) || PHP_MAJOR_VERSION >= 6 XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_DECLARE_LAMBDA_FUNCTION); #endif #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4) XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_ADD_TRAIT); XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_BIND_TRAITS); #endif } XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(include_or_eval, ZEND_INCLUDE_OR_EVAL); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(assign, ZEND_ASSIGN); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(assign_add, ZEND_ASSIGN_ADD); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(assign_sub, ZEND_ASSIGN_SUB); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(assign_mul, ZEND_ASSIGN_MUL); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(assign_div, ZEND_ASSIGN_DIV); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(assign_mod, ZEND_ASSIGN_MOD); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(assign_sl, ZEND_ASSIGN_SL); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(assign_sr, ZEND_ASSIGN_SR); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(assign_concat, ZEND_ASSIGN_CONCAT); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(assign_bw_or, ZEND_ASSIGN_BW_OR); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(assign_bw_and, ZEND_ASSIGN_BW_AND); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(assign_bw_xor, ZEND_ASSIGN_BW_XOR); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(assign_dim, ZEND_ASSIGN_DIM); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(assign_obj, ZEND_ASSIGN_OBJ); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(pre_inc, ZEND_PRE_INC); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(post_inc, ZEND_POST_INC); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(pre_dec, ZEND_PRE_DEC); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(post_dec, ZEND_POST_DEC); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(pre_inc_obj, ZEND_PRE_INC_OBJ); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(post_inc_obj, ZEND_POST_INC_OBJ); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(pre_dec_obj, ZEND_PRE_DEC_OBJ); XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(post_dec_obj, ZEND_POST_DEC_OBJ); zend_set_user_opcode_handler(ZEND_BEGIN_SILENCE, xdebug_silence_handler); zend_set_user_opcode_handler(ZEND_END_SILENCE, xdebug_silence_handler); if (zend_xdebug_initialised == 0) { zend_error(E_WARNING, "Xdebug MUST be loaded as a Zend extension"); } REGISTER_LONG_CONSTANT("XDEBUG_TRACE_APPEND", XDEBUG_TRACE_OPTION_APPEND, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("XDEBUG_TRACE_COMPUTERIZED", XDEBUG_TRACE_OPTION_COMPUTERIZED, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("XDEBUG_TRACE_HTML", XDEBUG_TRACE_OPTION_HTML, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("XDEBUG_CC_UNUSED", XDEBUG_CC_OPTION_UNUSED, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("XDEBUG_CC_DEAD_CODE", XDEBUG_CC_OPTION_DEAD_CODE, CONST_CS | CONST_PERSISTENT); XG(breakpoint_count) = 0; XG(output_is_tty) = OUTPUT_NOT_CHECKED; #ifndef ZTS if (sapi_module.header_handler != xdebug_header_handler) { xdebug_orig_header_handler = sapi_module.header_handler; sapi_module.header_handler = xdebug_header_handler; } if (sapi_module.ub_write != xdebug_ub_write) { xdebug_orig_ub_write = sapi_module.ub_write; sapi_module.ub_write = xdebug_ub_write; } #endif return SUCCESS; } PHP_MSHUTDOWN_FUNCTION(xdebug) { if (XG(profiler_aggregate)) { xdebug_profiler_output_aggr_data(NULL TSRMLS_CC); } /* Reset compile, execute and error callbacks */ zend_compile_file = old_compile_file; #if PHP_VERSION_ID < 50500 zend_execute = xdebug_old_execute; #else zend_execute_ex = xdebug_old_execute_ex; #endif zend_execute_internal = xdebug_old_execute_internal; zend_error_cb = xdebug_old_error_cb; zend_hash_destroy(&XG(aggr_calls)); #ifdef ZTS ts_free_id(xdebug_globals_id); #else php_xdebug_shutdown_globals(&xdebug_globals TSRMLS_CC); #endif return SUCCESS; } static void xdebug_llist_string_dtor(void *dummy, void *elem) { char *s = elem; if (s) { xdfree(s); } } static void xdebug_used_var_dtor(void *dummy, void *elem) { char *s = elem; if (s) { xdfree(s); } } static void xdebug_stack_element_dtor(void *dummy, void *elem) { int i; function_stack_entry *e = elem; e->refcount--; if (e->refcount == 0) { if (e->function.function) { xdfree(e->function.function); } if (e->function.class) { xdfree(e->function.class); } if (e->filename) { xdfree(e->filename); } if (e->var) { for (i = 0; i < e->varc; i++) { if (e->var[i].name) { xdfree(e->var[i].name); } } xdfree(e->var); } if (e->include_filename) { xdfree(e->include_filename); } if (e->used_vars) { xdebug_llist_destroy(e->used_vars, NULL); e->used_vars = NULL; } if (e->profile.call_list) { xdebug_llist_destroy(e->profile.call_list, NULL); e->profile.call_list = NULL; } xdfree(e); } } #if PHP_VERSION_ID >= 50200 #define COOKIE_ENCODE , 1, 0 #elif PHP_API_VERSION >= 20030820 #define COOKIE_ENCODE , 1 #else #define COOKIE_ENCODE #endif int xdebug_ub_write(const char *string, unsigned int length TSRMLS_DC) { if (XG(remote_enabled)) { if (-1 == XG(context).handler->remote_stream_output(string, length TSRMLS_CC)) { return 0; } } return xdebug_orig_ub_write(string, length TSRMLS_CC); } PHP_RINIT_FUNCTION(xdebug) { zend_function *orig; char *idekey; zval **dummy; /* Get the ide key for this session */ XG(ide_key) = NULL; idekey = xdebug_env_key(TSRMLS_C); if (idekey && *idekey) { if (XG(ide_key)) { xdfree(XG(ide_key)); } XG(ide_key) = xdstrdup(idekey); } /* Get xdebug ini entries from the environment also, this can override the idekey if one is set */ xdebug_env_config(TSRMLS_C); XG(no_exec) = 0; XG(level) = 0; XG(do_trace) = 0; XG(coverage_enable) = 0; XG(do_code_coverage) = 0; XG(code_coverage) = xdebug_hash_alloc(32, xdebug_coverage_file_dtor); XG(stack) = xdebug_llist_alloc(xdebug_stack_element_dtor); XG(trace_file) = NULL; XG(tracefile_name) = NULL; XG(profile_file) = NULL; XG(profile_filename) = NULL; XG(prev_memory) = 0; XG(function_count) = -1; XG(active_symbol_table) = NULL; XG(This) = NULL; XG(last_exception_trace) = NULL; XG(last_eval_statement) = NULL; XG(do_collect_errors) = 0; XG(collected_errors) = xdebug_llist_alloc(xdebug_llist_string_dtor); XG(reserved_offset) = zend_xdebug_global_offset; /* {{{ Initialize auto globals in Zend Engine 2 */ zend_is_auto_global("_ENV", sizeof("_ENV")-1 TSRMLS_CC); zend_is_auto_global("_GET", sizeof("_GET")-1 TSRMLS_CC); zend_is_auto_global("_POST", sizeof("_POST")-1 TSRMLS_CC); zend_is_auto_global("_COOKIE", sizeof("_COOKIE")-1 TSRMLS_CC); zend_is_auto_global("_REQUEST", sizeof("_REQUEST")-1 TSRMLS_CC); zend_is_auto_global("_FILES", sizeof("_FILES")-1 TSRMLS_CC); zend_is_auto_global("_SERVER", sizeof("_SERVER")-1 TSRMLS_CC); zend_is_auto_global("_SESSION", sizeof("_SESSION")-1 TSRMLS_CC); /* }}} */ /* Check if we have this special get variable that stops a debugging * request without executing any code */ if ( ( ( PG(http_globals)[TRACK_VARS_GET] && zend_hash_find(PG(http_globals)[TRACK_VARS_GET]->value.ht, "XDEBUG_SESSION_STOP_NO_EXEC", sizeof("XDEBUG_SESSION_STOP_NO_EXEC"), (void **) &dummy) == SUCCESS ) || ( PG(http_globals)[TRACK_VARS_POST] && zend_hash_find(PG(http_globals)[TRACK_VARS_POST]->value.ht, "XDEBUG_SESSION_STOP_NO_EXEC", sizeof("XDEBUG_SESSION_STOP_NO_EXEC"), (void **) &dummy) == SUCCESS ) ) && !SG(headers_sent) ) { php_setcookie("XDEBUG_SESSION", sizeof("XDEBUG_SESSION"), "", 0, time(NULL) + XG(remote_cookie_expire_time), "/", 1, NULL, 0, 0 COOKIE_ENCODE TSRMLS_CC); XG(no_exec) = 1; } /* Only enabled extended info when it is not disabled */ #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) || PHP_MAJOR_VERSION >= 6 CG(compiler_options) = CG(compiler_options) | (XG(extended_info) ? ZEND_COMPILE_EXTENDED_INFO : 0); #else CG(extended_info) = XG(extended_info); #endif /* Hack: We check for a soap header here, if that's existing, we don't use * Xdebug's error handler to keep soap fault from fucking up. */ if (XG(default_enable) && zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_SOAPACTION", 16, (void**)&dummy) == FAILURE) { zend_error_cb = xdebug_new_error_cb; zend_throw_exception_hook = xdebug_throw_exception_hook; } XG(remote_enabled) = 0; XG(profiler_enabled) = 0; XG(breakpoints_allowed) = 1; if ( (XG(auto_trace) || xdebug_trigger_enabled(XG(trace_enable_trigger), "XDEBUG_TRACE" TSRMLS_CC)) && XG(trace_output_dir) && strlen(XG(trace_output_dir)) ) { /* In case we do an auto-trace we are not interested in the return * value, but we still have to free it. */ xdfree(xdebug_start_trace(NULL, XG(trace_options) TSRMLS_CC)); } /* Initialize some debugger context properties */ XG(context).program_name = NULL; XG(context).list.last_file = NULL; XG(context).list.last_line = 0; XG(context).do_break = 0; XG(context).do_step = 0; XG(context).do_next = 0; XG(context).do_finish = 0; /* Initialize dump superglobals */ XG(dumped) = 0; /* Initialize start time */ XG(start_time) = xdebug_get_utime(); /* Override var_dump with our own function */ XG(var_dump_overloaded) = 0; if (XG(overload_var_dump)) { zend_hash_find(EG(function_table), "var_dump", 9, (void **)&orig); XG(orig_var_dump_func) = orig->internal_function.handler; orig->internal_function.handler = zif_xdebug_var_dump; XG(var_dump_overloaded) = 1; } /* Override set_time_limit with our own function to prevent timing out while debugging */ zend_hash_find(EG(function_table), "set_time_limit", 15, (void **)&orig); XG(orig_set_time_limit_func) = orig->internal_function.handler; orig->internal_function.handler = zif_xdebug_set_time_limit; XG(headers) = xdebug_llist_alloc(xdebug_llist_string_dtor); /* Signal that we're in a request now */ XG(in_execution) = 1; return SUCCESS; } ZEND_MODULE_POST_ZEND_DEACTIVATE_D(xdebug) { zend_function *orig; TSRMLS_FETCH(); if (XG(remote_enabled)) { XG(context).handler->remote_deinit(&(XG(context))); xdebug_close_socket(XG(context).socket); } if (XG(context).program_name) { xdfree(XG(context).program_name); } xdebug_llist_destroy(XG(stack), NULL); XG(stack) = NULL; if (XG(do_trace) && XG(trace_file)) { xdebug_stop_trace(TSRMLS_C); } if (XG(profile_file)) { fclose(XG(profile_file)); } if (XG(profile_filename)) { xdfree(XG(profile_filename)); } if (XG(ide_key)) { xdfree(XG(ide_key)); XG(ide_key) = NULL; } XG(level) = 0; XG(do_trace) = 0; XG(coverage_enable) = 0; XG(do_code_coverage) = 0; xdebug_hash_destroy(XG(code_coverage)); XG(code_coverage) = NULL; if (XG(context.list.last_file)) { xdfree(XG(context).list.last_file); } if (XG(last_exception_trace)) { xdfree(XG(last_exception_trace)); } if (XG(last_eval_statement)) { efree(XG(last_eval_statement)); } xdebug_llist_destroy(XG(collected_errors), NULL); XG(collected_errors) = NULL; /* Reset var_dump and set_time_limit to the original function */ if (XG(var_dump_overloaded)) { zend_hash_find(EG(function_table), "var_dump", 9, (void **)&orig); orig->internal_function.handler = XG(orig_var_dump_func); } zend_hash_find(EG(function_table), "set_time_limit", 15, (void **)&orig); orig->internal_function.handler = XG(orig_set_time_limit_func); /* Clean up collected headers */ xdebug_llist_destroy(XG(headers), NULL); XG(headers) = NULL; return SUCCESS; } PHP_RSHUTDOWN_FUNCTION(xdebug) { /* Signal that we're no longer in a request */ XG(in_execution) = 0; return SUCCESS; } PHP_MINFO_FUNCTION(xdebug) { xdebug_remote_handler_info *ptr = xdebug_handlers_get(); php_info_print_table_start(); php_info_print_table_header(2, "xdebug support", "enabled"); php_info_print_table_row(2, "Version", XDEBUG_VERSION); php_info_print_table_row(2, "IDE Key", XG(ide_key)); php_info_print_table_end(); if (zend_xdebug_initialised == 0) { php_info_print_table_start(); php_info_print_table_header(1, "XDEBUG NOT LOADED AS ZEND EXTENSION"); php_info_print_table_end(); } php_info_print_table_start(); php_info_print_table_header(2, "Supported protocols", "Revision"); while (ptr->name) { php_info_print_table_row(2, ptr->description, ptr->handler.get_revision()); ptr++; } php_info_print_table_end(); DISPLAY_INI_ENTRIES(); } static int xdebug_trigger_enabled(int setting, char *var_name TSRMLS_DC) { zval **dummy; if (!setting) { return 0; } if ( ( PG(http_globals)[TRACK_VARS_GET] && zend_hash_find(PG(http_globals)[TRACK_VARS_GET]->value.ht, var_name, strlen(var_name) + 1, (void **) &dummy) == SUCCESS ) || ( PG(http_globals)[TRACK_VARS_POST] && zend_hash_find(PG(http_globals)[TRACK_VARS_POST]->value.ht, var_name, strlen(var_name) + 1, (void **) &dummy) == SUCCESS ) || ( PG(http_globals)[TRACK_VARS_COOKIE] && zend_hash_find(PG(http_globals)[TRACK_VARS_COOKIE]->value.ht, var_name, strlen(var_name) + 1, (void **) &dummy) == SUCCESS ) ) { return 1; } return 0; } static void add_used_variables(function_stack_entry *fse, zend_op_array *op_array) { int i = 0; if (!fse->used_vars) { fse->used_vars = xdebug_llist_alloc(xdebug_used_var_dtor); } /* Check parameters */ for (i = 0; i < fse->varc; i++) { if (fse->var[i].name) { xdebug_llist_insert_next(fse->used_vars, XDEBUG_LLIST_TAIL(fse->used_vars), xdstrdup(fse->var[i].name)); } } /* gather used variables from compiled vars information */ while (i < op_array->last_var) { xdebug_llist_insert_next(fse->used_vars, XDEBUG_LLIST_TAIL(fse->used_vars), xdstrdup(op_array->vars[i].name)); i++; } /* opcode scanning time */ while (i < op_array->last) { char *cv = NULL; int cv_len; if (op_array->opcodes[i].XDEBUG_TYPE(op1) == IS_CV) { cv = (char *) zend_get_compiled_variable_name(op_array, op_array->opcodes[i].XDEBUG_ZNODE_ELEM(op1,var), &cv_len); xdebug_llist_insert_next(fse->used_vars, XDEBUG_LLIST_TAIL(fse->used_vars), xdstrdup(cv)); } if (op_array->opcodes[i].XDEBUG_TYPE(op2) == IS_CV) { cv = (char *) zend_get_compiled_variable_name(op_array, op_array->opcodes[i].XDEBUG_ZNODE_ELEM(op2,var), &cv_len); xdebug_llist_insert_next(fse->used_vars, XDEBUG_LLIST_TAIL(fse->used_vars), xdstrdup(cv)); } i++; } } static void xdebug_throw_exception_hook(zval *exception TSRMLS_DC) { zval *message, *file, *line, *xdebug_message_trace, *previous_exception; zend_class_entry *default_ce, *exception_ce; xdebug_brk_info *extra_brk_info; char *exception_trace; xdebug_str tmp_str = { 0, 0, NULL }; if (!exception) { return; } default_ce = zend_exception_get_default(TSRMLS_C); exception_ce = zend_get_class_entry(exception TSRMLS_CC); message = zend_read_property(default_ce, exception, "message", sizeof("message")-1, 0 TSRMLS_CC); file = zend_read_property(default_ce, exception, "file", sizeof("file")-1, 0 TSRMLS_CC); line = zend_read_property(default_ce, exception, "line", sizeof("line")-1, 0 TSRMLS_CC); convert_to_string_ex(&message); convert_to_string_ex(&file); convert_to_long_ex(&line); #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 2) || PHP_MAJOR_VERSION >= 6 previous_exception = zend_read_property(default_ce, exception, "previous", sizeof("previous")-1, 1 TSRMLS_CC); if (previous_exception && Z_TYPE_P(previous_exception) != IS_NULL) { xdebug_message_trace = zend_read_property(default_ce, previous_exception, "xdebug_message", sizeof("xdebug_message")-1, 1 TSRMLS_CC); if (xdebug_message_trace && Z_TYPE_P(xdebug_message_trace) != IS_NULL) { xdebug_str_add(&tmp_str, Z_STRVAL_P(xdebug_message_trace), 0); } } #endif if (!PG(html_errors)) { xdebug_str_addl(&tmp_str, "\n", 1, 0); } xdebug_append_error_description(&tmp_str, PG(html_errors), exception_ce->name, Z_STRVAL_P(message), Z_STRVAL_P(file), Z_LVAL_P(line) TSRMLS_CC); xdebug_append_printable_stack(&tmp_str, PG(html_errors) TSRMLS_CC); exception_trace = tmp_str.d; zend_update_property_string(default_ce, exception, "xdebug_message", sizeof("xdebug_message")-1, exception_trace TSRMLS_CC); if (XG(last_exception_trace)) { xdfree(XG(last_exception_trace)); } XG(last_exception_trace) = exception_trace; if (XG(show_ex_trace)) { if (PG(log_errors)) { xdebug_log_stack(exception_ce->name, Z_STRVAL_P(message), Z_STRVAL_P(file), Z_LVAL_P(line) TSRMLS_CC); } if (PG(display_errors)) { xdebug_str tmp_str = { 0, 0, NULL }; xdebug_append_error_head(&tmp_str, PG(html_errors), "exception" TSRMLS_CC); xdebug_str_add(&tmp_str, exception_trace, 0); xdebug_append_error_footer(&tmp_str, PG(html_errors) TSRMLS_CC); php_printf("%s", tmp_str.d); xdebug_str_dtor(tmp_str); } } /* Start JIT if requested and not yet enabled */ xdebug_do_jit(TSRMLS_C); if (XG(remote_enabled)) { /* Check if we have a breakpoint on this exception */ if (xdebug_hash_find(XG(context).exception_breakpoints, (char *) exception_ce->name, strlen(exception_ce->name), (void *) &extra_brk_info)) { if (xdebug_handle_hit_value(extra_brk_info)) { if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), Z_STRVAL_P(file), Z_LVAL_P(line), XDEBUG_BREAK, (char *) exception_ce->name, Z_STRVAL_P(message))) { XG(remote_enabled) = 0; } } } } } static int handle_breakpoints(function_stack_entry *fse, int breakpoint_type) { xdebug_brk_info *extra_brk_info = NULL; char *tmp_name = NULL; TSRMLS_FETCH(); /* Function breakpoints */ if (fse->function.type == XFUNC_NORMAL) { if (xdebug_hash_find(XG(context).function_breakpoints, fse->function.function, strlen(fse->function.function), (void *) &extra_brk_info)) { /* Yup, breakpoint found, we call the handler when it's not * disabled AND handle_hit_value is happy */ if (!extra_brk_info->disabled && (extra_brk_info->function_break_type == breakpoint_type)) { if (xdebug_handle_hit_value(extra_brk_info)) { if (fse->user_defined == XDEBUG_INTERNAL || (breakpoint_type == XDEBUG_BRK_FUNC_RETURN)) { if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), fse->filename, fse->lineno, XDEBUG_BREAK, NULL, NULL)) { return 0; } } else { XG(context).do_break = 1; } } } } } /* class->function breakpoints */ else if (fse->function.type == XFUNC_MEMBER || fse->function.type == XFUNC_STATIC_MEMBER) { tmp_name = xdebug_sprintf("%s::%s", fse->function.class, fse->function.function); if (xdebug_hash_find(XG(context).function_breakpoints, tmp_name, strlen(tmp_name), (void *) &extra_brk_info)) { /* Yup, breakpoint found, call handler if the breakpoint is not * disabled AND handle_hit_value is happy */ if (!extra_brk_info->disabled && (extra_brk_info->function_break_type == breakpoint_type)) { if (xdebug_handle_hit_value(extra_brk_info)) { XG(context).do_break = 1; } } } xdfree(tmp_name); } return 1; } #if PHP_VERSION_ID < 50500 void xdebug_execute(zend_op_array *op_array TSRMLS_DC) { zend_execute_data *edata = EG(current_execute_data); #else void xdebug_execute_ex(zend_execute_data *execute_data TSRMLS_DC) { zend_op_array *op_array = execute_data->op_array; zend_execute_data *edata = execute_data->prev_execute_data; #endif zval **dummy; function_stack_entry *fse, *xfse; char *magic_cookie = NULL; int do_return = (XG(do_trace) && XG(trace_file)); int function_nr = 0; xdebug_llist_element *le; int eval_id = 0, clear = 0; zval *return_val = NULL; /* If we're evaluating for the debugger's eval capability, just bail out */ if (op_array && op_array->filename && strcmp("xdebug://debug-eval", op_array->filename) == 0) { #if PHP_VERSION_ID < 50500 xdebug_old_execute(op_array TSRMLS_CC); #else xdebug_old_execute_ex(execute_data TSRMLS_CC); #endif return; } /* if we're in a ZEND_EXT_STMT, we ignore this function call as it's likely that it's just being called to check for breakpoints with conditions */ if (edata && edata->opline && edata->opline->opcode == ZEND_EXT_STMT) { #if PHP_VERSION_ID < 50500 xdebug_old_execute(op_array TSRMLS_CC); #else xdebug_old_execute_ex(execute_data TSRMLS_CC); #endif return; } if (XG(no_exec) == 1) { php_printf("DEBUG SESSION ENDED"); return; } if (!XG(context).program_name) { XG(context).program_name = xdstrdup(op_array->filename); } if (XG(level) == 0 && XG(in_execution)) { /* Set session cookie if requested */ if ( (( PG(http_globals)[TRACK_VARS_GET] && zend_hash_find(PG(http_globals)[TRACK_VARS_GET]->value.ht, "XDEBUG_SESSION_START", sizeof("XDEBUG_SESSION_START"), (void **) &dummy) == SUCCESS ) || ( PG(http_globals)[TRACK_VARS_POST] && zend_hash_find(PG(http_globals)[TRACK_VARS_POST]->value.ht, "XDEBUG_SESSION_START", sizeof("XDEBUG_SESSION_START"), (void **) &dummy) == SUCCESS )) && !SG(headers_sent) ) { convert_to_string_ex(dummy); magic_cookie = xdstrdup(Z_STRVAL_PP(dummy)); if (XG(ide_key)) { xdfree(XG(ide_key)); } XG(ide_key) = xdstrdup(Z_STRVAL_PP(dummy)); php_setcookie("XDEBUG_SESSION", sizeof("XDEBUG_SESSION"), Z_STRVAL_PP(dummy), Z_STRLEN_PP(dummy), time(NULL) + XG(remote_cookie_expire_time), "/", 1, NULL, 0, 0 COOKIE_ENCODE TSRMLS_CC); } else if ( PG(http_globals)[TRACK_VARS_COOKIE] && zend_hash_find(PG(http_globals)[TRACK_VARS_COOKIE]->value.ht, "XDEBUG_SESSION", sizeof("XDEBUG_SESSION"), (void **) &dummy) == SUCCESS ) { convert_to_string_ex(dummy); magic_cookie = xdstrdup(Z_STRVAL_PP(dummy)); if (XG(ide_key)) { xdfree(XG(ide_key)); } XG(ide_key) = xdstrdup(Z_STRVAL_PP(dummy)); } else if (getenv("XDEBUG_CONFIG")) { magic_cookie = xdstrdup(getenv("XDEBUG_CONFIG")); if (XG(ide_key) && *XG(ide_key) && !SG(headers_sent)) { php_setcookie("XDEBUG_SESSION", sizeof("XDEBUG_SESSION"), XG(ide_key), strlen(XG(ide_key)), time(NULL) + XG(remote_cookie_expire_time), "/", 1, NULL, 0, 0 COOKIE_ENCODE TSRMLS_CC); } } /* Remove session cookie if requested */ if ( ( ( PG(http_globals)[TRACK_VARS_GET] && zend_hash_find(PG(http_globals)[TRACK_VARS_GET]->value.ht, "XDEBUG_SESSION_STOP", sizeof("XDEBUG_SESSION_STOP"), (void **) &dummy) == SUCCESS ) || ( PG(http_globals)[TRACK_VARS_POST] && zend_hash_find(PG(http_globals)[TRACK_VARS_POST]->value.ht, "XDEBUG_SESSION_STOP", sizeof("XDEBUG_SESSION_STOP"), (void **) &dummy) == SUCCESS ) ) && !SG(headers_sent) ) { if (magic_cookie) { xdfree(magic_cookie); magic_cookie = NULL; } php_setcookie("XDEBUG_SESSION", sizeof("XDEBUG_SESSION"), "", 0, time(NULL) + XG(remote_cookie_expire_time), "/", 1, NULL, 0, 0 COOKIE_ENCODE TSRMLS_CC); } /* Start remote context if requested */ if ( (magic_cookie || XG(remote_autostart)) && !XG(remote_enabled) && XG(remote_enable) && (XG(remote_mode) == XDEBUG_REQ) ) { xdebug_init_debugger(TSRMLS_C); } if (magic_cookie) { xdfree(magic_cookie); magic_cookie = NULL; } /* Check for special GET/POST parameter to start profiling */ if ( !XG(profiler_enabled) && (XG(profiler_enable) || xdebug_trigger_enabled(XG(profiler_enable_trigger), "XDEBUG_PROFILE" TSRMLS_CC)) ) { if (xdebug_profiler_init((char *) op_array->filename TSRMLS_CC) == SUCCESS) { XG(profiler_enabled) = 1; } } } XG(level)++; if (XG(level) == XG(max_nesting_level)) { php_error(E_ERROR, "Maximum function nesting level of '%ld' reached, aborting!", XG(max_nesting_level)); } fse = xdebug_add_stack_frame(edata, op_array, XDEBUG_EXTERNAL TSRMLS_CC); fse->function.internal = 0; /* A hack to make __call work with profiles. The function *is* user defined after all. */ if (fse && fse->prev && fse->function.function && (strcmp(fse->function.function, "__call") == 0)) { fse->prev->user_defined = XDEBUG_EXTERNAL; } function_nr = XG(function_count); xdebug_trace_function_begin(fse, function_nr TSRMLS_CC); fse->symbol_table = EG(active_symbol_table); #if PHP_VERSION_ID < 50500 fse->execute_data = EG(current_execute_data); #else fse->execute_data = EG(current_execute_data)->prev_execute_data; #endif fse->This = EG(This); if (XG(remote_enabled) || XG(collect_vars) || XG(show_local_vars)) { /* Because include/require is treated as a stack level, we have to add used * variables in include/required files to all the stack levels above, until * we hit a function or the top level stack. This is so that the variables * show up correctly where they should be. We always call * add_used_variables on the current stack level, otherwise vars in include * files do not show up in the locals list. */ for (le = XDEBUG_LLIST_TAIL(XG(stack)); le != NULL; le = XDEBUG_LLIST_PREV(le)) { xfse = XDEBUG_LLIST_VALP(le); add_used_variables(xfse, op_array); if (XDEBUG_IS_FUNCTION(xfse->function.type)) { break; } } } if (XG(do_code_coverage) && XG(code_coverage_unused)) { xdebug_prefill_code_coverage(op_array TSRMLS_CC); } /* If we're in an eval, we need to create an ID for it. This ID however * depends on the debugger mechanism in use so we need to call a function * in the handler for it */ if (XG(remote_enabled) && XG(context).handler->register_eval_id && fse->function.type == XFUNC_EVAL) { eval_id = XG(context).handler->register_eval_id(&(XG(context)), fse); } /* Check for entry breakpoints */ if (XG(remote_enabled) && XG(breakpoints_allowed)) { if (!handle_breakpoints(fse, XDEBUG_BRK_FUNC_CALL)) { XG(remote_enabled) = 0; } } if (XG(profiler_enabled)) { xdebug_profiler_function_user_begin(fse TSRMLS_CC); } if (!EG(return_value_ptr_ptr)) { EG(return_value_ptr_ptr) = &return_val; clear = 1; } #if PHP_VERSION_ID < 50500 xdebug_old_execute(op_array TSRMLS_CC); #else xdebug_old_execute_ex(execute_data TSRMLS_CC); #endif if (XG(profiler_enabled)) { xdebug_profiler_function_user_end(fse, op_array TSRMLS_CC); } xdebug_trace_function_end(fse, function_nr TSRMLS_CC); /* Store return value in the trace file */ if (XG(collect_return) && do_return && XG(do_trace) && XG(trace_file)) { if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { char *t; #if PHP_VERSION_ID >= 50500 if (op_array->fn_flags & ZEND_ACC_GENERATOR) { t = xdebug_return_trace_stack_generator_retval(fse, (zend_generator *) EG(return_value_ptr_ptr) TSRMLS_CC); } else { t = xdebug_return_trace_stack_retval(fse, *EG(return_value_ptr_ptr) TSRMLS_CC); } #else t = xdebug_return_trace_stack_retval(fse, *EG(return_value_ptr_ptr) TSRMLS_CC); #endif fprintf(XG(trace_file), "%s", t); fflush(XG(trace_file)); xdfree(t); } } if (clear && *EG(return_value_ptr_ptr)) { zval_ptr_dtor(EG(return_value_ptr_ptr)); EG(return_value_ptr_ptr) = NULL; } /* Check for return breakpoints */ if (XG(remote_enabled) && XG(breakpoints_allowed)) { if (!handle_breakpoints(fse, XDEBUG_BRK_FUNC_RETURN)) { XG(remote_enabled) = 0; } } fse->symbol_table = NULL; fse->execute_data = NULL; if (XG(stack)) { xdebug_llist_remove(XG(stack), XDEBUG_LLIST_TAIL(XG(stack)), xdebug_stack_element_dtor); } XG(level)--; } static int check_soap_call(function_stack_entry *fse) { zend_module_entry tmp_mod_entry; if (fse->function.class && ( (strstr(fse->function.class, "SoapClient") != NULL) || (strstr(fse->function.class, "SoapServer") != NULL) ) && (zend_hash_find(&module_registry, "soap", 5, (void**) &tmp_mod_entry) == SUCCESS) ) { return 1; } return 0; } #if PHP_VERSION_ID < 50500 void xdebug_execute_internal(zend_execute_data *current_execute_data, int return_value_used TSRMLS_DC) #else void xdebug_execute_internal(zend_execute_data *current_execute_data, struct _zend_fcall_info *fci, int return_value_used TSRMLS_DC) #endif { zend_execute_data *edata = EG(current_execute_data); function_stack_entry *fse; zend_op *cur_opcode; int do_return = (XG(do_trace) && XG(trace_file)); int function_nr = 0; int restore_error_handler_situation = 0; void (*tmp_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) = NULL; XG(level)++; if (XG(level) == XG(max_nesting_level)) { php_error(E_ERROR, "Maximum function nesting level of '%ld' reached, aborting!", XG(max_nesting_level)); } fse = xdebug_add_stack_frame(edata, edata->op_array, XDEBUG_INTERNAL TSRMLS_CC); fse->function.internal = 1; function_nr = XG(function_count); xdebug_trace_function_begin(fse, function_nr TSRMLS_CC); /* Check for entry breakpoints */ if (XG(remote_enabled) && XG(breakpoints_allowed)) { if (!handle_breakpoints(fse, XDEBUG_BRK_FUNC_CALL)) { XG(remote_enabled) = 0; } } /* Check for SOAP */ if (check_soap_call(fse)) { restore_error_handler_situation = 1; tmp_error_cb = zend_error_cb; zend_error_cb = xdebug_old_error_cb; } if (XG(profiler_enabled)) { xdebug_profiler_function_internal_begin(fse TSRMLS_CC); } #if PHP_VERSION_ID < 50500 if (xdebug_old_execute_internal) { xdebug_old_execute_internal(current_execute_data, return_value_used TSRMLS_CC); } else { execute_internal(current_execute_data, return_value_used TSRMLS_CC); } #else if (xdebug_old_execute_internal) { xdebug_old_execute_internal(current_execute_data, fci, return_value_used TSRMLS_CC); } else { execute_internal(current_execute_data, fci, return_value_used TSRMLS_CC); } #endif if (XG(profiler_enabled)) { xdebug_profiler_function_internal_end(fse TSRMLS_CC); } /* Restore SOAP situation if needed */ if (restore_error_handler_situation) { zend_error_cb = tmp_error_cb; } xdebug_trace_function_end(fse, function_nr TSRMLS_CC); /* Store return value in the trace file */ if (XG(collect_return) && do_return && XG(do_trace) && XG(trace_file) && EG(opline_ptr)) { cur_opcode = *EG(opline_ptr); if (cur_opcode) { zval *ret = xdebug_zval_ptr(cur_opcode->XDEBUG_TYPE(result), &(cur_opcode->result), current_execute_data TSRMLS_CC); if (ret) { char* t = xdebug_return_trace_stack_retval(fse, ret TSRMLS_CC); fprintf(XG(trace_file), "%s", t); fflush(XG(trace_file)); xdfree(t); } } } /* Check for return breakpoints */ if (XG(remote_enabled) && XG(breakpoints_allowed)) { if (!handle_breakpoints(fse, XDEBUG_BRK_FUNC_RETURN)) { XG(remote_enabled) = 0; } } xdebug_llist_remove(XG(stack), XDEBUG_LLIST_TAIL(XG(stack)), xdebug_stack_element_dtor); XG(level)--; } /* Opcode handler for exit, to be able to clean up the profiler */ int xdebug_exit_handler(ZEND_OPCODE_HANDLER_ARGS) { if (XG(profiler_enabled)) { xdebug_profiler_deinit(TSRMLS_C); } return ZEND_USER_OPCODE_DISPATCH; } /* {{{ zend_op_array srm_compile_file (file_handle, type) * This function provides a hook for the execution of bananas */ zend_op_array *xdebug_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC) { zend_op_array *op_array; op_array = old_compile_file(file_handle, type TSRMLS_CC); if (op_array) { if (XG(do_code_coverage) && XG(code_coverage_unused && XDEBUG_PASS_TWO_DONE)) { xdebug_prefill_code_coverage(op_array TSRMLS_CC); } } return op_array; } /* }}} */ #if PHP_VERSION_ID >= 50300 static void xdebug_header_remove_with_prefix(xdebug_llist *headers, char *prefix, int prefix_len TSRMLS_DC) { xdebug_llist_element *le; char *header; for (le = XDEBUG_LLIST_HEAD(XG(headers)); le != NULL; /* intentionally left blank*/) { header = XDEBUG_LLIST_VALP(le); if ((strlen(header) > prefix_len + 1) && (header[prefix_len] == ':') && (strncasecmp(header, prefix, prefix_len) == 0)) { xdebug_llist_element *current = le; le = XDEBUG_LLIST_NEXT(le); xdebug_llist_remove(headers, current, NULL); } else { le = XDEBUG_LLIST_NEXT(le); } } } #endif static int xdebug_header_handler(sapi_header_struct *h XG_SAPI_HEADER_OP_DC, sapi_headers_struct *s TSRMLS_DC) { if (XG(headers)) { #if PHP_VERSION_ID >= 50300 switch (op) { case SAPI_HEADER_ADD: xdebug_llist_insert_next(XG(headers), XDEBUG_LLIST_TAIL(XG(headers)), xdstrdup(h->header)); break; case SAPI_HEADER_REPLACE: { char *colon_offset = strchr(h->header, ':'); if (colon_offset) { char save = *colon_offset; *colon_offset = '\0'; xdebug_header_remove_with_prefix(XG(headers), h->header, strlen(h->header) TSRMLS_CC); *colon_offset = save; } xdebug_llist_insert_next(XG(headers), XDEBUG_LLIST_TAIL(XG(headers)), xdstrdup(h->header)); } break; case SAPI_HEADER_DELETE_ALL: xdebug_llist_empty(XG(headers), NULL); case SAPI_HEADER_DELETE: case SAPI_HEADER_SET_STATUS: break; } #else xdebug_llist_insert_next(XG(headers), XDEBUG_LLIST_TAIL(XG(headers)), xdstrdup(h->header)); #endif } if (xdebug_orig_header_handler) { return xdebug_orig_header_handler(h XG_SAPI_HEADER_OP_CC, s TSRMLS_CC); } return SAPI_HEADER_ADD; } /* {{{ proto void xdebug_set_time_limit(void) Dummy function to prevent time limit from being set within the script */ PHP_FUNCTION(xdebug_set_time_limit) { if (!XG(remote_enabled)) { XG(orig_set_time_limit_func)(INTERNAL_FUNCTION_PARAM_PASSTHRU); } } /* }}} */ /* {{{ proto void xdebug_var_dump(mixed var [, ...] ) Outputs a fancy string representation of a variable */ PHP_FUNCTION(xdebug_var_dump) { zval ***args; int argc; int i, len; char *val; argc = ZEND_NUM_ARGS(); args = (zval ***)emalloc(argc * sizeof(zval **)); if (ZEND_NUM_ARGS() == 0 || zend_get_parameters_array_ex(argc, args) == FAILURE) { efree(args); WRONG_PARAM_COUNT; } for (i = 0; i < argc; i++) { if (XG(default_enable) == 0) { xdebug_php_var_dump(args[i], 1 TSRMLS_CC); } else if (PG(html_errors)) { val = xdebug_get_zval_value_fancy(NULL, (zval*) *args[i], &len, 0, NULL TSRMLS_CC); PHPWRITE(val, len); xdfree(val); } else if ((XG(cli_color) == 1 && xdebug_is_output_tty(TSRMLS_C)) || (XG(cli_color) == 2)) { val = xdebug_get_zval_value_ansi((zval*) *args[i], 0, NULL); PHPWRITE(val, strlen(val)); xdfree(val); } else { val = xdebug_get_zval_value_text((zval*) *args[i], 0, NULL); PHPWRITE(val, strlen(val)); xdfree(val); } } efree(args); } /* }}} */ /* {{{ proto void xdebug_debug_zval(mixed var [, ...] ) Outputs a fancy string representation of a variable */ PHP_FUNCTION(xdebug_debug_zval) { zval ***args; int argc; int i, len; char *val; zval *debugzval; argc = ZEND_NUM_ARGS(); args = (zval ***)emalloc(argc * sizeof(zval **)); if (ZEND_NUM_ARGS() == 0 || zend_get_parameters_array_ex(argc, args) == FAILURE) { efree(args); WRONG_PARAM_COUNT; } #if PHP_VERSION_ID >= 50300 if (!EG(active_symbol_table)) { zend_rebuild_symbol_table(TSRMLS_C); } #endif for (i = 0; i < argc; i++) { if (Z_TYPE_PP(args[i]) == IS_STRING) { XG(active_symbol_table) = EG(active_symbol_table); debugzval = xdebug_get_php_symbol(Z_STRVAL_PP(args[i]), Z_STRLEN_PP(args[i]) + 1); if (debugzval) { php_printf("%s: ", Z_STRVAL_PP(args[i])); if (PG(html_errors)) { val = xdebug_get_zval_value_fancy(NULL, debugzval, &len, 1, NULL TSRMLS_CC); PHPWRITE(val, len); } else if ((XG(cli_color) == 1 && xdebug_is_output_tty(TSRMLS_C)) || (XG(cli_color) == 2)) { val = xdebug_get_zval_value_ansi(debugzval, 1, NULL); PHPWRITE(val, strlen(val)); } else { val = xdebug_get_zval_value(debugzval, 1, NULL); PHPWRITE(val, strlen(val)); } xdfree(val); PHPWRITE("\n", 1); } } } efree(args); } /* }}} */ /* {{{ proto void xdebug_debug_zval_stdout(mixed var [, ...] ) Outputs a fancy string representation of a variable */ PHP_FUNCTION(xdebug_debug_zval_stdout) { zval ***args; int argc; int i; char *val; zval *debugzval; argc = ZEND_NUM_ARGS(); args = (zval ***)emalloc(argc * sizeof(zval **)); if (ZEND_NUM_ARGS() == 0 || zend_get_parameters_array_ex(argc, args) == FAILURE) { efree(args); WRONG_PARAM_COUNT; } #if PHP_VERSION_ID >= 50300 if (!EG(active_symbol_table)) { zend_rebuild_symbol_table(TSRMLS_C); } #endif for (i = 0; i < argc; i++) { if (Z_TYPE_PP(args[i]) == IS_STRING) { XG(active_symbol_table) = EG(active_symbol_table); debugzval = xdebug_get_php_symbol(Z_STRVAL_PP(args[i]), Z_STRLEN_PP(args[i]) + 1); if (debugzval) { printf("%s: ", Z_STRVAL_PP(args[i])); val = xdebug_get_zval_value(debugzval, 1, NULL); printf("%s(%zd)", val, strlen(val)); xdfree(val); printf("\n"); } } } efree(args); } /* }}} */ PHP_FUNCTION(xdebug_enable) { zend_error_cb = xdebug_new_error_cb; zend_throw_exception_hook = xdebug_throw_exception_hook; } PHP_FUNCTION(xdebug_disable) { zend_error_cb = xdebug_old_error_cb; zend_throw_exception_hook = NULL; } PHP_FUNCTION(xdebug_is_enabled) { RETURN_BOOL(zend_error_cb == xdebug_new_error_cb); } PHP_FUNCTION(xdebug_break) { XG(context).do_break = 1; RETURN_TRUE; } PHP_FUNCTION(xdebug_start_error_collection) { if (XG(do_collect_errors) == 1) { php_error(E_NOTICE, "Error collection was already started"); } XG(do_collect_errors) = 1; } PHP_FUNCTION(xdebug_stop_error_collection) { if (XG(do_collect_errors) == 0) { php_error(E_NOTICE, "Error collection was not started"); } XG(do_collect_errors) = 0; } PHP_FUNCTION(xdebug_get_collected_errors) { xdebug_llist_element *le; char *string; zend_bool clear = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &clear) == FAILURE) { return; } array_init(return_value); for (le = XDEBUG_LLIST_HEAD(XG(collected_errors)); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { string = XDEBUG_LLIST_VALP(le); add_next_index_string(return_value, string, 1); } if (clear) { xdebug_llist_destroy(XG(collected_errors), NULL); XG(collected_errors) = xdebug_llist_alloc(xdebug_llist_string_dtor); } } PHP_FUNCTION(xdebug_get_headers) { xdebug_llist_element *le; char *string; array_init(return_value); for (le = XDEBUG_LLIST_HEAD(XG(headers)); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { string = XDEBUG_LLIST_VALP(le); add_next_index_string(return_value, string, 1); } } PHP_FUNCTION(xdebug_get_profiler_filename) { if (XG(profile_filename)) { RETURN_STRING(XG(profile_filename), 1); } else { RETURN_FALSE; } } PHP_FUNCTION(xdebug_dump_aggr_profiling_data) { char *prefix = NULL; int prefix_len; if (!XG(profiler_aggregate)) { RETURN_FALSE; } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &prefix, &prefix_len) == FAILURE) { return; } if (xdebug_profiler_output_aggr_data(prefix TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } else { RETURN_FALSE; } } PHP_FUNCTION(xdebug_clear_aggr_profiling_data) { if (!XG(profiler_aggregate)) { RETURN_FALSE; } zend_hash_clean(&XG(aggr_calls)); RETURN_TRUE; } #if HAVE_PHP_MEMORY_USAGE PHP_FUNCTION(xdebug_memory_usage) { RETURN_LONG(XG_MEMORY_USAGE()); } PHP_FUNCTION(xdebug_peak_memory_usage) { RETURN_LONG(XG_MEMORY_PEAK_USAGE()); } #endif PHP_FUNCTION(xdebug_time_index) { RETURN_DOUBLE(xdebug_get_utime() - XG(start_time)); } ZEND_DLEXPORT void xdebug_statement_call(zend_op_array *op_array) { xdebug_llist_element *le; xdebug_brk_info *brk; function_stack_entry *fse; int lineno; char *file; int level = 0; TSRMLS_FETCH(); if (!EG(current_execute_data)) { return; } lineno = EG(current_execute_data)->opline->lineno; file = (char *) op_array->filename; if (XG(do_code_coverage)) { xdebug_count_line(file, lineno, 0, 0 TSRMLS_CC); } if (XG(remote_enabled)) { if (XG(context).do_break) { XG(context).do_break = 0; if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_BREAK, NULL, NULL)) { XG(remote_enabled) = 0; return; } } /* Get latest stack level */ if (XG(stack)) { le = XDEBUG_LLIST_TAIL(XG(stack)); fse = XDEBUG_LLIST_VALP(le); level = fse->level; } else { level = 0; } if (XG(context).do_finish && XG(context).next_level == level) { /* Check for "finish" */ XG(context).do_finish = 0; if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_STEP, NULL, NULL)) { XG(remote_enabled) = 0; return; } return; } if (XG(context).do_next && XG(context).next_level >= level) { /* Check for "next" */ XG(context).do_next = 0; if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_STEP, NULL, NULL)) { XG(remote_enabled) = 0; return; } return; } if (XG(context).do_step) { /* Check for "step" */ XG(context).do_step = 0; if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_STEP, NULL, NULL)) { XG(remote_enabled) = 0; return; } return; } if (XG(context).line_breakpoints) { int break_ok; int old_error_reporting; zval retval; int file_len = strlen(file); for (le = XDEBUG_LLIST_HEAD(XG(context).line_breakpoints); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { brk = XDEBUG_LLIST_VALP(le); #if 0 printf("b->d: %d; ln: %d; b->l: %d; b->f: %s; f: %s, f_l: %d; b->f_l: %d\n", brk->disabled, lineno, brk->lineno, brk->file, file, file_len, brk->file_len); #endif #if PHP_WIN32 if (!brk->disabled && lineno == brk->lineno && file_len >= brk->file_len && strncasecmp(brk->file, file + file_len - brk->file_len, brk->file_len) == 0) { #else if (!brk->disabled && lineno == brk->lineno && file_len >= brk->file_len && memcmp(brk->file, file + file_len - brk->file_len, brk->file_len) == 0) { #endif break_ok = 1; /* Breaking is allowed by default */ /* Check if we have a condition set for it */ if (brk->condition) { /* If there is a condition, we disable breaking by * default and only enabled it when the code evaluates * to TRUE */ break_ok = 0; /* Remember error reporting level */ old_error_reporting = EG(error_reporting); EG(error_reporting) = 0; /* Check the condition */ if (zend_eval_string(brk->condition, &retval, "xdebug conditional breakpoint" TSRMLS_CC) == SUCCESS) { convert_to_boolean(&retval); break_ok = retval.value.lval; zval_dtor(&retval); } /* Restore error reporting level */ EG(error_reporting) = old_error_reporting; } if (break_ok && xdebug_handle_hit_value(brk)) { if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_BREAK, NULL, NULL)) { XG(remote_enabled) = 0; break; } return; } } } } } } ZEND_DLEXPORT int xdebug_zend_startup(zend_extension *extension) { zend_xdebug_initialised = 1; return zend_startup_module(&xdebug_module_entry); } ZEND_DLEXPORT void xdebug_zend_shutdown(zend_extension *extension) { /* Do nothing. */ } ZEND_DLEXPORT void xdebug_init_oparray(zend_op_array *op_array) { TSRMLS_FETCH(); op_array->reserved[XG(reserved_offset)] = 0; } #ifndef ZEND_EXT_API #define ZEND_EXT_API ZEND_DLEXPORT #endif ZEND_EXTENSION(); ZEND_DLEXPORT zend_extension zend_extension_entry = { XDEBUG_NAME, XDEBUG_VERSION, XDEBUG_AUTHOR, XDEBUG_URL_FAQ, XDEBUG_COPYRIGHT_SHORT, xdebug_zend_startup, xdebug_zend_shutdown, NULL, /* activate_func_t */ NULL, /* deactivate_func_t */ NULL, /* message_handler_func_t */ NULL, /* op_array_handler_func_t */ xdebug_statement_call, /* statement_handler_func_t */ NULL, /* fcall_begin_handler_func_t */ NULL, /* fcall_end_handler_func_t */ xdebug_init_oparray, /* op_array_ctor_func_t */ NULL, /* op_array_dtor_func_t */ STANDARD_ZEND_EXTENSION_PROPERTIES }; #endif xdebug-2.2.3/xdebug_code_coverage.c0000644000175000017500000005571512147043204016561 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #include "php_xdebug.h" #include "xdebug_private.h" #include "xdebug_set.h" #include "xdebug_var.h" #include "xdebug_code_coverage.h" #include "xdebug_compat.h" #include "xdebug_tracing.h" extern ZEND_DECLARE_MODULE_GLOBALS(xdebug); void xdebug_coverage_line_dtor(void *data) { xdebug_coverage_line *line = (xdebug_coverage_line *) data; xdfree(line); } void xdebug_coverage_file_dtor(void *data) { xdebug_coverage_file *file = (xdebug_coverage_file *) data; xdebug_hash_destroy(file->lines); xdfree(file->name); xdfree(file); } #define XDEBUG_OPCODE_OVERRIDE(f) \ int xdebug_##f##_handler(ZEND_OPCODE_HANDLER_ARGS) \ { \ return xdebug_common_override_handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); \ } int xdebug_common_override_handler(ZEND_OPCODE_HANDLER_ARGS) { if (XG(do_code_coverage)) { zend_op *cur_opcode; int lineno; char *file; zend_op_array *op_array = execute_data->op_array; cur_opcode = *EG(opline_ptr); lineno = cur_opcode->lineno; file = (char *)op_array->filename; xdebug_count_line(file, lineno, 0, 0 TSRMLS_CC); } return ZEND_USER_OPCODE_DISPATCH; } static char *xdebug_find_var_name(zend_execute_data *execute_data TSRMLS_DC) { zend_op *cur_opcode, *next_opcode, *prev_opcode = NULL, *opcode_ptr; zval *dimval; int is_var, cv_len; zend_op_array *op_array = execute_data->op_array; xdebug_str name = {0, 0, NULL}; int gohungfound = 0, is_static = 0; char *zval_value = NULL; xdebug_var_export_options *options; cur_opcode = *EG(opline_ptr); next_opcode = cur_opcode + 1; prev_opcode = cur_opcode - 1; if (cur_opcode->XDEBUG_TYPE(op1) == IS_VAR && (next_opcode->XDEBUG_TYPE(op1) == IS_VAR || cur_opcode->XDEBUG_TYPE(op2) == IS_VAR) && prev_opcode->opcode == ZEND_FETCH_RW && prev_opcode->XDEBUG_TYPE(op1) == IS_CONST && #if PHP_VERSION_ID >= 50399 Z_TYPE_P(prev_opcode->op1.zv) == IS_STRING #else prev_opcode->op1.u.constant.type == IS_STRING #endif ) { #if PHP_VERSION_ID >= 50399 xdebug_str_add(&name, xdebug_sprintf("$%s", Z_STRVAL_P(prev_opcode->op1.zv)), 1); #else xdebug_str_add(&name, xdebug_sprintf("$%s", prev_opcode->op1.u.constant.value.str.val), 1); #endif } is_static = (prev_opcode->XDEBUG_TYPE(op1) == IS_CONST && prev_opcode->XDEBUG_EXTENDED_VALUE(op2) == ZEND_FETCH_STATIC_MEMBER); options = xdebug_var_export_options_from_ini(TSRMLS_C); options->no_decoration = 1; if (cur_opcode->XDEBUG_TYPE(op1) == IS_CV) { xdebug_str_add(&name, xdebug_sprintf("$%s", zend_get_compiled_variable_name(op_array, cur_opcode->XDEBUG_ZNODE_ELEM(op1, var), &cv_len)), 1); } else if (cur_opcode->XDEBUG_TYPE(op1) == IS_VAR && cur_opcode->opcode == ZEND_ASSIGN && prev_opcode->opcode == ZEND_FETCH_W) { if (is_static) { xdebug_str_add(&name, xdebug_sprintf("self::"), 1); } else { zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, prev_opcode->XDEBUG_TYPE(op1), &prev_opcode->op1, &is_var), 0, options); xdebug_str_add(&name, xdebug_sprintf("$%s", zval_value), 1); } } else if (is_static) { /* todo : see if you can change this and the previous cases around */ xdebug_str_add(&name, xdebug_sprintf("self::"), 1 ); } if (cur_opcode->opcode >= ZEND_ASSIGN_ADD && cur_opcode->opcode <= ZEND_ASSIGN_BW_XOR ) { if (cur_opcode->extended_value == ZEND_ASSIGN_OBJ) { zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, &is_var), 0, options); if (cur_opcode->XDEBUG_TYPE(op1) == IS_UNUSED) { xdebug_str_add(&name, xdebug_sprintf("$this->%s", zval_value), 1); } else { xdebug_str_add(&name, xdebug_sprintf("->%s", zval_value), 1); } } else if (cur_opcode->extended_value == ZEND_ASSIGN_DIM) { zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, &is_var), 0, NULL); xdebug_str_add(&name,xdebug_sprintf("[%s]", zval_value), 1); } } if (cur_opcode->opcode >= ZEND_PRE_INC_OBJ && cur_opcode->opcode <= ZEND_POST_DEC_OBJ) { zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, &is_var), 0, options); xdebug_str_add(&name, xdebug_sprintf("$this->%s", zval_value), 1); } if (zval_value) { xdfree(zval_value); zval_value = NULL; } /* Scroll back to start of FETCHES */ gohungfound = 0; opcode_ptr = prev_opcode; while (opcode_ptr->opcode == ZEND_FETCH_DIM_W || opcode_ptr->opcode == ZEND_FETCH_OBJ_W || opcode_ptr->opcode == ZEND_FETCH_W || opcode_ptr->opcode == ZEND_FETCH_RW) { opcode_ptr = opcode_ptr - 1; gohungfound = 1; } opcode_ptr = opcode_ptr + 1; if (gohungfound) { do { if (opcode_ptr->XDEBUG_TYPE(op1) == IS_UNUSED && opcode_ptr->opcode == ZEND_FETCH_OBJ_W) { xdebug_str_add(&name, "$this", 0); } if (opcode_ptr->XDEBUG_TYPE(op1) == IS_CV) { xdebug_str_add(&name, xdebug_sprintf("$%s", zend_get_compiled_variable_name(op_array, opcode_ptr->XDEBUG_ZNODE_ELEM(op1, var), &cv_len)), 1); } if (opcode_ptr->opcode == ZEND_FETCH_W) { zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, opcode_ptr->XDEBUG_TYPE(op1), &opcode_ptr->op1, &is_var), 0, options); xdebug_str_add(&name, xdebug_sprintf("%s", zval_value), 1); } if (is_static && opcode_ptr->opcode == ZEND_FETCH_RW) { zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, opcode_ptr->XDEBUG_TYPE(op1), &opcode_ptr->op1, &is_var), 0, options); xdebug_str_add(&name, xdebug_sprintf("%s", zval_value), 1); } if (opcode_ptr->opcode == ZEND_FETCH_DIM_W) { if (opcode_ptr->XDEBUG_TYPE(op2) != IS_VAR) { zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, opcode_ptr->XDEBUG_TYPE(op2), &opcode_ptr->op2, &is_var), 0, NULL); xdebug_str_add(&name, xdebug_sprintf("[%s]", zval_value), 1); } else { xdebug_str_add(&name, xdebug_sprintf("[???]") , 1); } } else if (opcode_ptr->opcode == ZEND_FETCH_OBJ_W) { zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, opcode_ptr->XDEBUG_TYPE(op2), &opcode_ptr->op2, &is_var), 0, options); xdebug_str_add(&name, xdebug_sprintf("->%s", zval_value), 1); } opcode_ptr = opcode_ptr + 1; if (zval_value) { xdfree(zval_value); zval_value = NULL; } } while (opcode_ptr->opcode == ZEND_FETCH_DIM_W || opcode_ptr->opcode == ZEND_FETCH_OBJ_W || opcode_ptr->opcode == ZEND_FETCH_W || opcode_ptr->opcode == ZEND_FETCH_RW); } if (cur_opcode->opcode == ZEND_ASSIGN_OBJ) { if (cur_opcode->XDEBUG_TYPE(op1) == IS_UNUSED) { xdebug_str_add(&name, "$this", 0); } dimval = xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, &is_var); xdebug_str_add(&name, xdebug_sprintf("->%s", Z_STRVAL_P(dimval)), 1); } if (cur_opcode->opcode == ZEND_ASSIGN_DIM) { if (next_opcode->opcode == ZEND_OP_DATA && cur_opcode->XDEBUG_TYPE(op2) == IS_UNUSED) { xdebug_str_add(&name, "[]", 0); } else { zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, opcode_ptr->XDEBUG_TYPE(op2), &opcode_ptr->op2, &is_var), 0, NULL); xdebug_str_add(&name, xdebug_sprintf("[%s]", zval_value), 1); xdfree(zval_value); } } xdfree(options->runtime); xdfree(options); return name.d; } static int xdebug_common_assign_dim_handler(char *op, int do_cc, ZEND_OPCODE_HANDLER_ARGS) { char *file; zend_op_array *op_array = execute_data->op_array; int lineno; zend_op *cur_opcode, *next_opcode; char *full_varname; zval *val = NULL; char *t; int is_var; function_stack_entry *fse; cur_opcode = *EG(opline_ptr); next_opcode = cur_opcode + 1; file = (char *) op_array->filename; lineno = cur_opcode->lineno; if (do_cc && XG(do_code_coverage)) { xdebug_count_line(file, lineno, 0, 0 TSRMLS_CC); } if (XG(do_trace) && XG(trace_file) && XG(collect_assignments)) { full_varname = xdebug_find_var_name(execute_data TSRMLS_CC); if (cur_opcode->opcode >= ZEND_PRE_INC && cur_opcode->opcode <= ZEND_POST_DEC) { char *tmp_varname; switch (cur_opcode->opcode) { case ZEND_PRE_INC: tmp_varname = xdebug_sprintf("++%s", full_varname); break; case ZEND_POST_INC: tmp_varname = xdebug_sprintf("%s++", full_varname); break; case ZEND_PRE_DEC: tmp_varname = xdebug_sprintf("--%s", full_varname); break; case ZEND_POST_DEC: tmp_varname = xdebug_sprintf("%s--", full_varname); break; } xdfree(full_varname); full_varname = tmp_varname; val = xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op1), &cur_opcode->op1, &is_var); } else if (cur_opcode->opcode >= ZEND_PRE_INC_OBJ && cur_opcode->opcode <= ZEND_POST_DEC_OBJ) { char *tmp_varname; switch (cur_opcode->opcode) { case ZEND_PRE_INC_OBJ: tmp_varname = xdebug_sprintf("++%s", full_varname); break; case ZEND_POST_INC_OBJ: tmp_varname = xdebug_sprintf("%s++", full_varname); break; case ZEND_PRE_DEC_OBJ: tmp_varname = xdebug_sprintf("--%s", full_varname); break; case ZEND_POST_DEC_OBJ: tmp_varname = xdebug_sprintf("%s--", full_varname); break; } xdfree(full_varname); full_varname = tmp_varname; val = xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, &is_var); } else if (next_opcode->opcode == ZEND_OP_DATA) { val = xdebug_get_zval(execute_data, next_opcode->XDEBUG_TYPE(op1), &next_opcode->op1, &is_var); } else { val = xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, &is_var); } fse = XDEBUG_LLIST_VALP(XDEBUG_LLIST_TAIL(XG(stack))); t = xdebug_return_trace_assignment(fse, full_varname, val, op, file, lineno TSRMLS_CC); xdfree(full_varname); fprintf(XG(trace_file), "%s", t); fflush(XG(trace_file)); xdfree(t); } return ZEND_USER_OPCODE_DISPATCH; } #define XDEBUG_OPCODE_OVERRIDE_ASSIGN(f,o,cc) \ int xdebug_##f##_handler(ZEND_OPCODE_HANDLER_ARGS) \ { \ return xdebug_common_assign_dim_handler((o), (cc), ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); \ } XDEBUG_OPCODE_OVERRIDE_ASSIGN(assign,"=",1) XDEBUG_OPCODE_OVERRIDE_ASSIGN(assign_add,"+=",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(assign_sub,"-=",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(assign_mul,"*=",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(assign_div,"/=",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(assign_mod,"%=",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(assign_sl,"<<=",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(assign_sr,">>=",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(pre_inc,"",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(post_inc,"",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(pre_dec,"",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(post_dec,"",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(pre_inc_obj,"",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(post_inc_obj,"",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(pre_dec_obj,"",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(post_dec_obj,"",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(assign_concat,".=",1) XDEBUG_OPCODE_OVERRIDE_ASSIGN(assign_bw_or,"|=",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(assign_bw_and,"&=",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(assign_bw_xor,"^=",0) XDEBUG_OPCODE_OVERRIDE_ASSIGN(assign_dim,"=",1) XDEBUG_OPCODE_OVERRIDE_ASSIGN(assign_obj,"=",1) void xdebug_count_line(char *filename, int lineno, int executable, int deadcode TSRMLS_DC) { xdebug_coverage_file *file; xdebug_coverage_line *line; if (strcmp(XG(previous_filename), filename) == 0) { file = XG(previous_file); } else { /* Check if the file already exists in the hash */ if (!xdebug_hash_find(XG(code_coverage), filename, strlen(filename), (void *) &file)) { /* The file does not exist, so we add it to the hash, and * add a line element to the file */ file = xdmalloc(sizeof(xdebug_coverage_file)); file->name = xdstrdup(filename); file->lines = xdebug_hash_alloc(128, xdebug_coverage_line_dtor); xdebug_hash_add(XG(code_coverage), filename, strlen(filename), file); } XG(previous_filename) = file->name; XG(previous_file) = file; } /* Check if the line already exists in the hash */ if (!xdebug_hash_index_find(file->lines, lineno, (void *) &line)) { line = xdmalloc(sizeof(xdebug_coverage_line)); line->lineno = lineno; line->count = 0; line->executable = 0; xdebug_hash_index_add(file->lines, lineno, line); } if (executable) { if (line->executable != 1 && deadcode) { line->executable = 2; } else { line->executable = 1; } } else { line->count++; } } static void prefill_from_opcode(char *fn, zend_op opcode, int deadcode TSRMLS_DC) { if ( opcode.opcode != ZEND_NOP && opcode.opcode != ZEND_EXT_NOP && opcode.opcode != ZEND_RECV && opcode.opcode != ZEND_RECV_INIT && opcode.opcode != ZEND_VERIFY_ABSTRACT_CLASS && opcode.opcode != ZEND_OP_DATA && opcode.opcode != ZEND_ADD_INTERFACE && opcode.opcode != ZEND_TICKS ) { xdebug_count_line(fn, opcode.lineno, 1, deadcode TSRMLS_CC); } } static zend_brk_cont_element* xdebug_find_brk_cont(zval *nest_levels_zval, int array_offset, zend_op_array *op_array) { int nest_levels; zend_brk_cont_element *jmp_to; nest_levels = nest_levels_zval->value.lval; do { if (array_offset == -1) { /* broken break/continue in code */ return NULL; } jmp_to = &op_array->brk_cont_array[array_offset]; array_offset = jmp_to->parent; } while (--nest_levels > 0); return jmp_to; } static int xdebug_find_jump(zend_op_array *opa, unsigned int position, long *jmp1, long *jmp2) { zend_op *base_address = &(opa->opcodes[0]); zend_op opcode = opa->opcodes[position]; if (opcode.opcode == ZEND_JMP) { *jmp1 = ((long) opcode.XDEBUG_ZNODE_ELEM(op1, jmp_addr) - (long) base_address) / sizeof(zend_op); return 1; } else if ( opcode.opcode == ZEND_JMPZ || opcode.opcode == ZEND_JMPNZ || opcode.opcode == ZEND_JMPZ_EX || opcode.opcode == ZEND_JMPNZ_EX ) { *jmp1 = position + 1; *jmp2 = ((long) opcode.XDEBUG_ZNODE_ELEM(op2, jmp_addr) - (long) base_address) / sizeof(zend_op); return 1; } else if (opcode.opcode == ZEND_JMPZNZ) { *jmp1 = opcode.XDEBUG_ZNODE_ELEM(op2, opline_num); *jmp2 = opcode.extended_value; return 1; } else if (opcode.opcode == ZEND_BRK || opcode.opcode == ZEND_CONT) { zend_brk_cont_element *el; if (opcode.XDEBUG_TYPE(op2) == IS_CONST && opcode.XDEBUG_ZNODE_ELEM(op1, jmp_addr) != (zend_op*) 0xFFFFFFFF ) { #if PHP_VERSION_ID >= 50399 el = xdebug_find_brk_cont(opcode.op2.zv, opcode.XDEBUG_ZNODE_ELEM(op1, opline_num), opa); #else el = xdebug_find_brk_cont(&opcode.op2.u.constant, opcode.op1.u.opline_num, opa); #endif if (el) { *jmp1 = opcode.opcode == ZEND_BRK ? el->brk : el->cont; return 1; } else { /* broken break/continue in code */ return 0; } } } else if (opcode.opcode == ZEND_FE_RESET || opcode.opcode == ZEND_FE_FETCH) { *jmp1 = position + 1; *jmp2 = opcode.XDEBUG_ZNODE_ELEM(op2, opline_num); return 1; #if (PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) } else if (opcode.opcode == ZEND_GOTO) { *jmp1 = ((long) opcode.XDEBUG_ZNODE_ELEM(op1, jmp_addr) - (long) base_address) / sizeof(zend_op); return 1; #endif } return 0; } static void xdebug_analyse_branch(zend_op_array *opa, unsigned int position, xdebug_set *set TSRMLS_DC) { long jump_pos1; long jump_pos2; /*(fprintf(stderr, "Branch analysis from position: %d\n", position);)*/ /* First we see if the branch has been visited, if so we bail out. */ if (xdebug_set_in(set, position)) { return; } /* Loop over the opcodes until the end of the array, or until a jump point has been found */ xdebug_set_add(set, position); /*(fprintf(stderr, "XDEBUG Adding %d\n", position);)*/ while (position < opa->last) { jump_pos1 = -1; jump_pos2 = -1; /* See if we have a jump instruction */ if (xdebug_find_jump(opa, position, &jump_pos1, &jump_pos2)) { /*(fprintf(stderr, "XDEBUG Jump found. Position 1 = %d", jump_pos1);)*/ if (jump_pos2 != -1) { /*(fprintf(stderr, ", Position 2 = %d\n", jump_pos2))*/; } else { /*(fprintf(stderr, "\n"))*/; } xdebug_analyse_branch(opa, jump_pos1, set TSRMLS_CC); if (jump_pos2 != -1 && jump_pos2 <= opa->last) { xdebug_analyse_branch(opa, jump_pos2, set TSRMLS_CC); } break; } /* See if we have a throw instruction */ if (opa->opcodes[position].opcode == ZEND_THROW) { /* fprintf(stderr, "Throw found at %d\n", position); */ break; } /* See if we have an exit instruction */ if (opa->opcodes[position].opcode == ZEND_EXIT) { /* fprintf(stderr, "X* Return found\n"); */ break; } /* See if we have a return instruction */ if ( opa->opcodes[position].opcode == ZEND_RETURN #if PHP_VERSION_ID >= 50400 || opa->opcodes[position].opcode == ZEND_RETURN_BY_REF #endif ) { /*(fprintf(stderr, "XDEBUG Return found\n");)*/ break; } position++; /*(fprintf(stderr, "XDEBUG Adding %d\n", position);)*/ xdebug_set_add(set, position); } } static void xdebug_analyse_oparray(zend_op_array *opa, xdebug_set *set TSRMLS_DC) { unsigned int position = 0; while (position < opa->last) { if (position == 0) { xdebug_analyse_branch(opa, position, set TSRMLS_CC); } else if (opa->opcodes[position].opcode == ZEND_CATCH) { xdebug_analyse_branch(opa, position, set TSRMLS_CC); } position++; } } static void prefill_from_oparray(char *fn, zend_op_array *op_array TSRMLS_DC) { unsigned int i; xdebug_set *set = NULL; op_array->reserved[XG(reserved_offset)] = (void*) 1; /* Check for abstract methods and simply return from this function in those * cases. */ #if PHP_VERSION_ID >= 50300 if (op_array->last >= 3 && op_array->opcodes[op_array->last - 3].opcode == ZEND_RAISE_ABSTRACT_ERROR) #else if (op_array->last >= 4 && op_array->opcodes[op_array->last - 4].opcode == ZEND_RAISE_ABSTRACT_ERROR) #endif { return; } /* Run dead code analysis if requested */ if (XG(code_coverage_dead_code_analysis) && XDEBUG_PASS_TWO_DONE) { set = xdebug_set_create(op_array->last); xdebug_analyse_oparray(op_array, set TSRMLS_CC); } /* The normal loop then finally */ for (i = 0; i < op_array->last; i++) { zend_op opcode = op_array->opcodes[i]; prefill_from_opcode(fn, opcode, set ? !xdebug_set_in(set, i) : 0 TSRMLS_CC); } if (set) { xdebug_set_free(set); } } static int prefill_from_function_table(zend_op_array *opa XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { char *new_filename; #if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300 TSRMLS_FETCH(); #endif new_filename = va_arg(args, char*); if (opa->type == ZEND_USER_FUNCTION) { if (opa->reserved[XG(reserved_offset)] != (void*) 1 /* && opa->filename && strcmp(opa->filename, new_filename) == 0)*/) { prefill_from_oparray((char *) opa->filename, opa TSRMLS_CC); } } return ZEND_HASH_APPLY_KEEP; } static int prefill_from_class_table(zend_class_entry **class_entry XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { char *new_filename; zend_class_entry *ce; ce = *class_entry; new_filename = va_arg(args, char*); if (ce->type == ZEND_USER_CLASS) { if (!(ce->ce_flags & ZEND_XDEBUG_VISITED)) { ce->ce_flags |= ZEND_XDEBUG_VISITED; zend_hash_apply_with_arguments(&ce->function_table XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) prefill_from_function_table, 1, new_filename); } } return ZEND_HASH_APPLY_KEEP; } void xdebug_prefill_code_coverage(zend_op_array *op_array TSRMLS_DC) { if (op_array->reserved[XG(reserved_offset)] != (void*) 1) { prefill_from_oparray((char *) op_array->filename, op_array TSRMLS_CC); } zend_hash_apply_with_arguments(CG(function_table) XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) prefill_from_function_table, 1, op_array->filename); zend_hash_apply_with_arguments(CG(class_table) XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) prefill_from_class_table, 1, op_array->filename); } PHP_FUNCTION(xdebug_start_code_coverage) { long options = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &options) == FAILURE) { return; } XG(code_coverage_unused) = (options & XDEBUG_CC_OPTION_UNUSED); XG(code_coverage_dead_code_analysis) = (options & XDEBUG_CC_OPTION_DEAD_CODE); if (!XG(extended_info)) { php_error(E_WARNING, "You can only use code coverage when you leave the setting of 'xdebug.extended_info' to the default '1'."); RETURN_FALSE; } else if (!XG(code_coverage)) { php_error(E_WARNING, "Code coverage needs to be enabled in php.ini by setting 'xdebug.coverage_enable' to '1'."); RETURN_FALSE; } else { XG(do_code_coverage) = 1; RETURN_TRUE; } } PHP_FUNCTION(xdebug_stop_code_coverage) { long cleanup = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &cleanup) == FAILURE) { return; } if (XG(do_code_coverage)) { if (cleanup) { XG(previous_filename) = ""; XG(previous_file) = NULL; xdebug_hash_destroy(XG(code_coverage)); XG(code_coverage) = xdebug_hash_alloc(32, xdebug_coverage_file_dtor); } XG(do_code_coverage) = 0; RETURN_TRUE; } RETURN_FALSE; } static int xdebug_lineno_cmp(const void *a, const void *b TSRMLS_DC) { Bucket *f = *((Bucket **) a); Bucket *s = *((Bucket **) b); if (f->h < s->h) { return -1; } else if (f->h > s->h) { return 1; } else { return 0; } } static void add_line(void *ret, xdebug_hash_element *e) { xdebug_coverage_line *line = (xdebug_coverage_line*) e->ptr; zval *retval = (zval*) ret; if (line->executable && (line->count == 0)) { add_index_long(retval, line->lineno, -line->executable); } else { add_index_long(retval, line->lineno, 1); } } static void add_file(void *ret, xdebug_hash_element *e) { xdebug_coverage_file *file = (xdebug_coverage_file*) e->ptr; zval *retval = (zval*) ret; zval *lines; HashTable *target_hash; TSRMLS_FETCH(); MAKE_STD_ZVAL(lines); array_init(lines); /* Add all the lines */ xdebug_hash_apply(file->lines, (void *) lines, add_line); /* Sort on linenumber */ target_hash = HASH_OF(lines); zend_hash_sort(target_hash, zend_qsort, xdebug_lineno_cmp, 0 TSRMLS_CC); add_assoc_zval_ex(retval, file->name, strlen(file->name) + 1, lines); } PHP_FUNCTION(xdebug_get_code_coverage) { array_init(return_value); xdebug_hash_apply(XG(code_coverage), (void *) return_value, add_file); } PHP_FUNCTION(xdebug_get_function_count) { RETURN_LONG(XG(function_count)); } xdebug-2.2.3/xdebug_code_coverage.h0000644000175000017500000000657412147043204016565 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #ifndef __HAVE_XDEBUG_CODE_COVERAGE_H__ #define __HAVE_XDEBUG_CODE_COVERAGE_H__ #include "php.h" #include "xdebug_hash.h" #include "xdebug_mm.h" typedef struct xdebug_coverage_line { int lineno; int count; int executable; } xdebug_coverage_line; typedef struct xdebug_coverage_file { char *name; xdebug_hash *lines; } xdebug_coverage_file; /* Needed for code coverage as Zend doesn't always add EXT_STMT when expected */ #define XDEBUG_SET_OPCODE_OVERRIDE_COMMON(oc) \ zend_set_user_opcode_handler(oc, xdebug_common_override_handler); #define XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(f,oc) \ zend_set_user_opcode_handler(oc, xdebug_##f##_handler); void xdebug_coverage_line_dtor(void *data); void xdebug_coverage_file_dtor(void *data); int xdebug_common_override_handler(ZEND_OPCODE_HANDLER_ARGS); #define XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(f) \ int xdebug_##f##_handler(ZEND_OPCODE_HANDLER_ARGS) XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(assign); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(assign_add); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(assign_sub); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(assign_mul); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(assign_div); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(assign_mod); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(assign_sl); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(assign_sr); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(pre_inc); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(post_inc); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(pre_dec); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(post_dec); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(pre_inc_obj); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(post_inc_obj); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(pre_dec_obj); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(post_dec_obj); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(assign_concat); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(assign_bw_or); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(assign_bw_and); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(assign_bw_xor); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(assign_dim); XDEBUG_OPCODE_OVERRIDE_ASSIGN_DECL(assign_obj); void xdebug_count_line(char *file, int lineno, int executable, int deadcode TSRMLS_DC); void xdebug_prefill_code_coverage(zend_op_array *op_array TSRMLS_DC); PHP_FUNCTION(xdebug_start_code_coverage); PHP_FUNCTION(xdebug_stop_code_coverage); PHP_FUNCTION(xdebug_get_code_coverage); PHP_FUNCTION(xdebug_get_function_count); #endif xdebug-2.2.3/xdebug_com.c0000644000175000017500000000702312147043204014537 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #define DEBUGGER_FAIL_SILENTLY #include #include #include #ifndef PHP_WIN32 #include #endif #ifdef PHP_WIN32 # include # include # include "win32/time.h" #define PATH_MAX MAX_PATH #else # include # include # include # include # include #endif #include "xdebug_com.h" #ifdef PHP_WIN32 int inet_aton(const char *cp, struct in_addr *inp) { inp->s_addr = inet_addr(cp); if (inp->s_addr == INADDR_NONE) { return 0; } return 1; } #endif /* * Converts a host name to an IP address. */ static int lookup_hostname(const char *addr, struct in_addr *in) { struct hostent *host_info; if (!inet_aton(addr, in)) { host_info = gethostbyname(addr); if (host_info == 0) { /* Error: unknown host */ return -1; } *in = *((struct in_addr *) host_info->h_addr); } return 0; } /* }}} */ int xdebug_create_socket(const char *hostname, int dport) { struct sockaddr_in address; int err = -1; int sockfd; #if WIN32|WINNT WORD wVersionRequested; WSADATA wsaData; char optval = 1; wVersionRequested = MAKEWORD(2, 2); WSAStartup(wVersionRequested, &wsaData); #else long optval = 1; #endif memset(&address, 0, sizeof(address)); lookup_hostname(hostname, &address.sin_addr); address.sin_family = AF_INET; address.sin_port = htons((unsigned short)dport); sockfd = socket(address.sin_family, SOCK_STREAM, 0); if (sockfd == SOCK_ERR) { #ifndef DEBUGGER_FAIL_SILENTLY #if WIN32|WINNT printf("create_debugger_socket(\"%s\", %d) socket: %d\n", hostname, dport, WSAGetLastError()); #else printf("create_debugger_socket(\"%s\", %d) socket: %s\n", hostname, dport, strerror(errno)); #endif #endif return -1; } while ((err = connect(sockfd, (struct sockaddr *) &address, sizeof(address))) == SOCK_ERR && errno == EAGAIN); if (err < 0) { #ifndef DEBUGGER_FAIL_SILENTLY #if WIN32|WINNT printf("create_debugger_socket(\"%s\", %d) connect: %d\n", hostname, dport, WSAGetLastError()); #else printf("create_debugger_socket(\"%s\", %d) connect: %s\n", hostname, dport, strerror(errno)); #endif #endif SCLOSE(sockfd); return -1; } setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &optval, sizeof(optval)); return sockfd; } void xdebug_close_socket(int socket) { SCLOSE(socket); } xdebug-2.2.3/xdebug_com.h0000644000175000017500000000407512147043204014550 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #ifndef __HAVE_XDEBUG_COM_H__ #define __HAVE_XDEBUG_COM_H__ #ifdef PHP_WIN32 int inet_aton(const char *cp, struct in_addr *inp); #endif #if WIN32|WINNT # define SOCK_ERR INVALID_SOCKET # define SOCK_CONN_ERR SOCKET_ERROR # define SOCK_RECV_ERR SOCKET_ERROR #else # define SOCK_ERR -1 # define SOCK_CONN_ERR -1 # define SOCK_RECV_ERR -1 #endif #if WIN32|WINNT #define SCLOSE(a) closesocket(a) #define SSENDL(a,b,c) send(a,b,c,0) #define SSEND(a,b) send(a,b,strlen(b),0) #define SREAD(a,b,c) recv(a,b,c,0) #else #define SCLOSE(a) close(a) #define SSENDL(a,b,c) write(a,b,c) #define SSEND(a,b) write(a,b,strlen(b)) #define SREAD(a,b,c) read(a,b,c) #endif #define SENDMSG(socket, str) { \ char *message_buffer; \ \ message_buffer = str; \ SSEND(socket, message_buffer); \ xdfree(message_buffer); \ } int xdebug_create_socket(const char *hostname, int dport); void xdebug_close_socket(int socket); #endif xdebug-2.2.3/xdebug_compat.c0000644000175000017500000001125512147043204015246 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | | (c) 1997-2004 Jim Winstead | | (c) 1998-2004 Andi Gutmans and | | Zeev Suraski | +----------------------------------------------------------------------+ | This source file is subject to the following Modified BSD license: | | | | Redistribution and use in source and binary forms, with or without | | modification, are permitted provided that the following conditions | | are met: | | | | 1. Redistributions of source code must retain the above copyright | | notice, this list of conditions and the following disclaimer. | | | | 2. Redistributions in binary form must reproduce the above | | copyright notice, this list of conditions and the following | | disclaimer in the documentation and/or other materials provided | | with the distribution. | | | | 3. The name of the author may not be used to endorse or promote | | products derived from this software without specific prior | | written permission. | | | | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | +----------------------------------------------------------------------+ */ /* $Id: xdebug_compat.c,v 1.13 2010-05-07 20:39:13 derick Exp $ */ #include "php.h" #include "main/php_version.h" #include "xdebug_compat.h" #include "zend_extensions.h" #if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1 void *php_zend_memrchr(const void *s, int c, size_t n) { register unsigned char *e; if (n <= 0) { return NULL; } for (e = (unsigned char *)s + n - 1; e >= (unsigned char *)s; e--) { if (*e == (unsigned char)c) { return (void *)e; } } return NULL; } #endif #if PHP_VERSION_ID >= 50500 # define T(offset) (*EX_TMP_VAR(zdata, offset)) #else # define T(offset) (*(temp_variable *)((char*)zdata->Ts + offset)) #endif zval *xdebug_zval_ptr(int op_type, XDEBUG_ZNODE *node, zend_execute_data *zdata TSRMLS_DC) { switch (op_type & 0x0F) { case IS_CONST: #if PHP_VERSION_ID >= 50399 return node->zv; #else return &node->u.constant; #endif break; case IS_TMP_VAR: return &T(XDEBUG_ZNODEP_ELEM(node, var)).tmp_var; break; case IS_VAR: if (T(XDEBUG_ZNODEP_ELEM(node, var)).var.ptr) { return T(XDEBUG_ZNODEP_ELEM(node, var)).var.ptr; } else { temp_variable *T = &T(XDEBUG_ZNODEP_ELEM(node, var)); zval *str = T->str_offset.str; if (T->str_offset.str->type != IS_STRING || ((int)T->str_offset.offset<0) || (T->str_offset.str->value.str.len <= T->str_offset.offset)) { zend_error(E_NOTICE, "Uninitialized string offset: %d", T->str_offset.offset); T->tmp_var.value.str.val = STR_EMPTY_ALLOC(); T->tmp_var.value.str.len = 0; } else { char c = str->value.str.val[T->str_offset.offset]; T->tmp_var.value.str.val = estrndup(&c, 1); T->tmp_var.value.str.len = 1; } T->tmp_var.XDEBUG_REFCOUNT=1; T->tmp_var.XDEBUG_IS_REF=1; T->tmp_var.type = IS_STRING; return &T->tmp_var; } break; case IS_UNUSED: return NULL; break; } return NULL; } xdebug-2.2.3/xdebug_compat.h0000644000175000017500000000533012147043204015250 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #ifndef __HAVE_XDEBUG_COMPAT_H__ #define __HAVE_XDEBUG_COMPAT_H__ #include "php.h" #include "ext/standard/php_var.h" #define xdebug_php_var_dump php_var_dump #if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1 # define zend_memrchr php_zend_memrchr void *php_zend_memrchr(const void *s, int c, size_t n); #endif #if PHP_VERSION_ID >= 50399 # define XDEBUG_ZNODE znode_op # define XDEBUG_ZNODE_ELEM(node,var) node.var # define XDEBUG_ZNODEP_ELEM(node,var) node->var # define XDEBUG_TYPE(t) t##_type # define XDEBUG_EXTENDED_VALUE(o) extended_value # define XDEBUG_PASS_TWO_DONE (op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) #else # define XDEBUG_ZNODE znode # define XDEBUG_ZNODE_ELEM(node,var) node.u.var # define XDEBUG_ZNODEP_ELEM(node,var) node->u.var # define XDEBUG_TYPE(t) t.op_type # define XDEBUG_EXTENDED_VALUE(o) o.u.EA.type # define XDEBUG_PASS_TWO_DONE op_array->done_pass_two #endif zval *xdebug_zval_ptr(int op_type, XDEBUG_ZNODE *node, zend_execute_data *zdata TSRMLS_DC); #include "ext/standard/base64.h" #define xdebug_base64_encode php_base64_encode #define xdebug_base64_decode php_base64_decode #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) || (PHP_MAJOR_VERSION >= 6) # define XDEBUG_REFCOUNT refcount__gc # define XDEBUG_IS_REF is_ref__gc #else # define XDEBUG_REFCOUNT refcount # define XDEBUG_IS_REF is_ref #endif #if defined(PHP_VERSION_ID) && PHP_VERSION_ID >= 50300 && ZTS # define XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC TSRMLS_DC # define XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC TSRMLS_CC #else # define XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC # define XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC #endif #endif xdebug-2.2.3/xdebug_handlers.c0000644000175000017500000000455412147043204015567 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #include "php_xdebug.h" #include "xdebug_com.h" #include "xdebug_handlers.h" #include "xdebug_handler_dbgp.h" #include "xdebug_mm.h" xdebug_remote_handler_info handlers[] = { { "dbgp", "DBGp - Common DeBuGger Protocol", xdebug_handler_dbgp }, { 0, NULL, { NULL } } }; xdebug_remote_handler* xdebug_handler_get(char* mode) { xdebug_remote_handler_info *ptr = handlers; while (ptr->name) { if (strcmp(mode, ptr->name) == 0) { return &ptr->handler; } ptr++; } return NULL; } xdebug_remote_handler_info* xdebug_handlers_get(void) { return handlers; } void xdebug_brk_info_dtor(xdebug_brk_info *brk) { if (brk->type) { xdfree(brk->type); } if (brk->classname) { xdfree(brk->classname); } if (brk->functionname) { xdfree(brk->functionname); } if (brk->file) { xdfree(brk->file); } if (brk->condition) { efree(brk->condition); } xdfree(brk); } void xdebug_hash_brk_dtor(xdebug_brk_info *brk) { xdebug_brk_info_dtor(brk); } void xdebug_llist_brk_dtor(void *dummy, xdebug_brk_info *brk) { xdebug_brk_info_dtor(brk); } void xdebug_hash_eval_info_dtor(xdebug_eval_info *ei) { ei->refcount--; if (ei->refcount == 0) { xdfree(ei->contents); xdfree(ei); } else { /* refcount wasn't 0 yet, so we won't free it yet */ } } xdebug-2.2.3/xdebug_handlers.h0000644000175000017500000001121012147043204015557 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #ifndef __HAVE_XDEBUG_HANDLERS_H__ #define __HAVE_XDEBUG_HANDLERS_H__ #include "php_xdebug.h" #include "xdebug_com.h" #include "xdebug_llist.h" #include "xdebug_hash.h" #include "xdebug_private.h" #include "usefulstuff.h" typedef struct _xdebug_brk_admin xdebug_brk_admin; typedef struct _xdebug_brk_info xdebug_brk_info; typedef struct _xdebug_eval_info xdebug_eval_info; typedef struct _xdebug_con xdebug_con; typedef struct _xdebug_debug_list xdebug_debug_list; typedef struct _xdebug_remote_handler xdebug_remote_handler; typedef struct _xdebug_remote_handler_info xdebug_remote_handler_info; struct _xdebug_debug_list { char *last_file; int last_line; }; #define BREAKPOINT_TYPE_LINE 1 #define BREAKPOINT_TYPE_FUNCTION 2 #define BREAKPOINT_TYPE_EXCEPTION 4 struct _xdebug_brk_admin { int id; int type; char *key; }; struct _xdebug_con { int socket; void *options; xdebug_remote_handler *handler; fd_buf *buffer; char *program_name; xdebug_hash *breakpoint_list; xdebug_hash *function_breakpoints; xdebug_hash *eval_id_lookup; int eval_id_sequence; xdebug_llist *line_breakpoints; xdebug_hash *exception_breakpoints; xdebug_debug_list list; int do_break; int do_step; int do_next; int do_finish; int next_level; }; #define XDEBUG_HIT_DISABLED 0 #define XDEBUG_HIT_GREATER_EQUAL 1 #define XDEBUG_HIT_EQUAL 2 #define XDEBUG_HIT_MOD 3 #define XDEBUG_BRK_FUNC_CALL 1 #define XDEBUG_BRK_FUNC_RETURN 2 struct _xdebug_brk_info { char *type; char *classname; char *functionname; char *exceptionname; int function_break_type; /* XDEBUG_BRK_FUNC_* */ char *file; int file_len; int lineno; char *condition; int disabled; int temporary; int hit_count; int hit_value; int hit_condition; }; struct _xdebug_eval_info { int id; int refcount; char *contents; }; struct _xdebug_remote_handler { /* Init / deinit */ int (*remote_init)(xdebug_con *h, int mode); int (*remote_deinit)(xdebug_con *h); /* Stack messages */ int (*remote_error)(xdebug_con *h, int type, char *exception_type, char *message, const char *location, const uint line, xdebug_llist *stack); /* Breakpoints */ int (*remote_breakpoint)(xdebug_con *h, xdebug_llist *stack, char *file, long lineno, int type, char *exception, char *message); /* Output redirection */ int (*remote_stream_output)(const char *string, unsigned int length TSRMLS_DC); /* Eval ID registration and removal */ int (*register_eval_id)(xdebug_con *h, function_stack_entry *fse); /* Information */ char *(*get_revision)(void); }; struct _xdebug_remote_handler_info { char *name; char *description; xdebug_remote_handler handler; }; xdebug_remote_handler* xdebug_handler_get(char* mode); xdebug_remote_handler_info* xdebug_handlers_get(void); void xdebug_brk_info_dtor(xdebug_brk_info *brk); void xdebug_llist_brk_dtor(void *dummy, xdebug_brk_info *brk); void xdebug_hash_brk_dtor(xdebug_brk_info *brk); void xdebug_hash_eval_info_dtor(xdebug_eval_info *ei); #endif xdebug-2.2.3/xdebug_handler_dbgp.c0000644000175000017500000024264512147043204016405 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | | Shane Caraveo | +----------------------------------------------------------------------+ */ #include #ifndef PHP_WIN32 #include #endif #include "php.h" #include "SAPI.h" #include "ext/standard/php_string.h" #include "ext/standard/url.h" #include "main/php_version.h" #include "TSRM.h" #include "php_globals.h" #include "php_xdebug.h" #include "xdebug_private.h" #include "xdebug_code_coverage.h" #include "xdebug_com.h" #include "xdebug_compat.h" #include "xdebug_handler_dbgp.h" #include "xdebug_hash.h" #include "xdebug_llist.h" #include "xdebug_mm.h" #include "xdebug_var.h" #include "xdebug_xml.h" #include "xdebug_compat.h" #ifdef PHP_WIN32 #include "win32/time.h" #include #endif #include ZEND_EXTERN_MODULE_GLOBALS(xdebug) static char *create_eval_key_id(int id); /***************************************************************************** ** Constants and strings for statii and reasons */ /* Status structure */ #define DBGP_STATUS_STARTING 1 #define DBGP_STATUS_STOPPING 2 #define DBGP_STATUS_STOPPED 3 #define DBGP_STATUS_RUNNING 4 #define DBGP_STATUS_BREAK 5 #define DBGP_STATUS_DETACHED 6 char *xdebug_dbgp_status_strings[6] = {"", "starting", "stopping", "stopped", "running", "break"}; #define DBGP_REASON_OK 0 #define DBGP_REASON_ERROR 1 #define DBGP_REASON_ABORTED 2 #define DBGP_REASON_EXCEPTION 3 char *xdebug_dbgp_reason_strings[4] = {"ok", "error", "aborted", "exception"}; typedef struct { int code; char *message; } xdebug_error_entry; xdebug_error_entry xdebug_error_codes[24] = { { 0, "no error" }, { 1, "parse error in command" }, { 2, "duplicate arguments in command" }, { 3, "invalid or missing options" }, { 4, "unimplemented command" }, { 5, "command is not available" }, { 100, "can not open file" }, { 101, "stream redirect failed" }, { 200, "breakpoint could not be set" }, { 201, "breakpoint type is not supported" }, { 202, "invalid breakpoint line" }, { 203, "no code on breakpoint line" }, { 204, "invalid breakpoint state" }, { 205, "no such breakpoint" }, { 206, "error evaluating code" }, { 207, "invalid expression" }, { 300, "can not get property" }, { 301, "stack depth invalid" }, { 302, "context invalid" }, { 800, "profiler not started" }, { 900, "encoding not supported" }, { 998, "an internal exception in the debugger" }, { 999, "unknown error" }, { -1, NULL } }; #define XDEBUG_STR_SWITCH_DECL char *__switch_variable #define XDEBUG_STR_SWITCH(s) __switch_variable = (s); #define XDEBUG_STR_CASE(s) if (strcmp(__switch_variable, s) == 0) { #define XDEBUG_STR_CASE_END } else #define XDEBUG_STR_CASE_DEFAULT { #define XDEBUG_STR_CASE_DEFAULT_END } #define XDEBUG_TYPES_COUNT 8 char *xdebug_dbgp_typemap[XDEBUG_TYPES_COUNT][3] = { /* common, lang, schema */ {"bool", "bool", "xsd:boolean"}, {"int", "int", "xsd:decimal"}, {"float", "float", "xsd:double"}, {"string", "string", "xsd:string"}, {"null", "null", NULL}, {"hash", "array", NULL}, {"object", "object", NULL}, {"resource", "resource", NULL} }; /***************************************************************************** ** Prototypes for debug command handlers */ /* DBGP_FUNC(break); */ DBGP_FUNC(breakpoint_get); DBGP_FUNC(breakpoint_list); DBGP_FUNC(breakpoint_remove); DBGP_FUNC(breakpoint_set); DBGP_FUNC(breakpoint_update); DBGP_FUNC(context_get); DBGP_FUNC(context_names); DBGP_FUNC(eval); DBGP_FUNC(feature_get); DBGP_FUNC(feature_set); DBGP_FUNC(typemap_get); DBGP_FUNC(property_get); DBGP_FUNC(property_set); DBGP_FUNC(property_value); DBGP_FUNC(source); DBGP_FUNC(stack_depth); DBGP_FUNC(stack_get); DBGP_FUNC(status); DBGP_FUNC(stderr); DBGP_FUNC(stdout); DBGP_FUNC(stop); DBGP_FUNC(run); DBGP_FUNC(step_into); DBGP_FUNC(step_out); DBGP_FUNC(step_over); DBGP_FUNC(detach); /* Non standard comments */ DBGP_FUNC(xcmd_profiler_name_get); DBGP_FUNC(xcmd_get_executable_lines); /***************************************************************************** ** Dispatcher tables for supported debug commands */ static xdebug_dbgp_cmd dbgp_commands[] = { /* DBGP_FUNC_ENTRY(break) */ DBGP_FUNC_ENTRY(breakpoint_get, XDEBUG_DBGP_NONE) DBGP_FUNC_ENTRY(breakpoint_list, XDEBUG_DBGP_POST_MORTEM) DBGP_FUNC_ENTRY(breakpoint_remove, XDEBUG_DBGP_NONE) DBGP_FUNC_ENTRY(breakpoint_set, XDEBUG_DBGP_NONE) DBGP_FUNC_ENTRY(breakpoint_update, XDEBUG_DBGP_NONE) DBGP_FUNC_ENTRY(context_get, XDEBUG_DBGP_NONE) DBGP_FUNC_ENTRY(context_names, XDEBUG_DBGP_POST_MORTEM) DBGP_FUNC_ENTRY(eval, XDEBUG_DBGP_NONE) DBGP_FUNC_ENTRY(feature_get, XDEBUG_DBGP_POST_MORTEM) DBGP_FUNC_ENTRY(feature_set, XDEBUG_DBGP_NONE) DBGP_FUNC_ENTRY(typemap_get, XDEBUG_DBGP_POST_MORTEM) DBGP_FUNC_ENTRY(property_get, XDEBUG_DBGP_NONE) DBGP_FUNC_ENTRY(property_set, XDEBUG_DBGP_NONE) DBGP_FUNC_ENTRY(property_value, XDEBUG_DBGP_NONE) DBGP_FUNC_ENTRY(source, XDEBUG_DBGP_NONE) DBGP_FUNC_ENTRY(stack_depth, XDEBUG_DBGP_NONE) DBGP_FUNC_ENTRY(stack_get, XDEBUG_DBGP_NONE) DBGP_FUNC_ENTRY(status, XDEBUG_DBGP_POST_MORTEM) DBGP_FUNC_ENTRY(stderr, XDEBUG_DBGP_NONE) DBGP_FUNC_ENTRY(stdout, XDEBUG_DBGP_NONE) DBGP_CONT_FUNC_ENTRY(run, XDEBUG_DBGP_NONE) DBGP_CONT_FUNC_ENTRY(step_into, XDEBUG_DBGP_NONE) DBGP_CONT_FUNC_ENTRY(step_out, XDEBUG_DBGP_NONE) DBGP_CONT_FUNC_ENTRY(step_over, XDEBUG_DBGP_NONE) DBGP_STOP_FUNC_ENTRY(stop, XDEBUG_DBGP_POST_MORTEM) DBGP_STOP_FUNC_ENTRY(detach, XDEBUG_DBGP_NONE) /* Non standard functions */ DBGP_FUNC_ENTRY(xcmd_profiler_name_get, XDEBUG_DBGP_POST_MORTEM) DBGP_FUNC_ENTRY(xcmd_get_executable_lines, XDEBUG_DBGP_NONE) { NULL, NULL } }; /***************************************************************************** ** Utility functions */ static xdebug_dbgp_cmd* lookup_cmd(char *cmd) { xdebug_dbgp_cmd *ptr = dbgp_commands; while (ptr->name) { if (strcmp(ptr->name, cmd) == 0) { return ptr; } ptr++; } return NULL; } static xdebug_str *make_message(xdebug_con *context, xdebug_xml_node *message TSRMLS_DC) { xdebug_str xml_message = {0, 0, NULL}; xdebug_str *ret; xdebug_str_ptr_init(ret); xdebug_xml_return_node(message, &xml_message); if (XG(remote_log_file)) { fprintf(XG(remote_log_file), "-> %s\n\n", xml_message.d); fflush(XG(remote_log_file)); } xdebug_str_add(ret, xdebug_sprintf("%d", xml_message.l + sizeof("\n") - 1), 1); xdebug_str_addl(ret, "\0", 1, 0); xdebug_str_add(ret, "\n", 0); xdebug_str_add(ret, xml_message.d, 0); xdebug_str_addl(ret, "\0", 1, 0); xdebug_str_dtor(xml_message); return ret; } static void send_message(xdebug_con *context, xdebug_xml_node *message TSRMLS_DC) { xdebug_str *tmp; tmp = make_message(context, message TSRMLS_CC); SSENDL(context->socket, tmp->d, tmp->l); xdebug_str_ptr_dtor(tmp); } /***************************************************************************** ** Data returning functions */ #define XF_ST_ROOT 0 #define XF_ST_ARRAY_INDEX_NUM 1 #define XF_ST_ARRAY_INDEX_ASSOC 2 #define XF_ST_OBJ_PROPERTY 3 #define XF_ST_STATIC_ROOT 4 #define XF_ST_STATIC_PROPERTY 5 inline static HashTable *fetch_ht_from_zval(zval *z TSRMLS_DC) { switch (Z_TYPE_P(z)) { case IS_ARRAY: return Z_ARRVAL_P(z); break; case IS_OBJECT: return Z_OBJPROP_P(z); break; } return NULL; } inline static char *fetch_classname_from_zval(zval *z, int *length, zend_class_entry **ce TSRMLS_DC) { char *name; zend_uint name_len; zend_class_entry *tmp_ce; if (Z_TYPE_P(z) != IS_OBJECT) { return NULL; } tmp_ce = zend_get_class_entry(z TSRMLS_CC); if (Z_OBJ_HT_P(z)->get_class_name == NULL || Z_OBJ_HT_P(z)->get_class_name(z, (const char **) &name, &name_len, 0 TSRMLS_CC) != SUCCESS) { if (!tmp_ce) { return NULL; } *length = tmp_ce->name_length; *ce = tmp_ce; return estrdup(tmp_ce->name); } else { *ce = tmp_ce; } *length = name_len; return name; } static char* prepare_search_key(char *name, int *name_length, char *prefix, int prefix_length) { char *element; int extra_length = 0; if (prefix_length) { if (prefix[0] == '*') { extra_length = 3; } else { extra_length = 2 + prefix_length; } } element = malloc(*name_length + 1 + extra_length); memset(element, 0, *name_length + 1 + extra_length); if (extra_length) { memcpy(element + 1, prefix, extra_length - 2); } memcpy(element + extra_length, name, *name_length); *name_length += extra_length; return element; } static zval* fetch_zval_from_symbol_table(HashTable *ht, char* name, int name_length, int type, char* ccn, int ccnl, zend_class_entry *cce TSRMLS_DC) { zval **retval_pp = NULL, *retval_p = NULL; char *element = NULL; int element_length = name_length; #if PHP_VERSION_ID >= 50400 zend_property_info *zpp; #endif switch (type) { case XF_ST_STATIC_ROOT: case XF_ST_STATIC_PROPERTY: #if PHP_VERSION_ID < 50400 ht = CE_STATIC_MEMBERS(cce); goto continue_from_static_root; #else /* First we try a public,private,protected property */ element = prepare_search_key(name, &element_length, "", 0); if (cce && &cce->properties_info && zend_hash_find(&cce->properties_info, element, element_length + 1, (void **) &zpp) == SUCCESS) { retval_p = cce->static_members_table[zpp->offset]; goto cleanup; } element_length = name_length; /* Then we try to see whether the first char is * and use the part between * and * as class name for the private property */ if (name[0] == '*') { char *secondStar; secondStar = strstr(name + 1, "*"); if (secondStar) { free(element); element_length = name_length - (secondStar + 1 - name); element = prepare_search_key(secondStar + 1, &element_length, "", 0); if (cce && &cce->properties_info && zend_hash_find(&cce->properties_info, element, element_length + 1, (void **) &zpp) == SUCCESS) { retval_p = cce->static_members_table[zpp->offset]; goto cleanup; } } } break; #endif case XF_ST_ROOT: #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) || PHP_MAJOR_VERSION >= 6 /* Check for compiled vars */ element = prepare_search_key(name, &element_length, "", 0); if (XG(active_execute_data) && XG(active_op_array)) { int i = 0; ulong hash_value = zend_inline_hash_func(element, element_length + 1); zend_op_array *opa = XG(active_op_array); zval **CV; while (i < opa->last_var) { if (opa->vars[i].hash_value == hash_value && opa->vars[i].name_len == element_length && strcmp(opa->vars[i].name, element) == 0) { #if PHP_VERSION_ID >= 50500 CV = (*EX_CV_NUM(XG(active_execute_data), i)); #else CV = XG(active_execute_data)->CVs[i]; #endif if (CV) { retval_p = *CV; goto cleanup; } } i++; } } free(element); ht = XG(active_symbol_table); #else ht = XG(active_symbol_table); /* break intentionally missing */ #endif case XF_ST_ARRAY_INDEX_ASSOC: element = prepare_search_key(name, &name_length, "", 0); /* Handle "this" in a different way */ if (type == XF_ST_ROOT && strcmp("this", element) == 0) { if (XG(This)) { retval_p = XG(This); } else { retval_p = NULL; } goto cleanup; } if (ht && zend_hash_find(ht, element, name_length + 1, (void **) &retval_pp) == SUCCESS) { retval_p = *retval_pp; goto cleanup; } break; case XF_ST_ARRAY_INDEX_NUM: element = prepare_search_key(name, &name_length, "", 0); if (ht && zend_hash_index_find(ht, strtoul(element, NULL, 10), (void **) &retval_pp) == SUCCESS) { retval_p = *retval_pp; goto cleanup; } break; case XF_ST_OBJ_PROPERTY: #if PHP_VERSION_ID <= 50400 continue_from_static_root: #endif /* First we try a public property */ element = prepare_search_key(name, &element_length, "", 0); if (ht && zend_hash_find(ht, element, element_length + 1, (void **) &retval_pp) == SUCCESS) { retval_p = *retval_pp; goto cleanup; } element_length = name_length; /* Then we try it again as protected property */ free(element); element = prepare_search_key(name, &element_length, "*", 1); if (ht && zend_hash_find(ht, element, element_length + 1, (void **) &retval_pp) == SUCCESS) { retval_p = *retval_pp; goto cleanup; } element_length = name_length; /* Then we try it again as private property */ free(element); element = prepare_search_key(name, &element_length, ccn, ccnl); if (ht && zend_hash_find(ht, element, element_length + 1, (void **) &retval_pp) == SUCCESS) { retval_p = *retval_pp; goto cleanup; } element_length = name_length; /* Then we try to see whether the first char is * and use the part between * and * as class name for the private property */ if (name[0] == '*') { char *secondStar; secondStar = strstr(name + 1, "*"); if (secondStar) { free(element); element_length = name_length - (secondStar + 1 - name); element = prepare_search_key(secondStar + 1, &element_length, name + 1, secondStar - name - 1); if (ht && zend_hash_find(ht, element, element_length + 1, (void **) &retval_pp) == SUCCESS) { retval_p = *retval_pp; goto cleanup; } } } break; } cleanup: if (element) { free(element); } return retval_p; } static zval* get_symbol_contents_zval(char* name, int name_length TSRMLS_DC) { HashTable *st = NULL; int found = -1; int state = 0; char **p = &name; char *keyword = NULL, *keyword_end = NULL; int type = XF_ST_ROOT; zval *retval = NULL; char *current_classname = NULL; zend_class_entry *current_ce = NULL; int cc_length = 0; char quotechar = 0; do { if (*p[0] == '\0') { found = 0; } else { switch (state) { case 0: if (*p[0] == '$') { keyword = *p + 1; break; } if (*p[0] == ':') { /* special tricks */ keyword = *p; state = 7; break; } keyword = *p; state = 1; /* break intentionally missing */ case 1: if (*p[0] == '[') { keyword_end = *p; if (keyword) { retval = fetch_zval_from_symbol_table(st, keyword, keyword_end - keyword, type, current_classname, cc_length, current_ce TSRMLS_CC); if (current_classname) { efree(current_classname); } current_classname = NULL; current_ce = NULL; if (retval) { st = fetch_ht_from_zval(retval TSRMLS_CC); } keyword = NULL; } state = 3; } else if (*p[0] == '-') { keyword_end = *p; if (keyword) { retval = fetch_zval_from_symbol_table(st, keyword, keyword_end - keyword, type, current_classname, cc_length, current_ce TSRMLS_CC); if (current_classname) { efree(current_classname); } current_classname = NULL; current_ce = NULL; if (retval) { current_classname = fetch_classname_from_zval(retval, &cc_length, ¤t_ce TSRMLS_CC); st = fetch_ht_from_zval(retval TSRMLS_CC); } keyword = NULL; } state = 2; type = XF_ST_OBJ_PROPERTY; } else if (*p[0] == ':') { keyword_end = *p; if (keyword) { retval = fetch_zval_from_symbol_table(st, keyword, keyword_end - keyword, type, current_classname, cc_length, current_ce TSRMLS_CC); if (current_classname) { efree(current_classname); } current_classname = NULL; if (retval) { current_classname = fetch_classname_from_zval(retval, &cc_length, ¤t_ce TSRMLS_CC); st = NULL; } keyword = NULL; } state = 8; type = XF_ST_STATIC_PROPERTY; } break; case 2: if (*p[0] != '>') { keyword = *p; state = 1; } break; case 8: if (*p[0] != ':') { keyword = *p; state = 1; } break; case 3: /* Associative arrays */ if (*p[0] == '\'' || *p[0] == '"') { state = 4; keyword = *p + 1; quotechar = *p[0]; type = XF_ST_ARRAY_INDEX_ASSOC; } /* Numerical index */ if (*p[0] >= '0' && *p[0] <= '9') { state = 6; keyword = *p; type = XF_ST_ARRAY_INDEX_NUM; } break; case 4: if (*p[0] == quotechar) { quotechar = 0; state = 5; keyword_end = *p; retval = fetch_zval_from_symbol_table(st, keyword, keyword_end - keyword, type, current_classname, cc_length, current_ce TSRMLS_CC); if (current_classname) { efree(current_classname); } current_classname = NULL; if (retval) { current_classname = fetch_classname_from_zval(retval, &cc_length, ¤t_ce TSRMLS_CC); st = fetch_ht_from_zval(retval TSRMLS_CC); } keyword = NULL; } break; case 5: if (*p[0] == ']') { state = 1; } break; case 6: if (*p[0] == ']') { state = 1; keyword_end = *p; retval = fetch_zval_from_symbol_table(st, keyword, keyword_end - keyword, type, current_classname, cc_length, current_ce TSRMLS_CC); if (current_classname) { efree(current_classname); } current_classname = NULL; if (retval) { current_classname = fetch_classname_from_zval(retval, &cc_length, ¤t_ce TSRMLS_CC); st = fetch_ht_from_zval(retval TSRMLS_CC); } keyword = NULL; } break; case 7: /* special cases, started with a ":" */ if (*p[0] == ':') { state = 1; keyword_end = *p; if (strncmp(keyword, "::", 2) == 0) { /* static class properties */ zend_class_entry *ce = zend_fetch_class(XG(active_fse)->function.class, strlen(XG(active_fse)->function.class), ZEND_FETCH_CLASS_SELF TSRMLS_CC); st = NULL; current_classname = estrdup(ce->name); cc_length = strlen(ce->name); current_ce = ce; keyword = *p + 1; type = XF_ST_STATIC_ROOT; } else { keyword = NULL; } } break; } (*p)++; } } while (found < 0); if (keyword != NULL) { retval = fetch_zval_from_symbol_table(st, keyword, *p - keyword, type, current_classname, cc_length, current_ce TSRMLS_CC); } if (current_classname) { efree(current_classname); } return retval; } static xdebug_xml_node* get_symbol(char* name, int name_length, xdebug_var_export_options *options TSRMLS_DC) { zval *retval; retval = get_symbol_contents_zval(name, name_length TSRMLS_CC); if (retval) { return xdebug_get_zval_value_xml_node(name, retval, options TSRMLS_CC); } return NULL; } static int get_symbol_contents(char* name, int name_length, xdebug_xml_node *node, xdebug_var_export_options *options TSRMLS_DC) { zval *retval; retval = get_symbol_contents_zval(name, name_length TSRMLS_CC); if (retval) { xdebug_var_export_xml_node(&retval, name, node, options, 1 TSRMLS_CC); return 1; } return 0; } static char* return_file_source(char *filename, int begin, int end TSRMLS_DC) { php_stream *stream; int i = begin; char *line = NULL; xdebug_str source = { 0, 0, NULL }; if (i < 0) { begin = 0; i = 0; } filename = xdebug_path_from_url(filename TSRMLS_CC); stream = php_stream_open_wrapper(filename, "rb", USE_PATH | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); xdfree(filename); /* Read until the "begin" line has been read */ if (!stream) { return NULL; } /* skip to the first requested line */ while (i > 0 && !php_stream_eof(stream)) { if (line) { efree(line); line = NULL; } line = php_stream_gets(stream, NULL, 1024); i--; } /* Read until the "end" line has been read */ do { if (line) { xdebug_str_add(&source, line, 0); efree(line); line = NULL; if (php_stream_eof(stream)) break; } line = php_stream_gets(stream, NULL, 1024); i++; } while (i < end + 1 - begin); /* Print last line */ if (line) { efree(line); line = NULL; } php_stream_close(stream); return source.d; } static char* return_eval_source(char *id, int begin, int end TSRMLS_DC) { char *key, *joined; xdebug_eval_info *ei; xdebug_arg *parts = (xdebug_arg*) xdmalloc(sizeof(xdebug_arg)); if (begin < 0) { begin = 0; } key = create_eval_key_id(atoi(id)); if (xdebug_hash_find(XG(context).eval_id_lookup, key, strlen(key), (void *) &ei)) { xdebug_arg_init(parts); xdebug_explode("\n", ei->contents, parts, end + 2); joined = xdebug_join("\n", parts, begin, end); xdebug_arg_dtor(parts); return joined; } return NULL; } static char* return_source(char *filename, int begin, int end TSRMLS_DC) { if (strncmp(filename, "dbgp://", 7) == 0) { return return_eval_source(filename + 7, begin, end TSRMLS_CC); } else { return return_file_source(filename, begin, end TSRMLS_CC); } } static int check_evaled_code(function_stack_entry *fse, char **filename, int *lineno, int use_fse TSRMLS_DC) { char *end_marker; xdebug_eval_info *ei; char *filename_to_use; filename_to_use = use_fse ? fse->filename : *filename; end_marker = filename_to_use + strlen(filename_to_use) - strlen("eval()'d code"); if (end_marker >= filename_to_use && strcmp("eval()'d code", end_marker) == 0) { if (xdebug_hash_find(XG(context).eval_id_lookup, filename_to_use, strlen(filename_to_use), (void *) &ei)) { *filename = xdebug_sprintf("dbgp://%lu", ei->id); } return 1; } return 0; } static xdebug_xml_node* return_stackframe(int nr TSRMLS_DC) { function_stack_entry *fse, *fse_prev; char *tmp_fname; char *tmp_filename; int tmp_lineno; xdebug_xml_node *tmp; fse = xdebug_get_stack_frame(nr TSRMLS_CC); fse_prev = xdebug_get_stack_frame(nr - 1 TSRMLS_CC); tmp_fname = xdebug_show_fname(fse->function, 0, 0 TSRMLS_CC); tmp = xdebug_xml_node_init("stack"); xdebug_xml_add_attribute_ex(tmp, "where", xdstrdup(tmp_fname), 0, 1); xdebug_xml_add_attribute_ex(tmp, "level", xdebug_sprintf("%ld", nr), 0, 1); if (fse_prev) { if (check_evaled_code(fse_prev, &tmp_filename, &tmp_lineno, 1 TSRMLS_CC)) { xdebug_xml_add_attribute_ex(tmp, "type", xdstrdup("eval"), 0, 1); xdebug_xml_add_attribute_ex(tmp, "filename", tmp_filename, 0, 0); } else { xdebug_xml_add_attribute_ex(tmp, "type", xdstrdup("file"), 0, 1); xdebug_xml_add_attribute_ex(tmp, "filename", xdebug_path_to_url(fse_prev->filename TSRMLS_CC), 0, 1); } xdebug_xml_add_attribute_ex(tmp, "lineno", xdebug_sprintf("%lu", fse_prev->lineno TSRMLS_CC), 0, 1); } else { tmp_filename = (char *) zend_get_executed_filename(TSRMLS_C); tmp_lineno = zend_get_executed_lineno(TSRMLS_C); if (check_evaled_code(fse, &tmp_filename, &tmp_lineno, 0 TSRMLS_CC)) { xdebug_xml_add_attribute_ex(tmp, "type", xdstrdup("eval"), 0, 1); xdebug_xml_add_attribute_ex(tmp, "filename", tmp_filename, 0, 0); } else { xdebug_xml_add_attribute_ex(tmp, "type", xdstrdup("file"), 0, 1); xdebug_xml_add_attribute_ex(tmp, "filename", xdebug_path_to_url(tmp_filename TSRMLS_CC), 0, 1); } xdebug_xml_add_attribute_ex(tmp, "lineno", xdebug_sprintf("%lu", tmp_lineno), 0, 1); } xdfree(tmp_fname); return tmp; } /***************************************************************************** ** Client command handlers - Breakpoints */ /* Helper functions */ void xdebug_hash_admin_dtor(xdebug_brk_admin *admin) { xdfree(admin->key); xdfree(admin); } static int breakpoint_admin_add(xdebug_con *context, int type, char *key) { xdebug_brk_admin *admin = xdmalloc(sizeof(xdebug_brk_admin)); char *hkey; TSRMLS_FETCH(); XG(breakpoint_count)++; admin->id = getpid() * 10000 + XG(breakpoint_count); admin->type = type; admin->key = xdstrdup(key); hkey = xdebug_sprintf("%lu", admin->id); xdebug_hash_add(context->breakpoint_list, hkey, strlen(hkey), (void*) admin); xdfree(hkey); return admin->id; } static int breakpoint_admin_fetch(xdebug_con *context, char *hkey, int *type, char **key) { xdebug_brk_admin *admin; if (xdebug_hash_find(context->breakpoint_list, hkey, strlen(hkey), (void *) &admin)) { *type = admin->type; *key = admin->key; return SUCCESS; } else { return FAILURE; } } static int breakpoint_admin_remove(xdebug_con *context, char *hkey) { if (xdebug_hash_delete(context->breakpoint_list, hkey, strlen(hkey))) { return SUCCESS; } else { return FAILURE; } } static void breakpoint_brk_info_add(xdebug_xml_node *xml, xdebug_brk_info *brk) { TSRMLS_FETCH(); if (brk->type) { xdebug_xml_add_attribute_ex(xml, "type", xdstrdup(brk->type), 0, 1); } if (brk->file) { xdebug_xml_add_attribute_ex(xml, "filename", xdebug_path_to_url(brk->file TSRMLS_CC), 0, 1); } if (brk->lineno) { xdebug_xml_add_attribute_ex(xml, "lineno", xdebug_sprintf("%lu", brk->lineno), 0, 1); } if (brk->functionname) { xdebug_xml_add_attribute_ex(xml, "function", xdstrdup(brk->functionname), 0, 1); } if (brk->classname) { xdebug_xml_add_attribute_ex(xml, "class", xdstrdup(brk->classname), 0, 1); } if (brk->temporary) { xdebug_xml_add_attribute(xml, "state", "temporary"); } else if (brk->disabled) { xdebug_xml_add_attribute(xml, "state", "disabled"); } else { xdebug_xml_add_attribute(xml, "state", "enabled"); } xdebug_xml_add_attribute_ex(xml, "hit_count", xdebug_sprintf("%lu", brk->hit_count), 0, 1); switch (brk->hit_condition) { case XDEBUG_HIT_GREATER_EQUAL: xdebug_xml_add_attribute(xml, "hit_condition", ">="); break; case XDEBUG_HIT_EQUAL: xdebug_xml_add_attribute(xml, "hit_condition", "=="); break; case XDEBUG_HIT_MOD: xdebug_xml_add_attribute(xml, "hit_condition", "%"); break; } if (brk->condition) { xdebug_xml_node *condition = xdebug_xml_node_init("expression"); xdebug_xml_add_text_ex(condition, brk->condition, strlen(brk->condition), 0, 1); xdebug_xml_add_child(xml, condition); } xdebug_xml_add_attribute_ex(xml, "hit_value", xdebug_sprintf("%lu", brk->hit_value), 0, 1); } static xdebug_brk_info* breakpoint_brk_info_fetch(int type, char *hkey) { xdebug_llist_element *le; xdebug_brk_info *brk = NULL; xdebug_arg *parts = (xdebug_arg*) xdmalloc(sizeof(xdebug_arg)); TSRMLS_FETCH(); switch (type) { case BREAKPOINT_TYPE_LINE: /* First we split the key into filename and linenumber */ xdebug_arg_init(parts); xdebug_explode("$", hkey, parts, -1); /* Second we loop through the list of file/line breakpoints to * look for our thingy */ for (le = XDEBUG_LLIST_HEAD(XG(context).line_breakpoints); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { brk = XDEBUG_LLIST_VALP(le); if (atoi(parts->args[1]) == brk->lineno && memcmp(brk->file, parts->args[0], brk->file_len) == 0) { xdebug_arg_dtor(parts); return brk; } } /* Cleaning up */ xdebug_arg_dtor(parts); break; case BREAKPOINT_TYPE_FUNCTION: if (xdebug_hash_find(XG(context).function_breakpoints, hkey, strlen(hkey), (void *) &brk)) { return brk; } break; case BREAKPOINT_TYPE_EXCEPTION: if (xdebug_hash_find(XG(context).exception_breakpoints, hkey, strlen(hkey), (void *) &brk)) { return brk; } break; } return brk; } static int breakpoint_remove(int type, char *hkey) { xdebug_llist_element *le; xdebug_brk_info *brk = NULL; xdebug_arg *parts = (xdebug_arg*) xdmalloc(sizeof(xdebug_arg)); int retval = FAILURE; TSRMLS_FETCH(); switch (type) { case BREAKPOINT_TYPE_LINE: /* First we split the key into filename and linenumber */ xdebug_arg_init(parts); xdebug_explode("$", hkey, parts, -1); /* Second we loop through the list of file/line breakpoints to * look for our thingy */ for (le = XDEBUG_LLIST_HEAD(XG(context).line_breakpoints); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { brk = XDEBUG_LLIST_VALP(le); if (atoi(parts->args[1]) == brk->lineno && memcmp(brk->file, parts->args[0], brk->file_len) == 0) { xdebug_llist_remove(XG(context).line_breakpoints, le, NULL); retval = SUCCESS; break; } } /* Cleaning up */ xdebug_arg_dtor(parts); break; case BREAKPOINT_TYPE_FUNCTION: if (xdebug_hash_delete(XG(context).function_breakpoints, hkey, strlen(hkey))) { retval = SUCCESS; } break; case BREAKPOINT_TYPE_EXCEPTION: if (xdebug_hash_delete(XG(context).exception_breakpoints, hkey, strlen(hkey))) { retval = SUCCESS; } break; } return retval; } #define BREAKPOINT_ACTION_GET 1 #define BREAKPOINT_ACTION_REMOVE 2 #define BREAKPOINT_ACTION_UPDATE 3 #define BREAKPOINT_CHANGE_STATE() \ XDEBUG_STR_SWITCH(CMD_OPTION('s')) { \ XDEBUG_STR_CASE("enabled") \ brk_info->disabled = 0; \ XDEBUG_STR_CASE_END \ \ XDEBUG_STR_CASE("disabled") \ brk_info->disabled = 1; \ XDEBUG_STR_CASE_END \ \ XDEBUG_STR_CASE_DEFAULT \ RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); \ XDEBUG_STR_CASE_DEFAULT_END \ } #define BREAKPOINT_CHANGE_OPERATOR() \ XDEBUG_STR_SWITCH(CMD_OPTION('o')) { \ XDEBUG_STR_CASE(">=") \ brk_info->hit_condition = XDEBUG_HIT_GREATER_EQUAL; \ XDEBUG_STR_CASE_END \ \ XDEBUG_STR_CASE("==") \ brk_info->hit_condition = XDEBUG_HIT_EQUAL; \ XDEBUG_STR_CASE_END \ \ XDEBUG_STR_CASE("%") \ brk_info->hit_condition = XDEBUG_HIT_MOD; \ XDEBUG_STR_CASE_END \ \ XDEBUG_STR_CASE_DEFAULT \ RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); \ XDEBUG_STR_CASE_DEFAULT_END \ } static void breakpoint_do_action(DBGP_FUNC_PARAMETERS, int action) { int type; char *hkey; xdebug_brk_info *brk_info; xdebug_xml_node *breakpoint_node; XDEBUG_STR_SWITCH_DECL; if (!CMD_OPTION('d')) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); } /* Lets check if it exists */ if (breakpoint_admin_fetch(context, CMD_OPTION('d'), &type, (char**) &hkey) == SUCCESS) { /* so it exists, now we're going to find it in the correct hash/list * and return the info we have on it */ brk_info = breakpoint_brk_info_fetch(type, hkey); if (action == BREAKPOINT_ACTION_UPDATE) { if (CMD_OPTION('s')) { BREAKPOINT_CHANGE_STATE(); } if (CMD_OPTION('n')) { brk_info->lineno = strtol(CMD_OPTION('n'), NULL, 10); } if (CMD_OPTION('h')) { brk_info->hit_value = strtol(CMD_OPTION('h'), NULL, 10); } if (CMD_OPTION('o')) { BREAKPOINT_CHANGE_OPERATOR(); } } breakpoint_node = xdebug_xml_node_init("breakpoint"); breakpoint_brk_info_add(breakpoint_node, brk_info); xdebug_xml_add_attribute_ex(breakpoint_node, "id", xdstrdup(CMD_OPTION('d')), 0, 1); xdebug_xml_add_child(*retval, breakpoint_node); if (action == BREAKPOINT_ACTION_REMOVE) { /* Now we remove the crap */ breakpoint_remove(type, hkey); breakpoint_admin_remove(context, CMD_OPTION('d')); } } else { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_NO_SUCH_BREAKPOINT) } } DBGP_FUNC(breakpoint_get) { breakpoint_do_action(DBGP_FUNC_PASS_PARAMETERS, BREAKPOINT_ACTION_GET); } DBGP_FUNC(breakpoint_remove) { breakpoint_do_action(DBGP_FUNC_PASS_PARAMETERS, BREAKPOINT_ACTION_REMOVE); } DBGP_FUNC(breakpoint_update) { breakpoint_do_action(DBGP_FUNC_PASS_PARAMETERS, BREAKPOINT_ACTION_UPDATE); } static void breakpoint_list_helper(void *xml, xdebug_hash_element *he) { xdebug_xml_node *xml_node = (xdebug_xml_node*) xml; xdebug_xml_node *child; xdebug_brk_admin *admin = (xdebug_brk_admin*) he->ptr; xdebug_brk_info *brk; child = xdebug_xml_node_init("breakpoint"); brk = breakpoint_brk_info_fetch(admin->type, admin->key); breakpoint_brk_info_add(child, brk); xdebug_xml_add_attribute_ex(child, "id", xdebug_sprintf("%lu", admin->id), 0, 1); xdebug_xml_add_child(xml_node, child); } DBGP_FUNC(breakpoint_list) { xdebug_hash_apply(context->breakpoint_list, (void *) *retval, breakpoint_list_helper); } DBGP_FUNC(breakpoint_set) { xdebug_brk_info *brk_info; char *tmp_name; int brk_id = 0; int new_length = 0; function_stack_entry *fse; XDEBUG_STR_SWITCH_DECL; brk_info = xdmalloc(sizeof(xdebug_brk_info)); brk_info->type = NULL; brk_info->file = NULL; brk_info->file_len = 0; brk_info->lineno = 0; brk_info->classname = NULL; brk_info->functionname = NULL; brk_info->function_break_type = 0; brk_info->exceptionname = NULL; brk_info->condition = NULL; brk_info->disabled = 0; brk_info->temporary = 0; brk_info->hit_count = 0; brk_info->hit_value = 0; brk_info->hit_condition = XDEBUG_HIT_DISABLED; if (!CMD_OPTION('t')) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); } else { brk_info->type = xdstrdup(CMD_OPTION('t')); } if (CMD_OPTION('s')) { BREAKPOINT_CHANGE_STATE(); xdebug_xml_add_attribute_ex(*retval, "state", xdstrdup(CMD_OPTION('s')), 0, 1); } if (CMD_OPTION('o') && CMD_OPTION('h')) { BREAKPOINT_CHANGE_OPERATOR(); brk_info->hit_value = strtol(CMD_OPTION('h'), NULL, 10); } if (CMD_OPTION('r')) { brk_info->temporary = strtol(CMD_OPTION('r'), NULL, 10); } if ((strcmp(CMD_OPTION('t'), "line") == 0) || (strcmp(CMD_OPTION('t'), "conditional") == 0)) { if (!CMD_OPTION('n')) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); } brk_info->lineno = strtol(CMD_OPTION('n'), NULL, 10); /* If no filename is given, we use the current one */ if (!CMD_OPTION('f')) { fse = xdebug_get_stack_tail(TSRMLS_C); if (!fse) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID); } else { brk_info->file = xdebug_path_from_url(fse->filename TSRMLS_CC); brk_info->file_len = strlen(brk_info->file); } } else { char realpath_file[MAXPATHLEN]; brk_info->file = xdebug_path_from_url(CMD_OPTION('f') TSRMLS_CC); /* Now we do some real path checks to resolve symlinks. */ if (VCWD_REALPATH(brk_info->file, realpath_file)) { xdfree(brk_info->file); brk_info->file = xdstrdup(realpath_file); } brk_info->file_len = strlen(brk_info->file); } /* Perhaps we have a break condition */ if (CMD_OPTION('-')) { brk_info->condition = (char*) xdebug_base64_decode((unsigned char*) CMD_OPTION('-'), strlen(CMD_OPTION('-')), &new_length); } tmp_name = xdebug_sprintf("%s$%lu", brk_info->file, brk_info->lineno); brk_id = breakpoint_admin_add(context, BREAKPOINT_TYPE_LINE, tmp_name); xdfree(tmp_name); xdebug_llist_insert_next(context->line_breakpoints, XDEBUG_LLIST_TAIL(context->line_breakpoints), (void*) brk_info); } else if ((strcmp(CMD_OPTION('t'), "call") == 0) || (strcmp(CMD_OPTION('t'), "return") == 0)) { if (strcmp(CMD_OPTION('t'), "call") == 0) { brk_info->function_break_type = XDEBUG_BRK_FUNC_CALL; } else { brk_info->function_break_type = XDEBUG_BRK_FUNC_RETURN; } if (!CMD_OPTION('m')) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); } brk_info->functionname = xdstrdup(CMD_OPTION('m')); if (CMD_OPTION('a')) { int res; brk_info->classname = xdstrdup(CMD_OPTION('a')); tmp_name = xdebug_sprintf("%s::%s", CMD_OPTION('a'), CMD_OPTION('m')); res = xdebug_hash_add(context->function_breakpoints, tmp_name, strlen(tmp_name), (void*) brk_info); brk_id = breakpoint_admin_add(context, BREAKPOINT_TYPE_FUNCTION, tmp_name); xdfree(tmp_name); if (!res) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); } } else { if (!xdebug_hash_add(context->function_breakpoints, CMD_OPTION('m'), strlen(CMD_OPTION('m')), (void*) brk_info)) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_BREAKPOINT_NOT_SET); } else { brk_id = breakpoint_admin_add(context, BREAKPOINT_TYPE_FUNCTION, CMD_OPTION('m')); } } } else if (strcmp(CMD_OPTION('t'), "exception") == 0) { if (!CMD_OPTION('x')) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); } brk_info->exceptionname = xdstrdup(CMD_OPTION('x')); if (!xdebug_hash_add(context->exception_breakpoints, CMD_OPTION('x'), strlen(CMD_OPTION('x')), (void*) brk_info)) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_BREAKPOINT_NOT_SET); } else { brk_id = breakpoint_admin_add(context, BREAKPOINT_TYPE_EXCEPTION, CMD_OPTION('x')); } } else if (strcmp(CMD_OPTION('t'), "watch") == 0) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_BREAKPOINT_TYPE_NOT_SUPPORTED); } xdebug_xml_add_attribute_ex(*retval, "id", xdebug_sprintf("%d", brk_id), 0, 1); } static int xdebug_do_eval(char *eval_string, zval *ret_zval TSRMLS_DC) { int old_error_reporting; int res = FAILURE; zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr); zend_op **original_opline_ptr = EG(opline_ptr); zend_op_array *original_active_op_array = EG(active_op_array); zend_execute_data *original_execute_data = EG(current_execute_data); int original_no_extensions = EG(no_extensions); #if PHP_VERSION_ID < 50200 zend_bool original_bailout_set = EG(bailout_set); jmp_buf original_bailout; #else jmp_buf *original_bailout = EG(bailout); #endif #if PHP_VERSION_ID >= 50300 void **original_argument_stack_top = EG(argument_stack)->top; void **original_argument_stack_end = EG(argument_stack)->end; #endif #if PHP_VERSION_ID < 50200 memcpy(&original_bailout, &EG(bailout), sizeof(jmp_buf)); #endif /* Remember error reporting level */ old_error_reporting = EG(error_reporting); EG(error_reporting) = 0; /* Do evaluation */ XG(breakpoints_allowed) = 0; zend_first_try { res = zend_eval_string(eval_string, ret_zval, "xdebug://debug-eval" TSRMLS_CC); } zend_end_try(); /* Clean up */ EG(error_reporting) = old_error_reporting; XG(breakpoints_allowed) = 1; EG(return_value_ptr_ptr) = original_return_value_ptr_ptr; EG(opline_ptr) = original_opline_ptr; EG(active_op_array) = original_active_op_array; EG(current_execute_data) = original_execute_data; EG(no_extensions) = original_no_extensions; #if PHP_VERSION_ID < 50200 EG(bailout_set) = original_bailout_set; memcpy(&EG(bailout), &original_bailout, sizeof(jmp_buf)); #else EG(bailout) = original_bailout; #endif #if PHP_VERSION_ID >= 50300 EG(argument_stack)->top = original_argument_stack_top; EG(argument_stack)->end = original_argument_stack_end; #endif return res; } DBGP_FUNC(eval) { char *eval_string; xdebug_xml_node *ret_xml; zval ret_zval; int new_length; int res; xdebug_var_export_options *options; if (!CMD_OPTION('-')) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); } options = (xdebug_var_export_options*) context->options; if (CMD_OPTION('p')) { options->runtime[0].page = strtol(CMD_OPTION('p'), NULL, 10); } else { options->runtime[0].page = 0; } /* base64 decode eval string */ eval_string = (char*) xdebug_base64_decode((unsigned char*) CMD_OPTION('-'), strlen(CMD_OPTION('-')), &new_length); res = xdebug_do_eval(eval_string, &ret_zval TSRMLS_CC); efree(eval_string); /* Handle result */ if (res == FAILURE) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_EVALUATING_CODE); } else { ret_xml = xdebug_get_zval_value_xml_node(NULL, &ret_zval, options TSRMLS_CC); xdebug_xml_add_child(*retval, ret_xml); zval_dtor(&ret_zval); } } /* these functions interupt PHP's output functions, so we can redirect to our remote debugger! */ static int xdebug_send_stream(const char *name, const char *str, uint str_length TSRMLS_DC) { /* create an xml document to send as the stream */ xdebug_xml_node *message; message = xdebug_xml_node_init("stream"); xdebug_xml_add_attribute(message, "xmlns", "urn:debugger_protocol_v1"); xdebug_xml_add_attribute(message, "xmlns:xdebug", "http://xdebug.org/dbgp/xdebug"); xdebug_xml_add_attribute_ex(message, "type", (char *)name, 0, 0); xdebug_xml_add_text_encodel(message, xdstrndup(str, str_length), str_length); send_message(&XG(context), message TSRMLS_CC); xdebug_xml_node_dtor(message); return 0; } DBGP_FUNC(stderr) { xdebug_xml_add_attribute(*retval, "success", "0"); } DBGP_FUNC(stdout) { int mode = 0; char *success = "0"; if (!CMD_OPTION('c')) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); } mode = strtol(CMD_OPTION('c'), NULL, 10); XG(stdout_mode) = mode; success = "1"; xdebug_xml_add_attribute_ex(*retval, "success", xdstrdup(success), 0, 1); } DBGP_FUNC(stop) { XG(status) = DBGP_STATUS_STOPPED; xdebug_xml_add_attribute(*retval, "status", xdebug_dbgp_status_strings[XG(status)]); xdebug_xml_add_attribute(*retval, "reason", xdebug_dbgp_reason_strings[XG(reason)]); } DBGP_FUNC(run) { xdebug_xml_add_attribute_ex(*retval, "filename", xdstrdup(context->program_name), 0, 1); } DBGP_FUNC(step_into) { XG(context).do_next = 0; XG(context).do_step = 1; XG(context).do_finish = 0; } DBGP_FUNC(step_out) { function_stack_entry *fse; XG(context).do_next = 0; XG(context).do_step = 0; XG(context).do_finish = 1; if ((fse = xdebug_get_stack_tail(TSRMLS_C))) { XG(context).next_level = fse->level - 1; } else { XG(context).next_level = -1; } } DBGP_FUNC(step_over) { function_stack_entry *fse; XG(context).do_next = 1; XG(context).do_step = 0; XG(context).do_finish = 0; if ((fse = xdebug_get_stack_tail(TSRMLS_C))) { XG(context).next_level = fse->level; } else { XG(context).next_level = 0; } } DBGP_FUNC(detach) { XG(status) = DBGP_STATUS_DETACHED; xdebug_xml_add_attribute(*retval, "status", xdebug_dbgp_status_strings[DBGP_STATUS_STOPPED]); xdebug_xml_add_attribute(*retval, "reason", xdebug_dbgp_reason_strings[XG(reason)]); XG(context).handler->remote_deinit(&(XG(context))); XG(remote_enabled) = 0; XG(stdout_mode) = 0; } DBGP_FUNC(source) { char *source; int begin = 0, end = 999999; char *filename; function_stack_entry *fse; if (!CMD_OPTION('f')) { if ((fse = xdebug_get_stack_tail(TSRMLS_C))) { filename = fse->filename; } else { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID); } } else { filename = CMD_OPTION('f'); } if (CMD_OPTION('b')) { begin = strtol(CMD_OPTION('b'), NULL, 10); } if (CMD_OPTION('e')) { end = strtol(CMD_OPTION('e'), NULL, 10); } /* return_source allocates memory for source */ XG(breakpoints_allowed) = 0; source = return_source(filename, begin, end TSRMLS_CC); XG(breakpoints_allowed) = 1; if (!source) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_CANT_OPEN_FILE); } else { xdebug_xml_add_text_encode(*retval, source); } } DBGP_FUNC(feature_get) { xdebug_var_export_options *options; XDEBUG_STR_SWITCH_DECL; options = (xdebug_var_export_options*) context->options; if (!CMD_OPTION('n')) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); } xdebug_xml_add_attribute_ex(*retval, "feature_name", xdstrdup(CMD_OPTION('n')), 0, 1); XDEBUG_STR_SWITCH(CMD_OPTION('n')) { XDEBUG_STR_CASE("breakpoint_languages") xdebug_xml_add_attribute(*retval, "supported", "0"); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("breakpoint_types") xdebug_xml_add_text(*retval, xdstrdup("line conditional call return exception")); xdebug_xml_add_attribute(*retval, "supported", "1"); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("data_encoding") xdebug_xml_add_attribute(*retval, "supported", "0"); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("encoding") xdebug_xml_add_text(*retval, xdstrdup("iso-8859-1")); xdebug_xml_add_attribute(*retval, "supported", "1"); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("language_name") xdebug_xml_add_text(*retval, xdstrdup("PHP")); xdebug_xml_add_attribute(*retval, "supported", "1"); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("language_supports_threads") xdebug_xml_add_text(*retval, xdstrdup("0")); xdebug_xml_add_attribute(*retval, "supported", "1"); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("language_version") xdebug_xml_add_text(*retval, xdstrdup(PHP_VERSION)); xdebug_xml_add_attribute(*retval, "supported", "1"); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("max_children") xdebug_xml_add_text(*retval, xdebug_sprintf("%ld", options->max_children)); xdebug_xml_add_attribute(*retval, "supported", "1"); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("max_data") xdebug_xml_add_text(*retval, xdebug_sprintf("%ld", options->max_data)); xdebug_xml_add_attribute(*retval, "supported", "1"); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("max_depth") xdebug_xml_add_text(*retval, xdebug_sprintf("%ld", options->max_depth)); xdebug_xml_add_attribute(*retval, "supported", "1"); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("protocol_version") xdebug_xml_add_text(*retval, xdstrdup(DBGP_VERSION)); xdebug_xml_add_attribute(*retval, "supported", "1"); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("supported_encodings") xdebug_xml_add_text(*retval, xdstrdup("iso-8859-1")); xdebug_xml_add_attribute(*retval, "supported", "1"); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("supports_async") xdebug_xml_add_text(*retval, xdstrdup("0")); xdebug_xml_add_attribute(*retval, "supported", "1"); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("supports_postmortem") xdebug_xml_add_text(*retval, xdstrdup("1")); xdebug_xml_add_attribute(*retval, "supported", "1"); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("show_hidden") xdebug_xml_add_text(*retval, xdebug_sprintf("%ld", options->show_hidden)); xdebug_xml_add_attribute(*retval, "supported", "1"); XDEBUG_STR_CASE_END XDEBUG_STR_CASE_DEFAULT xdebug_xml_add_text(*retval, xdstrdup(lookup_cmd(CMD_OPTION('n')) ? "1" : "0")); xdebug_xml_add_attribute(*retval, "supported", lookup_cmd(CMD_OPTION('n')) ? "1" : "0"); XDEBUG_STR_CASE_DEFAULT_END } } DBGP_FUNC(feature_set) { xdebug_var_export_options *options; XDEBUG_STR_SWITCH_DECL; options = (xdebug_var_export_options*) context->options; if (!CMD_OPTION('n') || !CMD_OPTION('v')) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); } XDEBUG_STR_SWITCH(CMD_OPTION('n')) { XDEBUG_STR_CASE("encoding") if (strcmp(CMD_OPTION('v'), "iso-8859-1") != 0) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_ENCODING_NOT_SUPPORTED); } XDEBUG_STR_CASE_END XDEBUG_STR_CASE("max_children") options->max_children = strtol(CMD_OPTION('v'), NULL, 10); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("max_data") options->max_data = strtol(CMD_OPTION('v'), NULL, 10); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("max_depth") int i; options->max_depth = strtol(CMD_OPTION('v'), NULL, 10); /* Reallocating page structure */ xdfree(options->runtime); options->runtime = (xdebug_var_runtime_page*) xdmalloc(options->max_depth * sizeof(xdebug_var_runtime_page)); for (i = 0; i < options->max_depth; i++) { options->runtime[i].page = 0; options->runtime[i].current_element_nr = 0; } XDEBUG_STR_CASE_END XDEBUG_STR_CASE("show_hidden") options->show_hidden = strtol(CMD_OPTION('v'), NULL, 10); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("multiple_sessions") /* FIXME: Add new boolean option check / struct field for this */ XDEBUG_STR_CASE_END XDEBUG_STR_CASE_DEFAULT RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); XDEBUG_STR_CASE_DEFAULT_END } xdebug_xml_add_attribute_ex(*retval, "feature", xdstrdup(CMD_OPTION('n')), 0, 1); xdebug_xml_add_attribute_ex(*retval, "success", "1", 0, 0); } DBGP_FUNC(typemap_get) { int i; xdebug_xml_node *type; xdebug_xml_add_attribute(*retval, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); xdebug_xml_add_attribute(*retval, "xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); /* Add our basic types */ for (i = 0; i < XDEBUG_TYPES_COUNT; i++) { type = xdebug_xml_node_init("map"); xdebug_xml_add_attribute(type, "name", xdebug_dbgp_typemap[i][1]); xdebug_xml_add_attribute(type, "type", xdebug_dbgp_typemap[i][0]); if (xdebug_dbgp_typemap[i][2]) { xdebug_xml_add_attribute(type, "xsi:type", xdebug_dbgp_typemap[i][2]); } xdebug_xml_add_child(*retval, type); } } static int add_variable_node(xdebug_xml_node *node, char *name, int name_length, int var_only, int non_null, int no_eval, xdebug_var_export_options *options TSRMLS_DC) { xdebug_xml_node *contents; contents = get_symbol(name, name_length, options TSRMLS_CC); if (contents) { xdebug_xml_add_child(node, contents); return SUCCESS; } return FAILURE; } DBGP_FUNC(property_get) { int depth = 0; int context_nr = 0; function_stack_entry *fse; int old_max_data; xdebug_var_export_options *options = (xdebug_var_export_options*) context->options; if (!CMD_OPTION('n')) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); } if (CMD_OPTION('d')) { depth = strtol(CMD_OPTION('d'), NULL, 10); } if (CMD_OPTION('c')) { context_nr = strtol(CMD_OPTION('c'), NULL, 10); } /* Set the symbol table corresponding with the requested stack depth */ if (context_nr == 0) { /* locals */ if ((fse = xdebug_get_stack_frame(depth TSRMLS_CC))) { #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) || PHP_MAJOR_VERSION >= 6 function_stack_entry *old_fse = xdebug_get_stack_frame(depth - 1 TSRMLS_CC); if (depth > 0) { XG(active_execute_data) = old_fse->execute_data; } else { XG(active_execute_data) = EG(current_execute_data); } #else XG(active_execute_data) = fse->execute_data; #endif XG(active_symbol_table) = fse->symbol_table; XG(active_op_array) = fse->op_array; XG(This) = fse->This; XG(active_fse) = fse; } else { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID); } } else { /* superglobals */ XG(active_symbol_table) = &EG(symbol_table); } if (CMD_OPTION('p')) { options->runtime[0].page = strtol(CMD_OPTION('p'), NULL, 10); } else { options->runtime[0].page = 0; } /* Override max data size if necessary */ old_max_data = options->max_data; if (CMD_OPTION('m')) { options->max_data= strtol(CMD_OPTION('m'), NULL, 10); } if (add_variable_node(*retval, CMD_OPTION('n'), strlen(CMD_OPTION('n')) + 1, 1, 0, 0, options TSRMLS_CC) == FAILURE) { options->max_data = old_max_data; RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_PROPERTY_NON_EXISTANT); } XG(active_op_array) = NULL; } DBGP_FUNC(property_set) { char *data = CMD_OPTION('-'); char *new_value; int new_length; int depth = 0; int context_nr = 0; int res; char *eval_string; zval ret_zval; function_stack_entry *fse; xdebug_var_export_options *options = (xdebug_var_export_options*) context->options; zval *symbol; XDEBUG_STR_SWITCH_DECL; if (!CMD_OPTION('n')) { /* name */ RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); } if (!data) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); } if (CMD_OPTION('d')) { /* depth */ depth = strtol(CMD_OPTION('d'), NULL, 10); } if (CMD_OPTION('c')) { /* context_id */ context_nr = strtol(CMD_OPTION('c'), NULL, 10); } /* Set the symbol table corresponding with the requested stack depth */ if (context_nr == 0) { /* locals */ if ((fse = xdebug_get_stack_frame(depth TSRMLS_CC))) { #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) || PHP_MAJOR_VERSION >= 6 function_stack_entry *old_fse = xdebug_get_stack_frame(depth - 1 TSRMLS_CC); if (depth > 0) { XG(active_execute_data) = old_fse->execute_data; } else { XG(active_execute_data) = EG(current_execute_data); } #else XG(active_execute_data) = fse->execute_data; #endif XG(active_symbol_table) = fse->symbol_table; XG(active_op_array) = fse->op_array; XG(This) = fse->This; XG(active_fse) = fse; } else { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID); } } else { /* superglobals */ XG(active_symbol_table) = &EG(symbol_table); } if (CMD_OPTION('p')) { options->runtime[0].page = strtol(CMD_OPTION('p'), NULL, 10); } else { options->runtime[0].page = 0; } new_value = (char*) xdebug_base64_decode((unsigned char*) data, strlen(data), &new_length); if (CMD_OPTION('t')) { symbol = get_symbol_contents_zval(CMD_OPTION('n'), strlen(CMD_OPTION('n')) + 1 TSRMLS_CC); /* Handle result */ if (!symbol) { efree(new_value); RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_PROPERTY_NON_EXISTANT); } else { zval_dtor(symbol); Z_TYPE_P(symbol) = IS_STRING; Z_STRVAL_P(symbol) = new_value; Z_STRLEN_P(symbol) = new_length; xdebug_xml_add_attribute(*retval, "success", "1"); XDEBUG_STR_SWITCH(CMD_OPTION('t')) { XDEBUG_STR_CASE("bool") convert_to_boolean(symbol); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("int") convert_to_long(symbol); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("float") convert_to_double(symbol); XDEBUG_STR_CASE_END XDEBUG_STR_CASE("string") /* do nothing */ XDEBUG_STR_CASE_END XDEBUG_STR_CASE_DEFAULT xdebug_xml_add_attribute(*retval, "success", "0"); XDEBUG_STR_CASE_DEFAULT_END } } } else { /* Do the eval */ eval_string = xdebug_sprintf("%s = %s", CMD_OPTION('n'), new_value); res = xdebug_do_eval(eval_string, &ret_zval TSRMLS_CC); /* Free data */ xdfree(eval_string); efree(new_value); /* Handle result */ if (res == FAILURE) { /* don't send an error, send success = zero */ xdebug_xml_add_attribute(*retval, "success", "0"); } else { zval_dtor(&ret_zval); xdebug_xml_add_attribute(*retval, "success", "1"); } } } static int add_variable_contents_node(xdebug_xml_node *node, char *name, int name_length, int var_only, int non_null, int no_eval, xdebug_var_export_options *options TSRMLS_DC) { int contents_found; contents_found = get_symbol_contents(name, name_length, node, options TSRMLS_CC); if (contents_found) { return SUCCESS; } return FAILURE; } DBGP_FUNC(property_value) { int depth = 0; function_stack_entry *fse; int old_max_data; xdebug_var_export_options *options = (xdebug_var_export_options*) context->options; if (!CMD_OPTION('n')) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); } if (CMD_OPTION('d')) { depth = strtol(CMD_OPTION('d'), NULL, 10); } /* Set the symbol table corresponding with the requested stack depth */ if ((fse = xdebug_get_stack_frame(depth TSRMLS_CC))) { #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) || PHP_MAJOR_VERSION >= 6 function_stack_entry *old_fse = xdebug_get_stack_frame(depth - 1 TSRMLS_CC); if (depth > 0) { XG(active_execute_data) = old_fse->execute_data; } else { XG(active_execute_data) = EG(current_execute_data); } #else XG(active_execute_data) = fse->execute_data; #endif XG(active_symbol_table) = fse->symbol_table; XG(active_op_array) = fse->op_array; XG(This) = fse->This; XG(active_fse) = fse; } else { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID); } if (CMD_OPTION('p')) { options->runtime[0].page = strtol(CMD_OPTION('p'), NULL, 10); } else { options->runtime[0].page = 0; } /* Override max data size if necessary */ old_max_data = options->max_data; if (CMD_OPTION('m')) { options->max_data = strtol(CMD_OPTION('m'), NULL, 10); } if (add_variable_contents_node(*retval, CMD_OPTION('n'), strlen(CMD_OPTION('n')) + 1, 1, 0, 0, options TSRMLS_CC) == FAILURE) { options->max_data = old_max_data; RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_PROPERTY_NON_EXISTANT); } } static void attach_used_var_with_contents(void *xml, xdebug_hash_element* he, void *options) { char *name = (char*) he->ptr; xdebug_xml_node *node = (xdebug_xml_node *) xml; xdebug_xml_node *contents; TSRMLS_FETCH(); contents = get_symbol(name, strlen(name), options TSRMLS_CC); if (contents) { xdebug_xml_add_child(node, contents); } else { xdebug_attach_uninitialized_var(node, name); } } static int xdebug_add_filtered_symboltable_var(zval *symbol XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { xdebug_hash *tmp_hash; tmp_hash = va_arg(args, xdebug_hash *); if (strcmp("argc", hash_key->arKey) == 0) { return 0; } if (strcmp("argv", hash_key->arKey) == 0) { return 0; } if (hash_key->arKey[0] == '_') { if (strcmp("_COOKIE", hash_key->arKey) == 0) { return 0; } if (strcmp("_ENV", hash_key->arKey) == 0) { return 0; } if (strcmp("_FILES", hash_key->arKey) == 0) { return 0; } if (strcmp("_GET", hash_key->arKey) == 0) { return 0; } if (strcmp("_POST", hash_key->arKey) == 0) { return 0; } if (strcmp("_REQUEST", hash_key->arKey) == 0) { return 0; } if (strcmp("_SERVER", hash_key->arKey) == 0) { return 0; } if (strcmp("_SESSION", hash_key->arKey) == 0) { return 0; } } if (hash_key->arKey[0] == 'H') { if (strcmp("HTTP_COOKIE_VARS", hash_key->arKey) == 0) { return 0; } if (strcmp("HTTP_ENV_VARS", hash_key->arKey) == 0) { return 0; } if (strcmp("HTTP_GET_VARS", hash_key->arKey) == 0) { return 0; } if (strcmp("HTTP_POST_VARS", hash_key->arKey) == 0) { return 0; } if (strcmp("HTTP_POST_FILES", hash_key->arKey) == 0) { return 0; } if (strcmp("HTTP_RAW_POST_DATA", hash_key->arKey) == 0) { return 0; } if (strcmp("HTTP_SERVER_VARS", hash_key->arKey) == 0) { return 0; } if (strcmp("HTTP_SESSION_VARS", hash_key->arKey) == 0) { return 0; } } if (strcmp("GLOBALS", hash_key->arKey) == 0) { return 0; } xdebug_hash_add(tmp_hash, hash_key->arKey, strlen(hash_key->arKey), hash_key->arKey); return 0; } static int attach_context_vars(xdebug_xml_node *node, xdebug_var_export_options *options, long context_id, long depth, void (*func)(void *, xdebug_hash_element*, void*) TSRMLS_DC) { function_stack_entry *fse; char *var_name; /* right now, we only have zero or one, one being globals, which is * always the head of the stack */ if (context_id == 1) { /* add super globals */ XG(active_symbol_table) = &EG(symbol_table); XG(active_execute_data) = NULL; add_variable_node(node, "_COOKIE", sizeof("_COOKIE"), 1, 1, 0, options TSRMLS_CC); add_variable_node(node, "_ENV", sizeof("_ENV"), 1, 1, 0, options TSRMLS_CC); add_variable_node(node, "_FILES", sizeof("_FILES"), 1, 1, 0, options TSRMLS_CC); add_variable_node(node, "_GET", sizeof("_GET"), 1, 1, 0, options TSRMLS_CC); add_variable_node(node, "_POST", sizeof("_POST"), 1, 1, 0, options TSRMLS_CC); add_variable_node(node, "_REQUEST", sizeof("_REQUEST"), 1, 1, 0, options TSRMLS_CC); add_variable_node(node, "_SERVER", sizeof("_SERVER"), 1, 1, 0, options TSRMLS_CC); add_variable_node(node, "_SESSION", sizeof("_SESSION"), 1, 1, 0, options TSRMLS_CC); add_variable_node(node, "GLOBALS", sizeof("GLOBALS"), 1, 1, 0, options TSRMLS_CC); XG(active_symbol_table) = NULL; return 0; } /* Here the context_id is 0 */ if ((fse = xdebug_get_stack_frame(depth TSRMLS_CC))) { #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) || PHP_MAJOR_VERSION >= 6 function_stack_entry *old_fse = xdebug_get_stack_frame(depth - 1 TSRMLS_CC); if (depth > 0) { XG(active_execute_data) = old_fse->execute_data; } else { XG(active_execute_data) = EG(current_execute_data); } #else XG(active_execute_data) = fse->execute_data; #endif XG(active_symbol_table) = fse->symbol_table; XG(active_op_array) = fse->op_array; XG(This) = fse->This; /* Only show vars when they are scanned */ if (fse->used_vars) { xdebug_hash *tmp_hash; /* Get a hash from all the used vars (which can have duplicates) */ tmp_hash = xdebug_used_var_hash_from_llist(fse->used_vars); /* Check for dynamically defined variables, but make sure we don't already * have them. Also blacklist superglobals and argv/argc */ if (XG(active_symbol_table)) { zend_hash_apply_with_arguments(XG(active_symbol_table) XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_add_filtered_symboltable_var, 1, tmp_hash); } /* Add all the found variables to the node */ xdebug_hash_apply_with_argument(tmp_hash, (void *) node, func, (void *) options); /* Zend engine 2 does not give us $this, eval so we can get it */ if (!xdebug_hash_find(tmp_hash, "this", 4, (void *) &var_name)) { add_variable_node(node, "this", sizeof("this"), 1, 1, 0, options TSRMLS_CC); } xdebug_hash_destroy(tmp_hash); } /* Check for static variables and constants, but only if it's a static * method call as we attach constants and static properties to "this" * too normally. */ if (fse->function.type == XFUNC_STATIC_MEMBER) { zend_class_entry *ce = zend_fetch_class(fse->function.class, strlen(fse->function.class), ZEND_FETCH_CLASS_SELF TSRMLS_CC); xdebug_attach_static_vars(node, options, ce TSRMLS_CC); } XG(active_symbol_table) = NULL; XG(active_execute_data) = NULL; XG(active_op_array) = NULL; XG(This) = NULL; return 0; } return 1; } DBGP_FUNC(stack_depth) { xdebug_xml_add_attribute_ex(*retval, "depth", xdebug_sprintf("%lu", XG(level)), 0, 1); } DBGP_FUNC(stack_get) { xdebug_xml_node *stackframe; xdebug_llist_element *le; int counter = 0, depth; if (CMD_OPTION('d')) { depth = strtol(CMD_OPTION('d'), NULL, 10); if (depth >= 0 && depth < XG(level)) { stackframe = return_stackframe(depth TSRMLS_CC); xdebug_xml_add_child(*retval, stackframe); } else { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID); } } else { counter = 0; for (le = XDEBUG_LLIST_TAIL(XG(stack)); le != NULL; le = XDEBUG_LLIST_PREV(le)) { stackframe = return_stackframe(counter TSRMLS_CC); xdebug_xml_add_child(*retval, stackframe); counter++; } } } DBGP_FUNC(status) { xdebug_xml_add_attribute(*retval, "status", xdebug_dbgp_status_strings[XG(status)]); xdebug_xml_add_attribute(*retval, "reason", xdebug_dbgp_reason_strings[XG(reason)]); } DBGP_FUNC(context_names) { xdebug_xml_node *child; child = xdebug_xml_node_init("context"); xdebug_xml_add_attribute(child, "name", "Locals"); xdebug_xml_add_attribute(child, "id", "0"); xdebug_xml_add_child(*retval, child); child = xdebug_xml_node_init("context"); xdebug_xml_add_attribute(child, "name", "Superglobals"); xdebug_xml_add_attribute(child, "id", "1"); xdebug_xml_add_child(*retval, child); } DBGP_FUNC(context_get) { int res; int context_id = 0; int depth = 0; xdebug_var_export_options *options = (xdebug_var_export_options*) context->options; if (CMD_OPTION('c')) { context_id = atol(CMD_OPTION('c')); } if (CMD_OPTION('d')) { depth = atol(CMD_OPTION('d')); } /* Always reset to page = 0, as it might have been modified by property_get or property_value */ options->runtime[0].page = 0; res = attach_context_vars(*retval, options, context_id, depth, attach_used_var_with_contents TSRMLS_CC); switch (res) { case 1: RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID); break; } xdebug_xml_add_attribute_ex(*retval, "context", xdebug_sprintf("%d", context_id), 0, 1); } DBGP_FUNC(xcmd_profiler_name_get) { if (XG(profiler_enabled) && XG(profile_filename)) { xdebug_xml_add_text(*retval, xdstrdup(XG(profile_filename))); } else { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_PROFILING_NOT_STARTED); } } DBGP_FUNC(xcmd_get_executable_lines) { function_stack_entry *fse; int i, depth; xdebug_xml_node *lines, *line; if (!CMD_OPTION('d')) { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS); } depth = strtol(CMD_OPTION('d'), NULL, 10); if (depth >= 0 && depth < XG(level)) { fse = xdebug_get_stack_frame(depth TSRMLS_CC); } else { RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID); } lines = xdebug_xml_node_init("xdebug:lines"); for (i = 0; i < fse->op_array->last; i++ ) { if (fse->op_array->opcodes[i].opcode == ZEND_EXT_STMT ) { line = xdebug_xml_node_init("xdebug:line"); xdebug_xml_add_attribute_ex(line, "lineno", xdebug_sprintf("%lu", fse->op_array->opcodes[i].lineno), 0, 1); xdebug_xml_add_child(lines, line); } } xdebug_xml_add_child(*retval, lines); } /***************************************************************************** ** Parsing functions */ /* {{{ Constants for state machine */ #define STATE_NORMAL 0 #define STATE_QUOTED 1 #define STATE_OPT_FOLLOWS 2 #define STATE_SEP_FOLLOWS 3 #define STATE_VALUE_FOLLOWS_FIRST_CHAR 4 #define STATE_VALUE_FOLLOWS 5 #define STATE_SKIP_CHAR 6 /* }}} */ static void xdebug_dbgp_arg_dtor(xdebug_dbgp_arg *arg) { int i; for (i = 0; i < 27; i++) { if (arg->value[i]) { xdfree(arg->value[i]); } } xdfree(arg); } static int xdebug_dbgp_parse_cmd(char *line, char **cmd, xdebug_dbgp_arg **ret_args) { xdebug_dbgp_arg *args = NULL; char *ptr; int state; int charescaped = 0; char opt = ' ', *value_begin = NULL; args = xdmalloc(sizeof (xdebug_dbgp_arg)); memset(args->value, 0, sizeof(args->value)); *cmd = NULL; /* Find the end of the command, this is always on the first space */ ptr = strchr(line, ' '); if (!ptr) { /* No space found. If the line is not empty, return the line * and assume it only consists of the command name. If the line * is 0 chars long, we return a failure. */ if (strlen(line)) { *cmd = strdup(line); *ret_args = args; return XDEBUG_ERROR_OK; } else { goto parse_error; } } else { /* A space was found, so we copy everything before it * into the cmd parameter. */ *cmd = xdcalloc(1, ptr - line + 1); memcpy(*cmd, line, ptr - line); } /* Now we loop until we find the end of the string, which is the \0 * character */ state = STATE_NORMAL; do { ptr++; switch (state) { case STATE_NORMAL: if (*ptr != '-') { goto parse_error; } else { state = STATE_OPT_FOLLOWS; } break; case STATE_OPT_FOLLOWS: opt = *ptr; state = STATE_SEP_FOLLOWS; break; case STATE_SEP_FOLLOWS: if (*ptr != ' ') { goto parse_error; } else { state = STATE_VALUE_FOLLOWS_FIRST_CHAR; value_begin = ptr + 1; } break; case STATE_VALUE_FOLLOWS_FIRST_CHAR: if (*ptr == '"' && opt != '-') { value_begin = ptr + 1; state = STATE_QUOTED; } else { state = STATE_VALUE_FOLLOWS; } break; case STATE_VALUE_FOLLOWS: if ((*ptr == ' ' && opt != '-') || *ptr == '\0') { int index = opt - 'a'; if (opt == '-') { index = 26; } if (!args->value[index]) { args->value[index] = xdcalloc(1, ptr - value_begin + 1); memcpy(args->value[index], value_begin, ptr - value_begin); state = STATE_NORMAL; } else { goto duplicate_opts; } } break; case STATE_QUOTED: /* if the quote is escaped, remain in STATE_QUOTED. This will also handle other escaped chars, or an instance of an escaped slash followed by a quote: \\" */ if (*ptr == '\\') { charescaped = !charescaped; } else if (*ptr == '"') { int index = opt - 'a'; if (charescaped) { charescaped = 0; break; } if (opt == '-') { index = 26; } if (!args->value[index]) { int len = ptr - value_begin; args->value[index] = xdcalloc(1, len + 1); memcpy(args->value[index], value_begin, len); php_stripcslashes(args->value[index], &len); state = STATE_SKIP_CHAR; } else { goto duplicate_opts; } } break; case STATE_SKIP_CHAR: state = STATE_NORMAL; break; } } while (*ptr); *ret_args = args; return XDEBUG_ERROR_OK; parse_error: *ret_args = args; return XDEBUG_ERROR_PARSE; duplicate_opts: *ret_args = args; return XDEBUG_ERROR_DUP_ARG; } static int xdebug_dbgp_parse_option(xdebug_con *context, char* line, int flags, xdebug_xml_node *retval TSRMLS_DC) { char *cmd = NULL; int res, ret = 0; xdebug_dbgp_arg *args; xdebug_dbgp_cmd *command; xdebug_xml_node *error; if (XG(remote_log_file)) { fprintf(XG(remote_log_file), "<- %s\n", line); fflush(XG(remote_log_file)); } res = xdebug_dbgp_parse_cmd(line, (char**) &cmd, (xdebug_dbgp_arg**) &args); /* Add command name to return packet */ if (cmd) { /* if no cmd res will be XDEBUG_ERROR_PARSE */ xdebug_xml_add_attribute_ex(retval, "command", xdstrdup(cmd), 0, 1); } /* Handle missing transaction ID, and if it exist add it to the result */ if (!CMD_OPTION('i')) { /* we need the transaction_id even for errors in parse_cmd, but if we error out here, just force the error to happen below */ res = XDEBUG_ERROR_INVALID_ARGS; } else { xdebug_xml_add_attribute_ex(retval, "transaction_id", xdstrdup(CMD_OPTION('i')), 0, 1); } /* Handle parse errors */ /* FIXME: use RETURN_RESULT here too */ if (res != XDEBUG_ERROR_OK) { error = xdebug_xml_node_init("error"); xdebug_xml_add_attribute_ex(error, "code", xdebug_sprintf("%lu", res), 0, 1); xdebug_xml_add_child(retval, error); ADD_REASON_MESSAGE(res); } else { /* Execute commands and stuff */ command = lookup_cmd(cmd); if (command) { if (command->cont) { XG(status) = DBGP_STATUS_RUNNING; XG(reason) = DBGP_REASON_OK; } XG(lastcmd) = command->name; if (XG(lasttransid)) { xdfree(XG(lasttransid)); } XG(lasttransid) = xdstrdup(CMD_OPTION('i')); if (XG(status) != DBGP_STATUS_STOPPING || (XG(status) == DBGP_STATUS_STOPPING && command->flags & XDEBUG_DBGP_POST_MORTEM)) { command->handler((xdebug_xml_node**) &retval, context, args TSRMLS_CC); ret = command->cont; } else { error = xdebug_xml_node_init("error"); xdebug_xml_add_attribute_ex(error, "code", xdebug_sprintf("%lu", XDEBUG_ERROR_COMMAND_UNAVAILABLE), 0, 1); ADD_REASON_MESSAGE(XDEBUG_ERROR_COMMAND_UNAVAILABLE); xdebug_xml_add_child(retval, error); ret = -1; } } else { error = xdebug_xml_node_init("error"); xdebug_xml_add_attribute_ex(error, "code", xdebug_sprintf("%lu", XDEBUG_ERROR_UNIMPLEMENTED), 0, 1); ADD_REASON_MESSAGE(XDEBUG_ERROR_UNIMPLEMENTED); xdebug_xml_add_child(retval, error); ret = -1; } } xdfree(cmd); xdebug_dbgp_arg_dtor(args); return ret; } /***************************************************************************** ** Handlers for debug functions */ char *xdebug_dbgp_get_revision(void) { return "$Revision: 1.145 $"; } static int xdebug_dbgp_cmdloop(xdebug_con *context, int bail TSRMLS_DC) { char *option; int ret; xdebug_xml_node *response; do { option = xdebug_fd_read_line_delim(context->socket, context->buffer, FD_RL_SOCKET, '\0', NULL); if (!option) { return 0; } response = xdebug_xml_node_init("response"); xdebug_xml_add_attribute(response, "xmlns", "urn:debugger_protocol_v1"); xdebug_xml_add_attribute(response, "xmlns:xdebug", "http://xdebug.org/dbgp/xdebug"); ret = xdebug_dbgp_parse_option(context, option, 0, response TSRMLS_CC); if (ret != 1) { send_message(context, response TSRMLS_CC); } xdebug_xml_node_dtor(response); free(option); } while (0 == ret); if (bail && XG(status) == DBGP_STATUS_STOPPED) { zend_bailout(); } return ret; } int xdebug_dbgp_init(xdebug_con *context, int mode) { xdebug_var_export_options *options; xdebug_xml_node *response, *child; int i; TSRMLS_FETCH(); /* initialize our status information */ if (mode == XDEBUG_REQ) { XG(status) = DBGP_STATUS_STARTING; XG(reason) = DBGP_REASON_OK; } else if (mode == XDEBUG_JIT) { XG(status) = DBGP_STATUS_BREAK; XG(reason) = DBGP_REASON_ERROR; } XG(lastcmd) = NULL; XG(lasttransid) = NULL; response = xdebug_xml_node_init("init"); xdebug_xml_add_attribute(response, "xmlns", "urn:debugger_protocol_v1"); xdebug_xml_add_attribute(response, "xmlns:xdebug", "http://xdebug.org/dbgp/xdebug"); /* {{{ XML Init Stuff*/ child = xdebug_xml_node_init("engine"); xdebug_xml_add_attribute(child, "version", XDEBUG_VERSION); xdebug_xml_add_text(child, xdstrdup(XDEBUG_NAME)); xdebug_xml_add_child(response, child); child = xdebug_xml_node_init("author"); xdebug_xml_add_text(child, xdstrdup(XDEBUG_AUTHOR)); xdebug_xml_add_child(response, child); child = xdebug_xml_node_init("url"); xdebug_xml_add_text(child, xdstrdup(XDEBUG_URL)); xdebug_xml_add_child(response, child); child = xdebug_xml_node_init("copyright"); xdebug_xml_add_text(child, xdstrdup(XDEBUG_COPYRIGHT)); xdebug_xml_add_child(response, child); if (strcmp(context->program_name, "-") == 0) { xdebug_xml_add_attribute_ex(response, "fileuri", xdstrdup("dbgp://stdin"), 0, 1); } else { xdebug_xml_add_attribute_ex(response, "fileuri", xdebug_path_to_url(context->program_name TSRMLS_CC), 0, 1); } xdebug_xml_add_attribute_ex(response, "language", "PHP", 0, 0); xdebug_xml_add_attribute_ex(response, "protocol_version", DBGP_VERSION, 0, 0); xdebug_xml_add_attribute_ex(response, "appid", xdebug_sprintf("%d", getpid()), 0, 1); if (getenv("DBGP_COOKIE")) { xdebug_xml_add_attribute_ex(response, "session", xdstrdup(getenv("DBGP_COOKIE")), 0, 1); } if (XG(ide_key) && *XG(ide_key)) { xdebug_xml_add_attribute_ex(response, "idekey", xdstrdup(XG(ide_key)), 0, 1); } context->buffer = xdmalloc(sizeof(fd_buf)); context->buffer->buffer = NULL; context->buffer->buffer_size = 0; send_message(context, response TSRMLS_CC); xdebug_xml_node_dtor(response); /* }}} */ context->options = xdmalloc(sizeof(xdebug_var_export_options)); options = (xdebug_var_export_options*) context->options; options->max_children = 32; options->max_data = 1024; options->max_depth = 1; options->show_hidden = 0; options->runtime = (xdebug_var_runtime_page*) xdmalloc((options->max_depth + 1) * sizeof(xdebug_var_runtime_page)); for (i = 0; i < options->max_depth; i++) { options->runtime[i].page = 0; options->runtime[i].current_element_nr = 0; } context->breakpoint_list = xdebug_hash_alloc(64, (xdebug_hash_dtor) xdebug_hash_admin_dtor); context->function_breakpoints = xdebug_hash_alloc(64, (xdebug_hash_dtor) xdebug_hash_brk_dtor); context->exception_breakpoints = xdebug_hash_alloc(64, (xdebug_hash_dtor) xdebug_hash_brk_dtor); context->line_breakpoints = xdebug_llist_alloc((xdebug_llist_dtor) xdebug_llist_brk_dtor); context->eval_id_lookup = xdebug_hash_alloc(64, (xdebug_hash_dtor) xdebug_hash_eval_info_dtor); context->eval_id_sequence = 0; xdebug_dbgp_cmdloop(context, 1 TSRMLS_CC); return 1; } int xdebug_dbgp_deinit(xdebug_con *context) { xdebug_xml_node *response; xdebug_var_export_options *options; TSRMLS_FETCH(); if (XG(remote_enabled)) { XG(status) = DBGP_STATUS_STOPPING; XG(reason) = DBGP_REASON_OK; response = xdebug_xml_node_init("response"); xdebug_xml_add_attribute(response, "xmlns", "urn:debugger_protocol_v1"); xdebug_xml_add_attribute(response, "xmlns:xdebug", "http://xdebug.org/dbgp/xdebug"); /* lastcmd and lasttransid are not always set (for example when the * connection is severed before the first command is send) */ if (XG(lastcmd) && XG(lasttransid)) { xdebug_xml_add_attribute_ex(response, "command", XG(lastcmd), 0, 0); xdebug_xml_add_attribute_ex(response, "transaction_id", XG(lasttransid), 0, 0); } xdebug_xml_add_attribute_ex(response, "status", xdebug_dbgp_status_strings[XG(status)], 0, 0); xdebug_xml_add_attribute_ex(response, "reason", xdebug_dbgp_reason_strings[XG(reason)], 0, 0); send_message(context, response TSRMLS_CC); xdebug_xml_node_dtor(response); xdebug_dbgp_cmdloop(context, 0 TSRMLS_CC); } if (XG(remote_enabled)) { options = (xdebug_var_export_options*) context->options; xdfree(options->runtime); xdfree(context->options); xdebug_hash_destroy(context->function_breakpoints); xdebug_hash_destroy(context->exception_breakpoints); xdebug_hash_destroy(context->eval_id_lookup); xdebug_llist_destroy(context->line_breakpoints, NULL); xdebug_hash_destroy(context->breakpoint_list); xdfree(context->buffer); } xdebug_close_log(TSRMLS_C); XG(remote_enabled) = 0; return 1; } int xdebug_dbgp_error(xdebug_con *context, int type, char *exception_type, char *message, const char *location, const uint line, xdebug_llist *stack) { char *errortype; xdebug_xml_node *response, *error; TSRMLS_FETCH(); if (exception_type) { errortype = exception_type; } else { errortype = xdebug_error_type(type); } if (exception_type) { XG(status) = DBGP_STATUS_BREAK; XG(reason) = DBGP_REASON_EXCEPTION; } else { switch (type) { case E_CORE_ERROR: /* no break - intentionally */ case E_ERROR: /*case E_PARSE: the parser would return 1 (failure), we can bail out nicely */ case E_COMPILE_ERROR: case E_USER_ERROR: XG(status) = DBGP_STATUS_STOPPING; XG(reason) = DBGP_REASON_ABORTED; break; default: XG(status) = DBGP_STATUS_BREAK; XG(reason) = DBGP_REASON_ERROR; } } /* runtime_allowed = ( (type != E_ERROR) && (type != E_CORE_ERROR) && (type != E_COMPILE_ERROR) && (type != E_USER_ERROR) ) ? XDEBUG_BREAKPOINT | XDEBUG_RUNTIME : 0; */ response = xdebug_xml_node_init("response"); xdebug_xml_add_attribute(response, "xmlns", "urn:debugger_protocol_v1"); xdebug_xml_add_attribute(response, "xmlns:xdebug", "http://xdebug.org/dbgp/xdebug"); /* lastcmd and lasttransid are not always set (for example when the * connection is severed before the first command is send) */ if (XG(lastcmd) && XG(lasttransid)) { xdebug_xml_add_attribute_ex(response, "command", XG(lastcmd), 0, 0); xdebug_xml_add_attribute_ex(response, "transaction_id", XG(lasttransid), 0, 0); } xdebug_xml_add_attribute(response, "status", xdebug_dbgp_status_strings[XG(status)]); xdebug_xml_add_attribute(response, "reason", xdebug_dbgp_reason_strings[XG(reason)]); error = xdebug_xml_node_init("error"); xdebug_xml_add_attribute_ex(error, "code", xdebug_sprintf("%lu", type), 0, 1); xdebug_xml_add_attribute_ex(error, "exception", xdstrdup(errortype), 0, 1); xdebug_xml_add_text(error, xdstrdup(message)); xdebug_xml_add_child(response, error); send_message(context, response TSRMLS_CC); xdebug_xml_node_dtor(response); if (!exception_type) { xdfree(errortype); } xdebug_dbgp_cmdloop(context, 1 TSRMLS_CC); return 1; } int xdebug_dbgp_breakpoint(xdebug_con *context, xdebug_llist *stack, char *file, long lineno, int type, char *exception, char *message) { xdebug_xml_node *response, *error_container; TSRMLS_FETCH(); XG(status) = DBGP_STATUS_BREAK; XG(reason) = DBGP_REASON_OK; response = xdebug_xml_node_init("response"); xdebug_xml_add_attribute(response, "xmlns", "urn:debugger_protocol_v1"); xdebug_xml_add_attribute(response, "xmlns:xdebug", "http://xdebug.org/dbgp/xdebug"); /* lastcmd and lasttransid are not always set (for example when the * connection is severed before the first command is send) */ if (XG(lastcmd) && XG(lasttransid)) { xdebug_xml_add_attribute_ex(response, "command", XG(lastcmd), 0, 0); xdebug_xml_add_attribute_ex(response, "transaction_id", XG(lasttransid), 0, 0); } xdebug_xml_add_attribute(response, "status", xdebug_dbgp_status_strings[XG(status)]); xdebug_xml_add_attribute(response, "reason", xdebug_dbgp_reason_strings[XG(reason)]); error_container = xdebug_xml_node_init("xdebug:message"); if (file) { char *tmp_filename = file; int tmp_lineno = lineno; if (check_evaled_code(NULL, &tmp_filename, &tmp_lineno, 0 TSRMLS_CC)) { xdebug_xml_add_attribute_ex(error_container, "filename", xdstrdup(tmp_filename), 0, 1); } else { xdebug_xml_add_attribute_ex(error_container, "filename", xdebug_path_to_url(file TSRMLS_CC), 0, 1); } } if (lineno) { xdebug_xml_add_attribute_ex(error_container, "lineno", xdebug_sprintf("%lu", lineno), 0, 1); } if (exception) { xdebug_xml_add_attribute_ex(error_container, "exception", xdstrdup(exception), 0, 1); } if (message) { xdebug_xml_add_text(error_container, xdstrdup(message)); } xdebug_xml_add_child(response, error_container); send_message(context, response TSRMLS_CC); xdebug_xml_node_dtor(response); XG(lastcmd) = NULL; if (XG(lasttransid)) { xdfree(XG(lasttransid)); XG(lasttransid) = NULL; } xdebug_dbgp_cmdloop(context, 1 TSRMLS_CC); return 1; } int xdebug_dbgp_stream_output(const char *string, unsigned int length TSRMLS_DC) { if ((XG(stdout_mode) == 1 || XG(stdout_mode) == 2) && length) { xdebug_send_stream("stdout", string, length TSRMLS_CC); } if (XG(stdout_mode) == 0 || XG(stdout_mode) == 1) { return 0; } return -1; } static char *create_eval_key_file(char *filename, int lineno) { return xdebug_sprintf("%s(%d) : eval()'d code", filename, lineno); } static char *create_eval_key_id(int id) { return xdebug_sprintf("%04x", id); } int xdebug_dbgp_register_eval_id(xdebug_con *context, function_stack_entry *fse) { char *key; xdebug_eval_info *ei; context->eval_id_sequence++; ei = xdcalloc(sizeof(xdebug_eval_info), 1); ei->id = context->eval_id_sequence; ei->contents = xdstrndup(fse->include_filename, strlen(fse->include_filename)); ei->refcount = 2; key = create_eval_key_file(fse->filename, fse->lineno); xdebug_hash_add(context->eval_id_lookup, key, strlen(key), (void*) ei); key = create_eval_key_id(ei->id); xdebug_hash_add(context->eval_id_lookup, key, strlen(key), (void*) ei); return ei->id; } xdebug-2.2.3/xdebug_handler_dbgp.h0000644000175000017500000001043112147043204016374 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #ifndef __HAVE_XDEBUG_HANDLER_DBGP_H__ #define __HAVE_XDEBUG_HANDLER_DBGP_H__ #include #include "xdebug_handlers.h" #include "xdebug_xml.h" #define DBGP_VERSION "1.0" typedef struct xdebug_dbgp_result { int status; int reason; int code; } xdebug_dbgp_result; #define ADD_REASON_MESSAGE(c) { \ xdebug_xml_node *message = xdebug_xml_node_init("message"); \ xdebug_error_entry *error_entry = &xdebug_error_codes[0]; \ \ while (error_entry->message) { \ if ((c) == error_entry->code) { \ xdebug_xml_add_text(message, xdstrdup(error_entry->message)); \ xdebug_xml_add_child(error, message); \ } \ error_entry++; \ } \ } #define RETURN_RESULT(s, r, c) { \ xdebug_xml_node *error = xdebug_xml_node_init("error"); \ xdebug_xml_node *message = xdebug_xml_node_init("message"); \ xdebug_error_entry *error_entry = &xdebug_error_codes[0]; \ \ xdebug_xml_add_attribute(*retval, "status", xdebug_dbgp_status_strings[(s)]); \ xdebug_xml_add_attribute(*retval, "reason", xdebug_dbgp_reason_strings[(r)]); \ xdebug_xml_add_attribute_ex(error, "code", xdebug_sprintf("%u", (c)), 0, 1); \ \ while (error_entry->message) { \ if ((c) == error_entry->code) { \ xdebug_xml_add_text(message, xdstrdup(error_entry->message)); \ xdebug_xml_add_child(error, message); \ } \ error_entry++; \ } \ xdebug_xml_add_child(*retval, error); \ return; \ } /* Argument structure */ typedef struct xdebug_dbgp_arg { char *value[27]; /* one extra for - */ } xdebug_dbgp_arg; #define DBGP_FUNC_PARAMETERS xdebug_xml_node **retval, xdebug_con *context, xdebug_dbgp_arg *args TSRMLS_DC #define DBGP_FUNC_PASS_PARAMETERS retval, context, args TSRMLS_CC #define DBGP_FUNC(name) static void xdebug_dbgp_handle_##name(DBGP_FUNC_PARAMETERS) #define DBGP_FUNC_ENTRY(name,flags) { #name, xdebug_dbgp_handle_##name, 0, flags }, #define DBGP_CONT_FUNC_ENTRY(name,flags) { #name, xdebug_dbgp_handle_##name, 1, flags }, #define DBGP_STOP_FUNC_ENTRY(name,flags) { #name, xdebug_dbgp_handle_##name, 2, flags }, #define XDEBUG_DBGP_NONE 0x00 #define XDEBUG_DBGP_POST_MORTEM 0x01 typedef struct xdebug_dbgp_cmd { char *name; void (*handler)(DBGP_FUNC_PARAMETERS); int cont; int flags; } xdebug_dbgp_cmd; #define CMD_OPTION(opt) (opt == '-' ? args->value[26] : args->value[(opt) - 'a']) int xdebug_dbgp_init(xdebug_con *context, int mode); int xdebug_dbgp_deinit(xdebug_con *context); int xdebug_dbgp_error(xdebug_con *context, int type, char *exception_type, char *message, const char *location, const uint line, xdebug_llist *stack); int xdebug_dbgp_breakpoint(xdebug_con *context, xdebug_llist *stack, char *file, long lineno, int type, char *exception, char *message); int xdebug_dbgp_stream_output(const char *string, unsigned int length TSRMLS_DC); int xdebug_dbgp_register_eval_id(xdebug_con *context, function_stack_entry *fse); char *xdebug_dbgp_get_revision(void); #define xdebug_handler_dbgp { \ xdebug_dbgp_init, \ xdebug_dbgp_deinit, \ xdebug_dbgp_error, \ xdebug_dbgp_breakpoint, \ xdebug_dbgp_stream_output, \ xdebug_dbgp_register_eval_id, \ xdebug_dbgp_get_revision \ } #endif xdebug-2.2.3/xdebug_hash.c0000644000175000017500000001706112147043204014707 0ustar derickderick/* $Id: xdebug_hash.c,v 1.6 2008-11-27 18:56:26 derick Exp $ */ /* The contents of this file are subject to the Vulcan Logic Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.vl-srm.net/vlpl/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is vl-srm.net code. * * The Initial Developer of the Original Code is the Vulcan Logic * Group. Portions created by Vulcan Logic Group are Copyright (C) * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved. * * Author(s): Sterling Hughes */ #include #include #include #include "xdebug_hash.h" #include "xdebug_llist.h" /* * Helper function to make a null terminated string from a key */ char *xdebug_hash_key_to_str(xdebug_hash_key* key, int* new_len) { char *tmp; tmp = calloc (key->value.str.len + 1, 1); memcpy(tmp, key->value.str.val, key->value.str.len); *new_len = key->value.str.len; return tmp; } static xdebug_ui32 xdebug_hash_str(const char *key, unsigned int key_length) { char *p = (char *) key; char *end = (char *) key + key_length; unsigned long h = 5381; while (p < end) { h += h << 5; h ^= (unsigned long) *p++; } return h; } static xdebug_ui32 xdebug_hash_num(xdebug_ui32 key) { key += ~(key << 15); key ^= (key >> 10); key += (key << 3); key ^= (key >> 6); key += (key << 11); key ^= (key >> 16); return key; } static void hash_element_dtor(void *u, void *ele) { xdebug_hash_element *e = (xdebug_hash_element *) ele; xdebug_hash *h = (xdebug_hash *) u; if (e->key.type == XDEBUG_HASH_KEY_IS_STRING) { free(e->key.value.str.val); } if (h->dtor) { h->dtor(e->ptr); } free(e); e = NULL; } xdebug_hash *xdebug_hash_alloc(int slots, xdebug_hash_dtor dtor) { xdebug_hash *h; int i; h = malloc(sizeof(xdebug_hash)); h->dtor = dtor; h->size = 0; h->slots = slots; h->table = (xdebug_llist **) malloc(slots * sizeof(xdebug_llist *)); for (i = 0; i < h->slots; ++i) { h->table[i] = xdebug_llist_alloc((xdebug_llist_dtor) hash_element_dtor); } return h; } #define FIND_SLOT(__h, __s_key, __s_key_len, __n_key) \ ((__s_key ? xdebug_hash_str(__s_key, __s_key_len) : xdebug_hash_num(__n_key)) % (__h)->slots) #define KEY_CREATE(__k, __s_key, __s_key_len, __n_key, __dup) \ if (__s_key) { \ if (__dup) { \ (__k)->value.str.val = (char *) malloc(__s_key_len); \ memcpy((__k)->value.str.val, __s_key, __s_key_len); \ } else { \ (__k)->value.str.val = __s_key; \ } \ (__k)->value.str.len = __s_key_len; \ (__k)->type = XDEBUG_HASH_KEY_IS_STRING; \ } else { \ (__k)->value.num = __n_key; \ (__k)->type = XDEBUG_HASH_KEY_IS_NUM; \ } static int xdebug_hash_key_compare(xdebug_hash_key *key1, xdebug_hash_key *key2) { if (key1->type == XDEBUG_HASH_KEY_IS_NUM) { if (key2->type == XDEBUG_HASH_KEY_IS_STRING) return 0; if (key1->value.num == key2->value.num) return 1; } else { if (key2->type == XDEBUG_HASH_KEY_IS_NUM) return 0; if (key1->value.str.len == key2->value.str.len && *key1->value.str.val == *key2->value.str.val && memcmp(key1->value.str.val, key2->value.str.val, key1->value.str.len) == 0) { return 1; } } return 0; } int xdebug_hash_add_or_update(xdebug_hash *h, char *str_key, unsigned int str_key_len, unsigned long num_key, const void *p) { xdebug_hash_element *e; xdebug_hash_key tmp; xdebug_llist *l; xdebug_llist_element *le; int slot; slot = FIND_SLOT(h, str_key, str_key_len, num_key); l = h->table[slot]; KEY_CREATE(&tmp, str_key, str_key_len, num_key, 0); for (le = XDEBUG_LLIST_HEAD(l); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { if (xdebug_hash_key_compare(&tmp, &((xdebug_hash_element *) XDEBUG_LLIST_VALP(le))->key)) { xdebug_hash_element *to_update = XDEBUG_LLIST_VALP(le); if (h->dtor) { h->dtor(to_update->ptr); } to_update->ptr = (void *) p; return 1; } } e = (xdebug_hash_element *) malloc(sizeof(xdebug_hash_element)); KEY_CREATE(&e->key, str_key, str_key_len, num_key, 1); e->ptr = (void *) p; if (xdebug_llist_insert_next(l, XDEBUG_LLIST_TAIL(l), e)) { ++h->size; return 1; } else { return 0; } } int xdebug_hash_extended_delete(xdebug_hash *h, char *str_key, unsigned int str_key_len, xdebug_ui32 num_key) { xdebug_llist *l; xdebug_llist_element *le; xdebug_hash_key tmp; int slot; slot = FIND_SLOT(h, str_key, str_key_len, num_key); l = h->table[slot]; KEY_CREATE(&tmp, str_key, str_key_len, num_key, 0); for (le = XDEBUG_LLIST_HEAD(l); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { if (xdebug_hash_key_compare(&tmp, &((xdebug_hash_element *) XDEBUG_LLIST_VALP(le))->key)) { xdebug_llist_remove(l, le, (void *) h); --h->size; return 1; } } return 0; } int xdebug_hash_extended_find(xdebug_hash *h, char *str_key, unsigned int str_key_len, xdebug_ui32 num_key, void **p) { xdebug_llist *l; xdebug_llist_element *le; xdebug_hash_key tmp; int slot; slot = FIND_SLOT(h, str_key, str_key_len, num_key); l = h->table[slot]; KEY_CREATE(&tmp, str_key, str_key_len, num_key, 0); for (le = XDEBUG_LLIST_HEAD(l); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { if (xdebug_hash_key_compare(&tmp, &((xdebug_hash_element *) XDEBUG_LLIST_VALP(le))->key)) { *p = ((xdebug_hash_element *) XDEBUG_LLIST_VALP(le))->ptr; return 1; } } return 0; } void xdebug_hash_apply(xdebug_hash *h, void *user, void (*cb)(void *, xdebug_hash_element *)) { xdebug_llist_element *le; int i; for (i = 0; i < h->slots; ++i) { for (le = XDEBUG_LLIST_HEAD(h->table[i]); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { cb(user, (xdebug_hash_element *) XDEBUG_LLIST_VALP(le)); } } } static int xdebug_compare_le_name(const void *le1, const void *le2) { return strcmp((char *) XDEBUG_LLIST_VALP(*(xdebug_llist_element **) le1), (char *) XDEBUG_LLIST_VALP(*(xdebug_llist_element **) le2)); } void xdebug_hash_apply_with_argument(xdebug_hash *h, void *user, void (*cb)(void *, xdebug_hash_element *, void *), void *argument) { xdebug_llist_element *le; int i; int num_items = 0; xdebug_hash_element **pp_he_list; for (i = 0; i < h->slots; ++i) { for (le = XDEBUG_LLIST_HEAD(h->table[i]); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { num_items += 1; } } pp_he_list = (xdebug_hash_element **) malloc((size_t) (num_items * sizeof(xdebug_hash_element **))); if (pp_he_list) { int j = 0; for (i = 0; i < h->slots; ++i) { for (le = XDEBUG_LLIST_HEAD(h->table[i]); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { pp_he_list[j++] = XDEBUG_LLIST_VALP(le); } } qsort(pp_he_list, num_items, sizeof(xdebug_llist_element *), xdebug_compare_le_name); for (i = 0; i < num_items; ++i) { cb(user, pp_he_list[i], argument); } free((void *) pp_he_list); } else { for (i = 0; i < h->slots; ++i) { for (le = XDEBUG_LLIST_HEAD(h->table[i]); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { cb(user, (xdebug_hash_element *) XDEBUG_LLIST_VALP(le), argument); } } } } void xdebug_hash_destroy(xdebug_hash *h) { int i; for (i = 0; i < h->slots; ++i) { xdebug_llist_destroy(h->table[i], (void *) h); } free(h->table); free(h); } /* * Local Variables: * c-basic-offset: 4 * tab-width: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ xdebug-2.2.3/xdebug_hash.h0000644000175000017500000000563712147043204014722 0ustar derickderick/* $Id: xdebug_hash.h,v 1.2 2006-01-22 23:30:59 derick Exp $ */ /* The contents of this file are subject to the Vulcan Logic Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.vl-srm.net/vlpl/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is vl-srm.net code. * * The Initial Developer of the Original Code is the Vulcan Logic * Group. Portions created by Vulcan Logic Group are Copyright (C) * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved. * * Contributor(s): */ #ifndef __XDEBUG_HASH_H__ #define __XDEBUG_HASH_H__ #include #include "xdebug_llist.h" #define XDEBUG_HASH_KEY_IS_STRING 0 #define XDEBUG_HASH_KEY_IS_NUM 1 #define xdebug_ui32 unsigned long typedef void (*xdebug_hash_dtor)(void *); typedef struct _xdebug_hash { xdebug_llist **table; xdebug_hash_dtor dtor; int slots; size_t size; } xdebug_hash; typedef struct _xdebug_hash_key { union { struct { char *val; unsigned int len; } str; unsigned long num; } value; int type; } xdebug_hash_key; typedef struct _xdebug_hash_element { void *ptr; xdebug_hash_key key; } xdebug_hash_element; /* Helper functions */ char* xdebug_hash_key_to_str(xdebug_hash_key* key, int* new_len); /* Standard functions */ xdebug_hash *xdebug_hash_alloc(int slots, xdebug_hash_dtor dtor); int xdebug_hash_add_or_update(xdebug_hash *h, char *str_key, unsigned int str_key_len, unsigned long num_key, const void *p); int xdebug_hash_extended_delete(xdebug_hash *h, char *str_key, unsigned int str_key_len, unsigned long num_key); int xdebug_hash_extended_find(xdebug_hash *h, char *str_key, unsigned int str_key_len, unsigned long num_key, void **p); void xdebug_hash_apply(xdebug_hash *h, void *user, void (*cb)(void *, xdebug_hash_element *)); void xdebug_hash_apply_with_argument(xdebug_hash *h, void *user, void (*cb)(void *, xdebug_hash_element *, void *), void *argument); void xdebug_hash_destroy(xdebug_hash *h); #define xdebug_hash_find(h, key, key_len, p) xdebug_hash_extended_find(h, key, key_len, 0, p) #define xdebug_hash_delete(h, key, key_len) xdebug_hash_extended_delete(h, key, key_len, 0) #define xdebug_hash_add(h, key, key_len, p) xdebug_hash_add_or_update(h, key, key_len, 0, p) #define xdebug_hash_update xdebug_hash_add #define xdebug_hash_index_find(h, key, p) xdebug_hash_extended_find(h, NULL, 0, key, p) #define xdebug_hash_index_delete(h, key) xdebug_hash_extended_delete(h, NULL, 0, key) #define xdebug_hash_index_add(h, key, p) xdebug_hash_add_or_update(h, NULL, 0, key, p) #define xdebug_hash_index_update xdebug_hash_index_add #endif /* __XDEBUG_HASH_H__ */ xdebug-2.2.3/xdebug_llist.c0000644000175000017500000000740312147043204015112 0ustar derickderick/* $Id: xdebug_llist.c,v 1.5 2007-01-02 16:02:37 derick Exp $ */ /* The contents of this file are subject to the Vulcan Logic Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.vl-srm.net/vlpl/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is vl-srm.net code. * * The Initial Developer of the Original Code is the Vulcan Logic * Group. Portions created by Vulcan Logic Group are Copyright (C) * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved. * * Author(s): Sterling Hughes */ #include #include #include "xdebug_llist.h" xdebug_llist *xdebug_llist_alloc(xdebug_llist_dtor dtor) { xdebug_llist *l; l = malloc(sizeof(xdebug_llist)); xdebug_llist_init(l, dtor); return l; } void xdebug_llist_init(xdebug_llist *l, xdebug_llist_dtor dtor) { l->size = 0; l->dtor = dtor; l->head = NULL; l->tail = NULL; } int xdebug_llist_insert_next(xdebug_llist *l, xdebug_llist_element *e, const void *p) { xdebug_llist_element *ne; if (!e) { e = XDEBUG_LLIST_TAIL(l); } ne = (xdebug_llist_element *) malloc(sizeof(xdebug_llist_element)); ne->ptr = (void *) p; if (l->size == 0) { l->head = ne; l->head->prev = NULL; l->head->next = NULL; l->tail = ne; } else { ne->next = e->next; ne->prev = e; if (e->next) { e->next->prev = ne; } else { l->tail = ne; } e->next = ne; } ++l->size; return 1; } int xdebug_llist_insert_prev(xdebug_llist *l, xdebug_llist_element *e, const void *p) { xdebug_llist_element *ne; if (!e) { e = XDEBUG_LLIST_HEAD(l); } ne = (xdebug_llist_element *) malloc(sizeof(xdebug_llist_element)); ne->ptr = (void *) p; if (l->size == 0) { l->head = ne; l->head->prev = NULL; l->head->next = NULL; l->tail = ne; } else { ne->next = e; ne->prev = e->prev; if (e->prev) e->prev->next = ne; else l->head = ne; e->prev = ne; } ++l->size; return 0; } int xdebug_llist_remove(xdebug_llist *l, xdebug_llist_element *e, void *user) { if (e == NULL || l->size == 0) return 0; if (e == l->head) { l->head = e->next; if (l->head == NULL) l->tail = NULL; else e->next->prev = NULL; } else { e->prev->next = e->next; if (!e->next) l->tail = e->prev; else e->next->prev = e->prev; } if (l->dtor) { l->dtor(user, e->ptr); } free(e); --l->size; return 0; } int xdebug_llist_remove_next(xdebug_llist *l, xdebug_llist_element *e, void *user) { return xdebug_llist_remove(l, e->next, user); } int xdebug_llist_remove_prev(xdebug_llist *l, xdebug_llist_element *e, void *user) { return xdebug_llist_remove(l, e->prev, user); } xdebug_llist_element *xdebug_llist_jump(xdebug_llist *l, int where, int pos) { xdebug_llist_element *e=NULL; int i; if (where == LIST_HEAD) { e = XDEBUG_LLIST_HEAD(l); for (i = 0; i < pos; ++i) { e = XDEBUG_LLIST_NEXT(e); } } else if (where == LIST_TAIL) { e = XDEBUG_LLIST_TAIL(l); for (i = 0; i < pos; ++i) { e = XDEBUG_LLIST_PREV(e); } } return e; } size_t xdebug_llist_count(xdebug_llist *l) { return l->size; } void xdebug_llist_empty(xdebug_llist *l, void *user) { while (xdebug_llist_count(l) > 0) { xdebug_llist_remove(l, XDEBUG_LLIST_TAIL(l), user); } } void xdebug_llist_destroy(xdebug_llist *l, void *user) { xdebug_llist_empty(l, user); free (l); } /* * Local Variables: * c-basic-offset: 4 * tab-width: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ xdebug-2.2.3/xdebug_llist.h0000644000175000017500000000475512147043204015126 0ustar derickderick/* $Id: xdebug_llist.h,v 1.4 2003-02-20 14:30:54 derick Exp $ */ /* The contents of this file are subject to the Vulcan Logic Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.vl-srm.net/vlpl/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is vl-srm.net code. * * The Initial Developer of the Original Code is the Vulcan Logic * Group. Portions created by Vulcan Logic Group are Copyright (C) * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved. * * Contributor(s): Sterling Hughes * Daniel R. Kalowsky */ #ifndef __XDEBUG_LLIST_H__ #define __XDEBUG_LLIST_H__ #include typedef void (*xdebug_llist_dtor)(void *, void *); typedef struct _xdebug_llist_element { void *ptr; struct _xdebug_llist_element *prev; struct _xdebug_llist_element *next; } xdebug_llist_element; typedef struct _xdebug_llist { xdebug_llist_element *head; xdebug_llist_element *tail; xdebug_llist_dtor dtor; size_t size; } xdebug_llist; xdebug_llist *xdebug_llist_alloc(xdebug_llist_dtor dtor); void xdebug_llist_init(xdebug_llist *l, xdebug_llist_dtor dtor); int xdebug_llist_insert_next(xdebug_llist *l, xdebug_llist_element *e, const void *p); int xdebug_llist_insert_prev(xdebug_llist *l, xdebug_llist_element *e, const void *p); int xdebug_llist_remove(xdebug_llist *l, xdebug_llist_element *e, void *user); int xdebug_llist_remove_next(xdebug_llist *l, xdebug_llist_element *e, void *user); xdebug_llist_element *xdebug_llist_jump(xdebug_llist *l, int where, int pos); size_t xdebug_llist_count(xdebug_llist *l); void xdebug_llist_empty(xdebug_llist *l, void *user); void xdebug_llist_destroy(xdebug_llist *l, void *user); #if !defined(LIST_HEAD) #define LIST_HEAD 0 #endif #if !defined(LIST_TAIL) #define LIST_TAIL 1 #endif #define XDEBUG_LLIST_HEAD(__l) ((__l)->head) #define XDEBUG_LLIST_TAIL(__l) ((__l)->tail) #define XDEBUG_LLIST_NEXT(__e) ((__e)->next) #define XDEBUG_LLIST_PREV(__e) ((__e)->prev) #define XDEBUG_LLIST_VALP(__e) ((__e)->ptr) #define XDEBUG_LLIST_IS_TAIL(__e) ((__e)->next ? 0 : 1) #define XDEBUG_LLIST_IS_HEAD(__e) ((__e)->prev ? 0 : 1) #define XDEBUG_LLIST_COUNT(__l) ((__l)->size) #endif /* __XDEBUG_LLIST_H__ */ xdebug-2.2.3/xdebug_mm.h0000644000175000017500000000307712147043204014404 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #ifndef __HAVE_XDEBUG_MM_H__ #define __HAVE_XDEBUG_MM_H__ /* Memory allocators */ #if 0 #define xdmalloc emalloc #define xdcalloc ecalloc #define xdrealloc erealloc #define xdfree efree #define xdstrdup estrdup #define xdstrndup estrndup #else #define xdmalloc malloc #define xdcalloc calloc #define xdrealloc realloc #define xdfree free #define xdstrdup strdup #define xdstrndup xdebug_strndup #endif #endif xdebug-2.2.3/xdebug_private.c0000644000175000017500000000502712147043204015435 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #include "php_xdebug.h" #include "xdebug_private.h" ZEND_EXTERN_MODULE_GLOBALS(xdebug) function_stack_entry *xdebug_get_stack_head(TSRMLS_D) { xdebug_llist_element *le; if (XG(stack)) { if ((le = XDEBUG_LLIST_HEAD(XG(stack)))) { return XDEBUG_LLIST_VALP(le); } else { return NULL; } } else { return NULL; } } function_stack_entry *xdebug_get_stack_frame(int nr TSRMLS_DC) { xdebug_llist_element *le; if (!XG(stack)) { return NULL; } if (!(le = XDEBUG_LLIST_TAIL(XG(stack)))) { return NULL; } while (nr) { nr--; le = XDEBUG_LLIST_PREV(le); if (!le) { return NULL; } } return XDEBUG_LLIST_VALP(le); } function_stack_entry *xdebug_get_stack_tail(TSRMLS_D) { xdebug_llist_element *le; if (XG(stack)) { if ((le = XDEBUG_LLIST_TAIL(XG(stack)))) { return XDEBUG_LLIST_VALP(le); } else { return NULL; } } else { return NULL; } } static void xdebug_used_var_hash_from_llist_dtor(void *data) { /* We are not freeing anything as the list creating didn't copy the data */ } xdebug_hash* xdebug_used_var_hash_from_llist(xdebug_llist *list) { xdebug_hash *tmp; xdebug_llist_element *le; char *var_name; tmp = xdebug_hash_alloc(32, xdebug_used_var_hash_from_llist_dtor); for (le = XDEBUG_LLIST_HEAD(list); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { var_name = (char*) XDEBUG_LLIST_VALP(le); xdebug_hash_add(tmp, var_name, strlen(var_name), var_name); } return tmp; } xdebug-2.2.3/xdebug_private.h0000644000175000017500000001426512147043204015446 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #ifndef XDEBUG_PRIVATE_H #define XDEBUG_PRIVATE_H #include "zend.h" #include "zend_API.h" #include "zend_alloc.h" #include "zend_execute.h" #include "zend_compile.h" #include "zend_constants.h" #include "zend_extensions.h" #include "zend_exceptions.h" #if PHP_VERSION_ID >= 50500 #include "zend_generators.h" #endif #include "zend_exceptions.h" #include "zend_vm.h" #include "zend_hash.h" #include "xdebug_hash.h" #include "xdebug_llist.h" #define MICRO_IN_SEC 1000000.00 #ifdef ZTS #include "TSRM.h" #endif char* xdebug_start_trace(char* fname, long options TSRMLS_DC); void xdebug_stop_trace(TSRMLS_D); typedef struct xdebug_var { char *name; void *addr; } xdebug_var; #define XFUNC_UNKNOWN 0x00 #define XFUNC_NORMAL 0x01 #define XFUNC_STATIC_MEMBER 0x02 #define XFUNC_MEMBER 0x03 #define XFUNC_INCLUDES 0x10 #define XFUNC_EVAL 0x10 #define XFUNC_INCLUDE 0x11 #define XFUNC_INCLUDE_ONCE 0x12 #define XFUNC_REQUIRE 0x13 #define XFUNC_REQUIRE_ONCE 0x14 #define XDEBUG_IS_FUNCTION(f) (f == XFUNC_NORMAL || f == XFUNC_STATIC_MEMBER || f == XFUNC_MEMBER) #define XDEBUG_REGISTER_LONG_CONSTANT(__c) REGISTER_LONG_CONSTANT(#__c, __c, CONST_CS|CONST_PERSISTENT) #define XDEBUG_NONE 0 #define XDEBUG_JIT 1 #define XDEBUG_REQ 2 #define XDEBUG_BREAK 1 #define XDEBUG_STEP 2 #define XDEBUG_INTERNAL 1 #define XDEBUG_EXTERNAL 2 #define XDEBUG_MAX_FUNCTION_LEN 1024 #define XDEBUG_TRACE_OPTION_APPEND 1 #define XDEBUG_TRACE_OPTION_COMPUTERIZED 2 #define XDEBUG_TRACE_OPTION_HTML 4 #define XDEBUG_CC_OPTION_UNUSED 1 #define XDEBUG_CC_OPTION_DEAD_CODE 2 #define STATUS_STARTING 0 #define STATUS_STOPPING 1 #define STATUS_STOPPED 2 #define STATUS_RUNNING 3 #define STATUS_BREAK 4 #define REASON_OK 0 #define REASON_ERROR 1 #define REASON_ABORTED 2 #define REASON_EXCEPTION 3 #define XDEBUG_ERROR_OK 0 #define XDEBUG_ERROR_PARSE 1 #define XDEBUG_ERROR_DUP_ARG 2 #define XDEBUG_ERROR_INVALID_ARGS 3 #define XDEBUG_ERROR_UNIMPLEMENTED 4 #define XDEBUG_ERROR_COMMAND_UNAVAILABLE 5 #define XDEBUG_ERROR_CANT_OPEN_FILE 100 #define XDEBUG_ERROR_STREAM_REDIRECT_FAILED 101 /* unused */ #define XDEBUG_ERROR_BREAKPOINT_NOT_SET 200 #define XDEBUG_ERROR_BREAKPOINT_TYPE_NOT_SUPPORTED 201 #define XDEBUG_ERROR_BREAKPOINT_INVALID 202 #define XDEBUG_ERROR_BREAKPOINT_NO_CODE 203 #define XDEBUG_ERROR_BREAKPOINT_INVALID_STATE 204 #define XDEBUG_ERROR_NO_SUCH_BREAKPOINT 205 #define XDEBUG_ERROR_EVALUATING_CODE 206 #define XDEBUG_ERROR_INVALID_EXPRESSION 207 /* unused */ #define XDEBUG_ERROR_PROPERTY_NON_EXISTANT 300 #define XDEBUG_ERROR_STACK_DEPTH_INVALID 301 #define XDEBUG_ERROR_CONTEXT_INVALID 302 /* unused */ #define XDEBUG_ERROR_PROFILING_NOT_STARTED 800 #define XDEBUG_ERROR_ENCODING_NOT_SUPPORTED 900 #define ZEND_XDEBUG_VISITED 0x1000000 typedef struct _xdebug_func { char *class; char *function; int type; int internal; } xdebug_func; typedef struct _xdebug_call_entry { int type; /* 0 = function call, 1 = line */ int user_defined; char *filename; char *function; int lineno; double time_taken; } xdebug_call_entry; typedef struct xdebug_aggregate_entry { int user_defined; char *filename; char *function; int lineno; int call_count; double time_own; double time_inclusive; HashTable *call_list; } xdebug_aggregate_entry; typedef struct xdebug_profile { double time; double mark; long memory; xdebug_llist *call_list; } xdebug_profile; typedef struct _function_stack_entry { /* function properties */ xdebug_func function; int user_defined; /* location properties */ int level; char *filename; int lineno; char *include_filename; /* argument properties */ int arg_done; int varc; xdebug_var *var; zval *return_value; xdebug_llist *used_vars; HashTable *symbol_table; zend_execute_data *execute_data; zval *This; /* tracing properties */ signed long memory; signed long prev_memory; double time; /* profiling properties */ xdebug_profile profile; #if 0 double time_taken; unsigned int f_calls; #endif /* misc properties */ int refcount; struct _function_stack_entry *prev; zend_op_array *op_array; xdebug_aggregate_entry *aggr_entry; } function_stack_entry; function_stack_entry *xdebug_get_stack_head(TSRMLS_D); function_stack_entry *xdebug_get_stack_frame(int nr TSRMLS_DC); function_stack_entry *xdebug_get_stack_tail(TSRMLS_D); xdebug_hash* xdebug_used_var_hash_from_llist(xdebug_llist *list); void xdebug_init_debugger(TSRMLS_D); #endif /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: */ xdebug-2.2.3/xdebug_profiler.c0000644000175000017500000002304512147043204015605 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #include "php.h" #include "TSRM.h" #include "php_globals.h" #include "php_xdebug.h" #include "Zend/zend_alloc.h" #include "xdebug_mm.h" #include "xdebug_profiler.h" #include "xdebug_str.h" #include "xdebug_var.h" #include "usefulstuff.h" #ifdef PHP_WIN32 #include #endif ZEND_EXTERN_MODULE_GLOBALS(xdebug) void xdebug_profile_aggr_call_entry_dtor(void *elem) { xdebug_aggregate_entry *xae = (xdebug_aggregate_entry *) elem; if (xae->filename) { xdfree(xae->filename); } if (xae->function) { xdfree(xae->function); } } void xdebug_profile_call_entry_dtor(void *dummy, void *elem) { xdebug_call_entry *ce = elem; if (ce->function) { xdfree(ce->function); } if (ce->filename) { xdfree(ce->filename); } xdfree(ce); } int xdebug_profiler_init(char *script_name TSRMLS_DC) { char *filename = NULL, *fname = NULL; if (!strlen(XG(profiler_output_name)) || xdebug_format_output_filename(&fname, XG(profiler_output_name), script_name) <= 0 ) { /* Invalid or empty xdebug.profiler_output_name */ return FAILURE; } if (IS_SLASH(XG(profiler_output_dir)[strlen(XG(profiler_output_dir)) - 1])) { filename = xdebug_sprintf("%s%s", XG(profiler_output_dir), fname); } else { filename = xdebug_sprintf("%s%c%s", XG(profiler_output_dir), DEFAULT_SLASH, fname); } xdfree(fname); if (XG(profiler_append)) { XG(profile_file) = xdebug_fopen(filename, "a", NULL, &XG(profile_filename)); } else { XG(profile_file) = xdebug_fopen(filename, "w", NULL, &XG(profile_filename)); } xdfree(filename); if (!XG(profile_file)) { return FAILURE; } if (XG(profiler_append)) { fprintf(XG(profile_file), "\n==== NEW PROFILING FILE ==============================================\n"); } fprintf(XG(profile_file), "version: 1\ncreator: xdebug %s\n", XDEBUG_VERSION); fprintf(XG(profile_file), "cmd: %s\npart: 1\npositions: line\n\n", script_name); fprintf(XG(profile_file), "events: Time\n\n"); fflush(XG(profile_file)); return SUCCESS; } void xdebug_profiler_deinit(TSRMLS_D) { function_stack_entry *fse; xdebug_llist_element *le; for (le = XDEBUG_LLIST_TAIL(XG(stack)); le != NULL; le = XDEBUG_LLIST_PREV(le)) { fse = XDEBUG_LLIST_VALP(le); if (fse->user_defined == XDEBUG_INTERNAL) { xdebug_profiler_function_internal_end(fse TSRMLS_CC); } else { xdebug_profiler_function_user_end(fse, fse->op_array TSRMLS_CC); } } } static inline void xdebug_profiler_function_push(function_stack_entry *fse) { fse->profile.time += xdebug_get_utime(); fse->profile.time -= fse->profile.mark; fse->profile.mark = 0; } void xdebug_profiler_function_continue(function_stack_entry *fse) { fse->profile.mark = xdebug_get_utime(); } void xdebug_profiler_function_pause(function_stack_entry *fse) { xdebug_profiler_function_push(fse); } void xdebug_profiler_function_user_begin(function_stack_entry *fse TSRMLS_DC) { fse->profile.time = 0; fse->profile.mark = xdebug_get_utime(); } void xdebug_profiler_function_user_end(function_stack_entry *fse, zend_op_array* op_array TSRMLS_DC) { xdebug_llist_element *le; char *tmp_fname, *tmp_name; int default_lineno = 0; if (fse->prev && !fse->prev->profile.call_list) { fse->prev->profile.call_list = xdebug_llist_alloc(xdebug_profile_call_entry_dtor); } if (!fse->profile.call_list) { fse->profile.call_list = xdebug_llist_alloc(xdebug_profile_call_entry_dtor); } xdebug_profiler_function_push(fse); tmp_name = xdebug_show_fname(fse->function, 0, 0 TSRMLS_CC); switch (fse->function.type) { case XFUNC_INCLUDE: case XFUNC_INCLUDE_ONCE: case XFUNC_REQUIRE: case XFUNC_REQUIRE_ONCE: tmp_fname = xdebug_sprintf("%s::%s", tmp_name, fse->include_filename); xdfree(tmp_name); tmp_name = tmp_fname; default_lineno = 1; break; default: if (op_array && op_array->function_name) { default_lineno = op_array->line_start; } else { default_lineno = fse->lineno; } break; } if (default_lineno == 0) { default_lineno = 1; } if (fse->prev) { xdebug_call_entry *ce = xdmalloc(sizeof(xdebug_call_entry)); ce->filename = op_array ? xdstrdup(op_array->filename) : xdstrdup(fse->filename); ce->function = xdstrdup(tmp_name); ce->time_taken = fse->profile.time; ce->lineno = fse->lineno; ce->user_defined = fse->user_defined; xdebug_llist_insert_next(fse->prev->profile.call_list, NULL, ce); } if (fse->user_defined == XDEBUG_EXTERNAL) { if (op_array) { fprintf(XG(profile_file), "fl=%s\n", op_array->filename); } else { fprintf(XG(profile_file), "fl=%s\n", fse->filename); } fprintf(XG(profile_file), "fn=%s\n", tmp_name); } else { fprintf(XG(profile_file), "fl=php:internal\n"); fprintf(XG(profile_file), "fn=php::%s\n", tmp_name); } xdfree(tmp_name); if (fse->function.function && strcmp(fse->function.function, "{main}") == 0) { fprintf(XG(profile_file), "\nsummary: %lu\n\n", (unsigned long) (fse->profile.time * 1000000)); } fflush(XG(profile_file)); /* update aggregate data */ if (XG(profiler_aggregate)) { fse->aggr_entry->time_inclusive += fse->profile.time; fse->aggr_entry->call_count++; } /* Subtract time in calledfunction from time here */ for (le = XDEBUG_LLIST_HEAD(fse->profile.call_list); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { xdebug_call_entry *call_entry = XDEBUG_LLIST_VALP(le); fse->profile.time -= call_entry->time_taken; } fprintf(XG(profile_file), "%d %lu\n", default_lineno, (unsigned long) (fse->profile.time * 1000000)); /* update aggregate data */ if (XG(profiler_aggregate)) { fse->aggr_entry->time_own += fse->profile.time; } /* dump call list */ for (le = XDEBUG_LLIST_HEAD(fse->profile.call_list); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { xdebug_call_entry *call_entry = XDEBUG_LLIST_VALP(le); if (call_entry->user_defined == XDEBUG_EXTERNAL) { fprintf(XG(profile_file), "cfl=%s\n", call_entry->filename); fprintf(XG(profile_file), "cfn=%s\n", call_entry->function); } else { fprintf(XG(profile_file), "cfl=php:internal\n"); fprintf(XG(profile_file), "cfn=php::%s\n", call_entry->function); } fprintf(XG(profile_file), "calls=1 0 0\n"); fprintf(XG(profile_file), "%d %lu\n", call_entry->lineno, (unsigned long) (call_entry->time_taken * 1000000)); } fprintf(XG(profile_file), "\n"); fflush(XG(profile_file)); } void xdebug_profiler_function_internal_begin(function_stack_entry *fse TSRMLS_DC) { xdebug_profiler_function_user_begin(fse TSRMLS_CC); } void xdebug_profiler_function_internal_end(function_stack_entry *fse TSRMLS_DC) { xdebug_profiler_function_user_end(fse, NULL TSRMLS_CC); } static int xdebug_print_aggr_entry(void *pDest, void *argument TSRMLS_DC) { FILE *fp = (FILE *) argument; xdebug_aggregate_entry *xae = (xdebug_aggregate_entry *) pDest; fprintf(fp, "fl=%s\n", xae->filename); fprintf(fp, "fn=%s\n", xae->function); fprintf(fp, "%d %lu\n", 0, (unsigned long) (xae->time_own * 1000000)); if (strcmp(xae->function, "{main}") == 0) { fprintf(fp, "\nsummary: %lu\n\n", (unsigned long) (xae->time_inclusive * 1000000)); } if (xae->call_list) { xdebug_aggregate_entry **xae_call; zend_hash_internal_pointer_reset(xae->call_list); while (zend_hash_get_current_data(xae->call_list, (void**)&xae_call) == SUCCESS) { fprintf(fp, "cfn=%s\n", (*xae_call)->function); fprintf(fp, "calls=%d 0 0\n", (*xae_call)->call_count); fprintf(fp, "%d %lu\n", (*xae_call)->lineno, (unsigned long) ((*xae_call)->time_inclusive * 1000000)); zend_hash_move_forward(xae->call_list); } } fprintf(fp, "\n"); fflush(fp); return ZEND_HASH_APPLY_KEEP; } int xdebug_profiler_output_aggr_data(const char *prefix TSRMLS_DC) { char *filename; FILE *aggr_file; fprintf(stderr, "in xdebug_profiler_output_aggr_data() with %d entries\n", zend_hash_num_elements(&XG(aggr_calls))); if (zend_hash_num_elements(&XG(aggr_calls)) == 0) return SUCCESS; if (prefix) { filename = xdebug_sprintf("%s/cachegrind.out.aggregate.%s.%ld", XG(profiler_output_dir), prefix, getpid()); } else { filename = xdebug_sprintf("%s/cachegrind.out.aggregate.%ld", XG(profiler_output_dir), getpid()); } fprintf(stderr, "opening %s\n", filename); aggr_file = xdebug_fopen(filename, "w", NULL, NULL); if (!aggr_file) { return FAILURE; } fprintf(aggr_file, "version: 0.9.6\ncmd: Aggregate\npart: 1\n\nevents: Time\n\n"); fflush(aggr_file); zend_hash_apply_with_argument(&XG(aggr_calls), xdebug_print_aggr_entry, aggr_file TSRMLS_CC); fclose(aggr_file); fprintf(stderr, "wrote info for %d entries to %s\n", zend_hash_num_elements(&XG(aggr_calls)), filename); return SUCCESS; } xdebug-2.2.3/xdebug_profiler.h0000644000175000017500000000361212147043204015610 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #ifndef __XDEBUG_PROFILER_H__ #define __XDEBUG_PROFILER_H__ #include "php.h" #include "TSRM.h" #include "php_xdebug.h" #include "xdebug_private.h" int xdebug_profiler_init(char *script_name TSRMLS_DC); void xdebug_profiler_deinit(TSRMLS_D); int xdebug_profiler_output_aggr_data(const char *prefix TSRMLS_DC); void xdebug_profiler_function_user_begin(function_stack_entry *fse TSRMLS_DC); void xdebug_profiler_function_user_end(function_stack_entry *fse, zend_op_array *op_array TSRMLS_DC); void xdebug_profiler_function_internal_begin(function_stack_entry *fse TSRMLS_DC); void xdebug_profiler_function_internal_end(function_stack_entry *fse TSRMLS_DC); void xdebug_profile_call_entry_dtor(void *dummy, void *elem); void xdebug_profile_aggr_call_entry_dtor(void *elem); #endif xdebug-2.2.3/xdebug_set.c0000644000175000017500000000420012147043204014546 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ /* $Id: xdebug_set.c,v 1.5 2010-05-07 20:39:13 derick Exp $ */ #include #include #include "xdebug_set.h" xdebug_set *xdebug_set_create(unsigned int size) { xdebug_set *tmp; tmp = calloc(1, sizeof(xdebug_set)); tmp->size = size; size = ceil((size + 7) / 8) + 1; tmp->setinfo = calloc(1, size); return tmp; } void xdebug_set_free(xdebug_set *set) { free(set->setinfo); free(set); } void xdebug_set_add(xdebug_set *set, unsigned int position) { unsigned char *byte; unsigned int bit; byte = &(set->setinfo[position / 8]); bit = position % 8; *byte = *byte | 1 << bit; } void xdebug_set_remove(xdebug_set *set, unsigned int position) { unsigned char *byte; unsigned int bit; byte = &(set->setinfo[position / 8]); bit = position % 8; *byte = *byte & ~(1 << bit); } int xdebug_set_in_ex(xdebug_set *set, unsigned int position, int noisy) { unsigned char *byte; unsigned int bit; byte = &(set->setinfo[position / 8]); bit = position % 8; return (*byte & (1 << bit)); } xdebug-2.2.3/xdebug_set.h0000644000175000017500000000331012147043204014554 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ /* $Id: xdebug_set.h,v 1.4 2010-05-07 20:39:13 derick Exp $ */ #ifndef __XDEBUG_SET_H__ #define __XDEBUG_SET_H__ typedef struct _xdebug_set { unsigned int size; unsigned char *setinfo; } xdebug_set; xdebug_set *xdebug_set_create(unsigned int size); void xdebug_set_add(xdebug_set *set, unsigned int position); void xdebug_set_remove(xdebug_set *set, unsigned int position); #define xdebug_set_in(x,y) xdebug_set_in_ex(x,y,1) int xdebug_set_in_ex(xdebug_set *set, unsigned int position, int noisy); void xdebug_set_dump(xdebug_set *set); void xdebug_set_free(xdebug_set *set); #endif xdebug-2.2.3/xdebug_stack.c0000644000175000017500000012123512147043204015070 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #include "php_xdebug.h" #include "xdebug_private.h" #include "xdebug_code_coverage.h" #include "xdebug_compat.h" #include "xdebug_profiler.h" #include "xdebug_stack.h" #include "xdebug_str.h" #include "xdebug_superglobals.h" #include "xdebug_var.h" #include "ext/standard/html.h" #include "main/php_ini.h" ZEND_EXTERN_MODULE_GLOBALS(xdebug) static char* text_formats[11] = { "\n", "%s: %s in %s on line %d\n", "\nCall Stack:\n", #if HAVE_PHP_MEMORY_USAGE "%10.4f %10ld %3d. %s(", #else "%10.4f %3d. %s(", #endif "'%s'", ") %s:%d\n", "\n\nVariables in local scope (#%d):\n", "\n", " $%s = %s\n", " $%s = *uninitialized*\n", "SCREAM: Error suppression ignored for\n" }; static char* ansi_formats[11] = { "\n", "%s: %s in %s on line %d\n", "\nCall Stack:\n", #if HAVE_PHP_MEMORY_USAGE "%10.4f %10ld %3d. %s(", #else "%10.4f %3d. %s(", #endif "'%s'", ") %s:%d\n", "\n\nVariables in local scope (#%d):\n", "\n", " $%s = %s\n", " $%s = *uninitialized*\n", "SCREAM: Error suppression ignored for\n" }; static char* html_formats[13] = { "
\n\n", "\n", #if HAVE_PHP_MEMORY_USAGE "\n\n", "\n\n", "\n", #if HAVE_PHP_MEMORY_USAGE "\n", #else "\n", #endif "
( ! ) %s: %s in %s on line %d
Call Stack
#TimeMemoryFunctionLocation
%d%.4f%ld%s( ", #else "
Call Stack
#TimeFunctionLocation
%d%.4f%s( ", #endif "'%s'", " )..%s:%d
Variables in local scope (#%d)
Variables in local scope (#%d)
\n", "
$%s =
%s\n", "
$%s =
Undefined\n", " )..%s:%d\n", "( ! ) %s: %s in %s on line %d\n", "( ! ) SCREAM: Error suppression ignored for\n" }; static char** select_formats(int html TSRMLS_DC) { if (html) { return html_formats; } else if ((XG(cli_color) == 1 && xdebug_is_output_tty(TSRMLS_C)) || (XG(cli_color) == 2)) { return ansi_formats; } else { return text_formats; } } static void dump_used_var_with_contents(void *htmlq, xdebug_hash_element* he, void *argument) { int html = *(int *)htmlq; int len; zval *zvar; char *contents; char *name = (char*) he->ptr; HashTable *tmp_ht; char **formats; xdebug_str *str = (xdebug_str *) argument; TSRMLS_FETCH(); if (!he->ptr) { return; } /* Bail out on $this and $GLOBALS */ if (strcmp(name, "this") == 0 || strcmp(name, "GLOBALS") == 0) { return; } #if PHP_VERSION_ID >= 50300 if (!EG(active_symbol_table)) { zend_rebuild_symbol_table(TSRMLS_C); } #endif tmp_ht = XG(active_symbol_table); XG(active_symbol_table) = EG(active_symbol_table); zvar = xdebug_get_php_symbol(name, strlen(name) + 1); XG(active_symbol_table) = tmp_ht; formats = select_formats(PG(html_errors) TSRMLS_CC); if (!zvar) { xdebug_str_add(str, xdebug_sprintf(formats[9], name), 1); return; } if (html) { contents = xdebug_get_zval_value_fancy(NULL, zvar, &len, 0, NULL TSRMLS_CC); } else { contents = xdebug_get_zval_value(zvar, 0, NULL); } if (contents) { xdebug_str_add(str, xdebug_sprintf(formats[8], name, contents), 1); } else { xdebug_str_add(str, xdebug_sprintf(formats[9], name), 1); } xdfree(contents); } void xdebug_log_stack(const char *error_type_str, char *buffer, const char *error_filename, const int error_lineno TSRMLS_DC) { xdebug_llist_element *le; function_stack_entry *i; char *tmp_log_message; tmp_log_message = xdebug_sprintf( "PHP %s: %s in %s on line %d", error_type_str, buffer, error_filename, error_lineno); php_log_err(tmp_log_message TSRMLS_CC); xdfree(tmp_log_message); if (XG(stack) && XG(stack)->size) { php_log_err("PHP Stack trace:" TSRMLS_CC); for (le = XDEBUG_LLIST_HEAD(XG(stack)); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { int c = 0; /* Comma flag */ int j = 0; /* Counter */ char *tmp_name; xdebug_str log_buffer = {0, 0, NULL}; i = XDEBUG_LLIST_VALP(le); tmp_name = xdebug_show_fname(i->function, 0, 0 TSRMLS_CC); xdebug_str_add(&log_buffer, xdebug_sprintf("PHP %3d. %s(", i->level, tmp_name), 1); xdfree(tmp_name); /* Printing vars */ for (j = 0; j < i->varc; j++) { char *tmp_varname, *tmp_value; if (c) { xdebug_str_addl(&log_buffer, ", ", 2, 0); } else { c = 1; } tmp_varname = i->var[j].name ? xdebug_sprintf("$%s = ", i->var[j].name) : xdstrdup(""); xdebug_str_add(&log_buffer, tmp_varname, 0); xdfree(tmp_varname); if (i->var[j].addr) { tmp_value = xdebug_get_zval_value(i->var[j].addr, 0, NULL); xdebug_str_add(&log_buffer, tmp_value, 0); xdfree(tmp_value); } else { xdebug_str_addl(&log_buffer, "*uninitialized*", 15, 0); } } xdebug_str_add(&log_buffer, xdebug_sprintf(") %s:%d", i->filename, i->lineno), 1); php_log_err(log_buffer.d TSRMLS_CC); xdebug_str_free(&log_buffer); } } } static int create_file_link(char **filename, const char *error_filename, int error_lineno TSRMLS_DC) { xdebug_str fname = {0, 0, NULL}; char *format = XG(file_link_format); while (*format) { if (*format != '%') { xdebug_str_addl(&fname, (char *) format, 1, 0); } else { format++; switch (*format) { case 'f': /* filename */ xdebug_str_add(&fname, xdebug_sprintf("%s", error_filename), 1); break; case 'l': /* line number */ xdebug_str_add(&fname, xdebug_sprintf("%d", error_lineno), 1); break; case '%': /* literal % */ xdebug_str_addl(&fname, "%", 1, 0); break; } } format++; } *filename = fname.d; return fname.l; } void xdebug_append_error_head(xdebug_str *str, int html, char *error_type_str TSRMLS_DC) { char **formats = select_formats(html TSRMLS_CC); if (html) { xdebug_str_add(str, xdebug_sprintf(formats[0], error_type_str, XG(in_at) ? " xe-scream" : ""), 1); if (XG(in_at)) { xdebug_str_add(str, formats[12], 0); } } else { xdebug_str_add(str, formats[0], 0); if (XG(in_at)) { xdebug_str_add(str, formats[10], 0); } } } void xdebug_append_error_description(xdebug_str *str, int html, const char *error_type_str, char *buffer, const char *error_filename, const int error_lineno TSRMLS_DC) { char **formats = select_formats(html TSRMLS_CC); char *escaped; #if PHP_VERSION_ID >= 50400 size_t newlen; #else int newlen; #endif if (html) { escaped = php_escape_html_entities((unsigned char *) buffer, strlen(buffer), &newlen, 0, 0, NULL TSRMLS_CC); } else { escaped = estrdup(buffer); } if (strlen(XG(file_link_format)) > 0 && html) { char *file_link; create_file_link(&file_link, error_filename, error_lineno TSRMLS_CC); xdebug_str_add(str, xdebug_sprintf(formats[11], error_type_str, escaped, file_link, error_filename, error_lineno), 1); xdfree(file_link); } else { xdebug_str_add(str, xdebug_sprintf(formats[1], error_type_str, escaped, error_filename, error_lineno), 1); } efree(escaped); } void xdebug_append_printable_stack(xdebug_str *str, int html TSRMLS_DC) { xdebug_llist_element *le; function_stack_entry *i; int len; char **formats = select_formats(html TSRMLS_CC); if (XG(stack) && XG(stack)->size) { i = XDEBUG_LLIST_VALP(XDEBUG_LLIST_HEAD(XG(stack))); xdebug_str_add(str, formats[2], 0); for (le = XDEBUG_LLIST_HEAD(XG(stack)); le != NULL; le = XDEBUG_LLIST_NEXT(le)) { int c = 0; /* Comma flag */ int j = 0; /* Counter */ char *tmp_name; i = XDEBUG_LLIST_VALP(le); tmp_name = xdebug_show_fname(i->function, html, 0 TSRMLS_CC); if (html) { #if HAVE_PHP_MEMORY_USAGE xdebug_str_add(str, xdebug_sprintf(formats[3], i->level, i->time - XG(start_time), i->memory, tmp_name), 1); #else xdebug_str_add(str, xdebug_sprintf(formats[3], i->level, i->time - XG(start_time), tmp_name), 1); #endif } else { #if HAVE_PHP_MEMORY_USAGE xdebug_str_add(str, xdebug_sprintf(formats[3], i->time - XG(start_time), i->memory, i->level, tmp_name), 1); #else xdebug_str_add(str, xdebug_sprintf(formats[3], i->time - XG(start_time), i->level, tmp_name), 1); #endif } xdfree(tmp_name); /* Printing vars */ for (j = 0; j < i->varc; j++) { char *tmp_value, *tmp_fancy_value, *tmp_fancy_synop_value; int newlen; if (c) { xdebug_str_addl(str, ", ", 2, 0); } else { c = 1; } if (i->var[j].name && XG(collect_params) >= 4) { if (html) { xdebug_str_add(str, xdebug_sprintf("$%s = ", i->var[j].name), 1); } else { xdebug_str_add(str, xdebug_sprintf("$%s = ", i->var[j].name), 1); } } if (i->var[j].addr) { if (html) { tmp_value = xdebug_get_zval_value(i->var[j].addr, 0, NULL); tmp_fancy_value = xdebug_xmlize(tmp_value, strlen(tmp_value), &newlen); tmp_fancy_synop_value = xdebug_get_zval_synopsis_fancy("", i->var[j].addr, &len, 0, NULL TSRMLS_CC); switch (XG(collect_params)) { case 1: /* synopsis */ xdebug_str_add(str, xdebug_sprintf("%s", tmp_fancy_synop_value), 1); break; case 2: /* synopsis + full in tooltip */ xdebug_str_add(str, xdebug_sprintf("%s", tmp_fancy_value, tmp_fancy_synop_value), 1); break; case 3: /* full */ default: xdebug_str_add(str, xdebug_sprintf("%s", tmp_fancy_value), 1); break; } xdfree(tmp_value); efree(tmp_fancy_value); xdfree(tmp_fancy_synop_value); } else { switch (XG(collect_params)) { case 1: /* synopsis */ case 2: tmp_value = xdebug_get_zval_synopsis(i->var[j].addr, 0, NULL); break; case 3: default: tmp_value = xdebug_get_zval_value(i->var[j].addr, 0, NULL); break; } if (tmp_value) { xdebug_str_add(str, xdebug_sprintf("%s", tmp_value), 1); xdfree(tmp_value); } else { xdebug_str_addl(str, "???", 3, 0); } } } else { xdebug_str_addl(str, "???", 3, 0); } } if (i->include_filename) { xdebug_str_add(str, xdebug_sprintf(formats[4], i->include_filename), 1); } if (html) { if (strlen(XG(file_link_format)) > 0) { char *just_filename = strrchr(i->filename, DEFAULT_SLASH); char *file_link; create_file_link(&file_link, i->filename, i->lineno TSRMLS_CC); xdebug_str_add(str, xdebug_sprintf(formats[10], i->filename, file_link, just_filename, i->lineno), 1); xdfree(file_link); } else { char *just_filename = strrchr(i->filename, DEFAULT_SLASH); xdebug_str_add(str, xdebug_sprintf(formats[5], i->filename, just_filename, i->lineno), 1); } } else { xdebug_str_add(str, xdebug_sprintf(formats[5], i->filename, i->lineno), 1); } } if (XG(dump_globals) && !(XG(dump_once) && XG(dumped))) { char *tmp = xdebug_get_printable_superglobals(html TSRMLS_CC); if (tmp) { xdebug_str_add(str, tmp, 1); } XG(dumped) = 1; } if (XG(show_local_vars) && XG(stack) && XDEBUG_LLIST_TAIL(XG(stack))) { int scope_nr = XG(stack)->size; i = XDEBUG_LLIST_VALP(XDEBUG_LLIST_TAIL(XG(stack))); if (i->user_defined == XDEBUG_INTERNAL && XDEBUG_LLIST_PREV(XDEBUG_LLIST_TAIL(XG(stack))) && XDEBUG_LLIST_VALP(XDEBUG_LLIST_PREV(XDEBUG_LLIST_TAIL(XG(stack))))) { i = XDEBUG_LLIST_VALP(XDEBUG_LLIST_PREV(XDEBUG_LLIST_TAIL(XG(stack)))); scope_nr--; } if (i->used_vars && i->used_vars->size) { xdebug_hash *tmp_hash; xdebug_str_add(str, xdebug_sprintf(formats[6], scope_nr), 1); tmp_hash = xdebug_used_var_hash_from_llist(i->used_vars); xdebug_hash_apply_with_argument(tmp_hash, (void*) &html, dump_used_var_with_contents, (void *) str); xdebug_hash_destroy(tmp_hash); } } } } void xdebug_append_error_footer(xdebug_str *str, int html TSRMLS_DC) { char **formats = select_formats(html TSRMLS_CC); xdebug_str_add(str, formats[7], 0); } static char *get_printable_stack(int html, int error_type, char *buffer, const char *error_filename, const int error_lineno TSRMLS_DC) { char *prepend_string; char *append_string; char *error_type_str = xdebug_error_type(error_type); char *error_type_str_simple = xdebug_error_type_simple(error_type); xdebug_str str = {0, 0, NULL}; prepend_string = INI_STR("error_prepend_string"); append_string = INI_STR("error_append_string"); xdebug_str_add(&str, prepend_string ? prepend_string : "", 0); xdebug_append_error_head(&str, html, error_type_str_simple TSRMLS_CC); xdebug_append_error_description(&str, html, error_type_str, buffer, error_filename, error_lineno TSRMLS_CC); xdebug_append_printable_stack(&str, html TSRMLS_CC); xdebug_append_error_footer(&str, html TSRMLS_CC); xdebug_str_add(&str, append_string ? append_string : "", 0); xdfree(error_type_str); xdfree(error_type_str_simple); return str.d; } #define XDEBUG_LOG_PRINT(fs, string, ...) if (fs) { fprintf(fs, string, ## __VA_ARGS__); } void xdebug_init_debugger(TSRMLS_D) { xdebug_open_log(TSRMLS_C); if (XG(remote_connect_back)) { zval **remote_addr = NULL; XDEBUG_LOG_PRINT(XG(remote_log_file), "I: Checking remote connect back address.\n"); if (zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_X_FORWARDED_FOR", 21, (void**)&remote_addr) == FAILURE) { zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "REMOTE_ADDR", 12, (void**)&remote_addr); } if (remote_addr) { XDEBUG_LOG_PRINT(XG(remote_log_file), "I: Remote address found, connecting to %s:%ld.\n", Z_STRVAL_PP(remote_addr), XG(remote_port)); XG(context).socket = xdebug_create_socket(Z_STRVAL_PP(remote_addr), XG(remote_port)); } else { XDEBUG_LOG_PRINT(XG(remote_log_file), "W: Remote address not found, connecting to configured address/port: %s:%ld. :-|\n", XG(remote_host), XG(remote_port)); XG(context).socket = xdebug_create_socket(XG(remote_host), XG(remote_port)); } } else { XDEBUG_LOG_PRINT(XG(remote_log_file), "I: Connecting to configured address/port: %s:%ld.\n", XG(remote_host), XG(remote_port)); XG(context).socket = xdebug_create_socket(XG(remote_host), XG(remote_port)); } if (XG(context).socket >= 0) { XDEBUG_LOG_PRINT(XG(remote_log_file), "I: Connected to client. :-)\n"); XG(remote_enabled) = 0; /* Get handler from mode */ XG(context).handler = xdebug_handler_get(XG(remote_handler)); if (!XG(context).handler) { zend_error(E_WARNING, "The remote debug handler '%s' is not supported.", XG(remote_handler)); XDEBUG_LOG_PRINT(XG(remote_log_file), "E: The remote debug handler '%s' is not supported. :-(\n", XG(remote_handler)); } else if (!XG(context).handler->remote_init(&(XG(context)), XDEBUG_REQ)) { /* The request could not be started, ignore it then */ XDEBUG_LOG_PRINT(XG(remote_log_file), "E: The debug session could not be started. :-(\n"); } else { /* All is well, turn off script time outs */ zend_alter_ini_entry("max_execution_time", sizeof("max_execution_time"), "0", strlen("0"), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); XG(remote_enabled) = 1; } } else { XDEBUG_LOG_PRINT(XG(remote_log_file), "E: Could not connect to client. :-(\n"); } if (!XG(remote_enabled)) { xdebug_close_log(TSRMLS_C); } } void xdebug_do_jit(TSRMLS_D) { if (!XG(remote_enabled) && XG(remote_enable) && (XG(remote_mode) == XDEBUG_JIT)) { xdebug_init_debugger(TSRMLS_C); } } static void php_output_error(const char *error TSRMLS_DC) { #ifdef PHP_DISPLAY_ERRORS_STDERR if (PG(display_errors) == PHP_DISPLAY_ERRORS_STDERR) { fputs(error, stderr); fflush(stderr); return; } #endif php_printf("%s", error); } /* Error callback for formatting stack traces */ void xdebug_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) { char *buffer, *error_type_str; int buffer_len; xdebug_brk_info *extra_brk_info = NULL; error_handling_t error_handling; zend_class_entry *exception_class; TSRMLS_FETCH(); buffer_len = vspprintf(&buffer, PG(log_errors_max_len), format, args); error_type_str = xdebug_error_type(type); /* Store last error message for error_get_last() */ if (PG(last_error_message)) { free(PG(last_error_message)); } if (PG(last_error_file)) { free(PG(last_error_file)); } #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 2) || PHP_MAJOR_VERSION >= 6 PG(last_error_type) = type; #endif PG(last_error_message) = strdup(buffer); PG(last_error_file) = strdup(error_filename); PG(last_error_lineno) = error_lineno; #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) || PHP_MAJOR_VERSION >= 6 error_handling = EG(error_handling); exception_class = EG(exception_class); #else error_handling = PG(error_handling); exception_class = PG(exception_class); #endif /* according to error handling mode, suppress error, throw exception or show it */ if (error_handling != EH_NORMAL && EG(in_execution)) { switch (type) { case E_CORE_ERROR: case E_COMPILE_ERROR: case E_PARSE: /* fatal errors are real errors and cannot be made exceptions */ break; case E_STRICT: /* for the sake of BC to old damaged code */ break; case E_NOTICE: case E_USER_NOTICE: /* notices are no errors and are not treated as such like E_WARNINGS */ break; default: /* throw an exception if we are in EH_THROW mode * but DO NOT overwrite a pending exception */ if (error_handling == EH_THROW && !EG(exception)) { zend_throw_error_exception(exception_class, buffer, 0, type TSRMLS_CC); } efree(buffer); xdfree(error_type_str); return; } } if (EG(error_reporting) & type) { /* Log to logger */ if (PG(log_errors)) { #ifdef PHP_WIN32 if (type==E_CORE_ERROR || type==E_CORE_WARNING) { MessageBox(NULL, buffer, error_type_str, MB_OK|ZEND_SERVICE_MB_STYLE); } #endif xdebug_log_stack(error_type_str, buffer, error_filename, error_lineno TSRMLS_CC); } /* Display errors */ if (PG(display_errors) && !PG(during_request_startup)) { char *printable_stack; /* We need to see if we have an uncaught exception fatal error now */ if (type == E_ERROR && strncmp(buffer, "Uncaught exception", 18) == 0) { xdebug_str str = {0, 0, NULL}; char *tmp_buf, *p; /* find first new line */ p = strchr(buffer, '\n'); if (!p) { p = buffer + strlen(buffer); } else { /* find last quote */ p = ((char *) zend_memrchr(buffer, '\'', p - buffer)) + 1; } /* Create new buffer */ tmp_buf = calloc(p - buffer + 1, 1); strncpy(tmp_buf, buffer, p - buffer ); /* Append error */ xdebug_append_error_head(&str, PG(html_errors), "uncaught-exception" TSRMLS_CC); xdebug_append_error_description(&str, PG(html_errors), error_type_str, tmp_buf, error_filename, error_lineno TSRMLS_CC); xdebug_append_printable_stack(&str, PG(html_errors) TSRMLS_CC); if (XG(last_exception_trace)) { xdebug_str_add(&str, XG(last_exception_trace), 0); } xdebug_append_error_footer(&str, PG(html_errors) TSRMLS_CC); php_output_error(str.d TSRMLS_CC); xdfree(str.d); free(tmp_buf); } else { printable_stack = get_printable_stack(PG(html_errors), type, buffer, error_filename, error_lineno TSRMLS_CC); if (XG(do_collect_errors) && (type != E_ERROR) && (type != E_COMPILE_ERROR) && (type != E_USER_ERROR)) { xdebug_llist_insert_next(XG(collected_errors), XDEBUG_LLIST_TAIL(XG(collected_errors)), printable_stack); } else { php_output_error(printable_stack TSRMLS_CC); xdfree(printable_stack); } } } else if (XG(do_collect_errors)) { char *printable_stack; printable_stack = get_printable_stack(PG(html_errors), type, buffer, error_filename, error_lineno TSRMLS_CC); xdebug_llist_insert_next(XG(collected_errors), XDEBUG_LLIST_TAIL(XG(collected_errors)), printable_stack); } } /* Start JIT if requested and not yet enabled */ xdebug_do_jit(TSRMLS_C); /* Check for the pseudo exceptions to allow breakpoints on PHP error statuses */ if (XG(remote_enabled) && XG(breakpoints_allowed)) { if (xdebug_hash_find(XG(context).exception_breakpoints, error_type_str, strlen(error_type_str), (void *) &extra_brk_info)) { if (xdebug_handle_hit_value(extra_brk_info)) { if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), (char *) error_filename, error_lineno, XDEBUG_BREAK, error_type_str, buffer)) { XG(remote_enabled) = 0; } } } } xdfree(error_type_str); #if PHP_VERSION_ID < 50400 /* Bail out if we can't recover */ switch (type) { case E_CORE_ERROR: /* no break - intentionally */ case E_ERROR: #if PHP_VERSION_ID >= 50200 case E_RECOVERABLE_ERROR: #endif /*case E_PARSE: the parser would return 1 (failure), we can bail out nicely */ case E_COMPILE_ERROR: case E_USER_ERROR: EG(exit_status) = 255; #if HAVE_PHP_MEMORY_USAGE /* restore memory limit */ # if PHP_VERSION_ID >= 50200 zend_set_memory_limit(PG(memory_limit)); # else AG(memory_limit) = PG(memory_limit); # endif #endif zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC); zend_bailout(); return; } #else /* Bail out if we can't recover */ switch (type) { case E_CORE_ERROR: if (!php_get_module_initialized()) { /* bad error in module startup - no way we can live with this */ exit(-2); } case E_ERROR: case E_RECOVERABLE_ERROR: case E_PARSE: case E_COMPILE_ERROR: case E_USER_ERROR: EG(exit_status) = 255; if (php_get_module_initialized()) { if (!PG(display_errors) && !SG(headers_sent) && SG(sapi_headers).http_response_code == 200 ) { sapi_header_line ctr = {0}; ctr.line = "HTTP/1.0 500 Internal Server Error"; ctr.line_len = sizeof("HTTP/1.0 500 Internal Server Error") - 1; sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC); } /* the parser would return 1 (failure), we can bail out nicely */ if (type != E_PARSE) { /* restore memory limit */ zend_set_memory_limit(PG(memory_limit)); zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC); zend_bailout(); return; } } break; } #endif if (PG(track_errors) && EG(active_symbol_table)) { zval *tmp; ALLOC_ZVAL(tmp); INIT_PZVAL(tmp); Z_STRVAL_P(tmp) = (char *) estrndup(buffer, buffer_len); Z_STRLEN_P(tmp) = buffer_len; Z_TYPE_P(tmp) = IS_STRING; zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(zval *), NULL); } efree(buffer); } /* {{{ proto array xdebug_print_function_stack([string message]) Displays a stack trace */ PHP_FUNCTION(xdebug_print_function_stack) { char *message = NULL; int message_len; function_stack_entry *i; char *tmp; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &message, &message_len) == FAILURE) { return; } i = xdebug_get_stack_frame(0 TSRMLS_CC); if (message) { tmp = get_printable_stack(PG(html_errors), 0, message, i->filename, i->lineno TSRMLS_CC); } else { tmp = get_printable_stack(PG(html_errors), 0, "user triggered", i->filename, i->lineno TSRMLS_CC); } php_printf("%s", tmp); xdfree(tmp); } /* }}} */ /* {{{ proto array xdebug_get_formatted_function_stack() Displays a stack trace */ PHP_FUNCTION(xdebug_get_formatted_function_stack) { function_stack_entry *i; char *tmp; i = xdebug_get_stack_frame(0 TSRMLS_CC); tmp = get_printable_stack(PG(html_errors), 0, "user triggered", i->filename, i->lineno TSRMLS_CC); RETVAL_STRING(tmp, 1); xdfree(tmp); } /* }}} */ /* {{{ proto string xdebug_call_class() Returns the name of the calling class */ PHP_FUNCTION(xdebug_call_class) { function_stack_entry *i; long depth = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &depth) == FAILURE) { return; } i = xdebug_get_stack_frame(2 + depth TSRMLS_CC); if (i) { RETURN_STRING(i->function.class ? i->function.class : "", 1); } else { RETURN_FALSE; } } /* }}} */ /* {{{ proto string xdebug_call_function() Returns the function name from which the current function was called from. */ PHP_FUNCTION(xdebug_call_function) { function_stack_entry *i; long depth = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &depth) == FAILURE) { return; } i = xdebug_get_stack_frame(2 + depth TSRMLS_CC); if (i) { RETURN_STRING(i->function.function ? i->function.function : "{}", 1); } else { RETURN_FALSE; } } /* }}} */ /* {{{ proto string xdebug_call_line() Returns the line number where the current function was called from. */ PHP_FUNCTION(xdebug_call_line) { function_stack_entry *i; long depth = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &depth) == FAILURE) { return; } i = xdebug_get_stack_frame(1 + depth TSRMLS_CC); if (i) { RETURN_LONG(i->lineno); } else { RETURN_FALSE; } } /* }}} */ /* {{{ proto int xdebug_call_file() Returns the filename where the current function was called from. */ PHP_FUNCTION(xdebug_call_file) { function_stack_entry *i; long depth = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &depth) == FAILURE) { return; } i = xdebug_get_stack_frame(1 + depth TSRMLS_CC); if (i) { RETURN_STRING(i->filename, 1); } else { RETURN_FALSE; } } /* }}} */ static void xdebug_build_fname(xdebug_func *tmp, zend_execute_data *edata TSRMLS_DC) { memset(tmp, 0, sizeof(xdebug_func)); if (edata) { if (edata->function_state.function->common.function_name) { if (edata->object) { tmp->type = XFUNC_MEMBER; if (edata->function_state.function->common.scope) { /* __autoload has no scope */ tmp->class = xdstrdup(edata->function_state.function->common.scope->name); } } else if (EG(scope) && edata->function_state.function->common.scope && edata->function_state.function->common.scope->name) { tmp->type = XFUNC_STATIC_MEMBER; tmp->class = xdstrdup(edata->function_state.function->common.scope->name); } else { tmp->type = XFUNC_NORMAL; } if (strcmp(edata->function_state.function->common.function_name, "{closure}") == 0) { tmp->function = xdebug_sprintf( "{closure:%s:%d-%d}", edata->function_state.function->op_array.filename, edata->function_state.function->op_array.line_start, edata->function_state.function->op_array.line_end ); } else { tmp->function = xdstrdup(edata->function_state.function->common.function_name); } } else { #if PHP_VERSION_ID >= 50399 switch (edata->opline->extended_value) { #else switch (edata->opline->op2.u.constant.value.lval) { #endif case ZEND_EVAL: tmp->type = XFUNC_EVAL; break; case ZEND_INCLUDE: tmp->type = XFUNC_INCLUDE; break; case ZEND_REQUIRE: tmp->type = XFUNC_REQUIRE; break; case ZEND_INCLUDE_ONCE: tmp->type = XFUNC_INCLUDE_ONCE; break; case ZEND_REQUIRE_ONCE: tmp->type = XFUNC_REQUIRE_ONCE; break; default: tmp->type = XFUNC_UNKNOWN; break; } } } } function_stack_entry *xdebug_add_stack_frame(zend_execute_data *zdata, zend_op_array *op_array, int type TSRMLS_DC) { zend_execute_data *edata; zend_op **opline_ptr = NULL; function_stack_entry *tmp; zend_op *cur_opcode; zval **param; int i = 0; char *aggr_key = NULL; int aggr_key_len = 0; #if PHP_VERSION_ID < 50500 edata = EG(current_execute_data); opline_ptr = EG(opline_ptr); #else if (type == XDEBUG_EXTERNAL) { edata = EG(current_execute_data)->prev_execute_data; if (edata) { opline_ptr = &edata->opline; } } else { edata = EG(current_execute_data); opline_ptr = EG(opline_ptr); } #endif tmp = xdmalloc (sizeof (function_stack_entry)); tmp->var = NULL; tmp->varc = 0; tmp->refcount = 1; tmp->level = XG(level); tmp->arg_done = 0; tmp->used_vars = NULL; tmp->user_defined = type; tmp->filename = NULL; tmp->include_filename = NULL; tmp->profile.call_list = NULL; tmp->op_array = op_array; tmp->symbol_table = NULL; tmp->execute_data = NULL; XG(function_count)++; if (edata && edata->op_array) { /* Normal function calls */ tmp->filename = xdstrdup(edata->op_array->filename); } else if ( edata && edata->prev_execute_data && XDEBUG_LLIST_TAIL(XG(stack)) && ((function_stack_entry*) XDEBUG_LLIST_VALP(XDEBUG_LLIST_TAIL(XG(stack))))->filename ) { tmp->filename = xdstrdup(((function_stack_entry*) XDEBUG_LLIST_VALP(XDEBUG_LLIST_TAIL(XG(stack))))->filename); } if (!tmp->filename) { /* Includes/main script etc */ tmp->filename = (op_array && op_array->filename) ? xdstrdup(op_array->filename): NULL; } /* Call user function locations */ if ( !tmp->filename && XDEBUG_LLIST_TAIL(XG(stack)) && XDEBUG_LLIST_VALP(XDEBUG_LLIST_TAIL(XG(stack))) && ((function_stack_entry*) XDEBUG_LLIST_VALP(XDEBUG_LLIST_TAIL(XG(stack))))->filename ) { tmp->filename = xdstrdup(((function_stack_entry*) XDEBUG_LLIST_VALP(XDEBUG_LLIST_TAIL(XG(stack))))->filename); } if (!tmp->filename) { tmp->filename = xdstrdup("UNKNOWN?"); } #if HAVE_PHP_MEMORY_USAGE tmp->prev_memory = XG(prev_memory); tmp->memory = XG_MEMORY_USAGE(); XG(prev_memory) = tmp->memory; #else tmp->memory = 0; tmp->prev_memory = 0; #endif tmp->time = xdebug_get_utime(); tmp->lineno = 0; tmp->prev = 0; xdebug_build_fname(&(tmp->function), zdata TSRMLS_CC); if (!tmp->function.type) { tmp->function.function = xdstrdup("{main}"); tmp->function.class = NULL; tmp->function.type = XFUNC_NORMAL; } else if (tmp->function.type & XFUNC_INCLUDES) { if (opline_ptr) { cur_opcode = *opline_ptr; tmp->lineno = cur_opcode->lineno; } else { tmp->lineno = 0; } if (tmp->function.type == XFUNC_EVAL) { tmp->include_filename = xdebug_sprintf("%s", XG(last_eval_statement)); } else if (XG(collect_includes)) { tmp->include_filename = xdstrdup(zend_get_executed_filename(TSRMLS_C)); } } else { if (edata->opline) { cur_opcode = edata->opline; if (cur_opcode) { tmp->lineno = cur_opcode->lineno; } } else if (edata->prev_execute_data && edata->prev_execute_data->opline) { cur_opcode = edata->prev_execute_data->opline; if (cur_opcode) { tmp->lineno = cur_opcode->lineno; } } if (XG(remote_enabled) || XG(collect_params) || XG(collect_vars)) { void **p; int arguments_sent = 0, arguments_wanted = 0, arguments_storage = 0; /* This calculates how many arguments where sent to a function. It * works for both internal and user defined functions. * op_array->num_args works only for user defined functions so * we're not using that here. */ #if PHP_VERSION_ID >= 50300 void **curpos = NULL; if ((!edata->opline) || ((edata->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (edata->opline->opcode == ZEND_DO_FCALL))) { curpos = edata->function_state.arguments; arguments_sent = (int)(zend_uintptr_t) *curpos; arguments_wanted = arguments_sent; p = curpos - arguments_sent; } else { p = zend_vm_stack_top(TSRMLS_C) - 1; arguments_sent = (ulong) *p; arguments_wanted = arguments_sent; p = curpos = NULL; } #else if (EG(argument_stack).top >= 2) { p = EG(argument_stack).top_element - 2; arguments_sent = (ulong) *p; arguments_wanted = arguments_sent; } #endif if (tmp->user_defined == XDEBUG_EXTERNAL) { arguments_wanted = op_array->num_args; } if (arguments_wanted > arguments_sent) { arguments_storage = arguments_wanted; } else { arguments_storage = arguments_sent; } tmp->var = xdmalloc(arguments_storage * sizeof (xdebug_var)); for (i = 0; i < arguments_sent; i++) { tmp->var[tmp->varc].name = NULL; tmp->var[tmp->varc].addr = NULL; /* Because it is possible that more parameters are sent, then * actually wanted we can only access the name in case there * is an associated variable to receive the variable here. */ if (tmp->user_defined == XDEBUG_EXTERNAL && i < arguments_wanted) { if (op_array->arg_info[i].name) { tmp->var[tmp->varc].name = xdstrdup(op_array->arg_info[i].name); } } if (XG(collect_params)) { #if PHP_VERSION_ID >= 50300 if (p) { param = (zval **) p++; tmp->var[tmp->varc].addr = *param; } #else param = NULL; if (zend_ptr_stack_get_arg(tmp->varc + 1, (void**) ¶m TSRMLS_CC) == SUCCESS) { if (param) { tmp->var[tmp->varc].addr = *param; } } #endif } tmp->varc++; } /* Sometimes not enough arguments are send to a user defined * function, so we have to gather only the name for those extra. */ if (tmp->user_defined == XDEBUG_EXTERNAL && arguments_sent < arguments_wanted) { for (i = arguments_sent; i < arguments_wanted; i++) { if (op_array->arg_info[i].name) { tmp->var[tmp->varc].name = xdstrdup(op_array->arg_info[i].name); } tmp->var[tmp->varc].addr = NULL; tmp->varc++; } } } } if (XG(do_code_coverage)) { xdebug_count_line(tmp->filename, tmp->lineno, 0, 0 TSRMLS_CC); } if (XG(profiler_aggregate)) { char *func_name = xdebug_show_fname(tmp->function, 0, 0 TSRMLS_CC); aggr_key = xdebug_sprintf("%s.%s.%d", tmp->filename, func_name, tmp->lineno); aggr_key_len = strlen(aggr_key); if (zend_hash_find(&XG(aggr_calls), aggr_key, aggr_key_len+1, (void**)&tmp->aggr_entry) == FAILURE) { xdebug_aggregate_entry xae; if (tmp->user_defined == XDEBUG_EXTERNAL) { xae.filename = xdstrdup(tmp->op_array->filename); } else { xae.filename = xdstrdup("php:internal"); } xae.function = func_name; xae.lineno = tmp->lineno; xae.user_defined = tmp->user_defined; xae.call_count = 0; xae.time_own = 0; xae.time_inclusive = 0; xae.call_list = NULL; zend_hash_add(&XG(aggr_calls), aggr_key, aggr_key_len+1, (void*)&xae, sizeof(xdebug_aggregate_entry), (void**)&tmp->aggr_entry); } } if (XG(stack)) { if (XDEBUG_LLIST_TAIL(XG(stack))) { function_stack_entry *prev = XDEBUG_LLIST_VALP(XDEBUG_LLIST_TAIL(XG(stack))); tmp->prev = prev; if (XG(profiler_aggregate)) { if (prev->aggr_entry->call_list) { if (!zend_hash_exists(prev->aggr_entry->call_list, aggr_key, aggr_key_len+1)) { zend_hash_add(prev->aggr_entry->call_list, aggr_key, aggr_key_len+1, (void*)&tmp->aggr_entry, sizeof(xdebug_aggregate_entry*), NULL); } } else { prev->aggr_entry->call_list = xdmalloc(sizeof(HashTable)); zend_hash_init_ex(prev->aggr_entry->call_list, 1, NULL, NULL, 1, 0); zend_hash_add(prev->aggr_entry->call_list, aggr_key, aggr_key_len+1, (void*)&tmp->aggr_entry, sizeof(xdebug_aggregate_entry*), NULL); } } } xdebug_llist_insert_next(XG(stack), XDEBUG_LLIST_TAIL(XG(stack)), tmp); } if (XG(profiler_aggregate)) { xdfree(aggr_key); } return tmp; } int xdebug_handle_hit_value(xdebug_brk_info *brk_info) { /* If this is a temporary breakpoint, disable the breakpoint */ if (brk_info->temporary) { brk_info->disabled = 1; } /* Increase hit counter */ brk_info->hit_count++; /* If the hit_value is 0, the condition check is disabled */ if (!brk_info->hit_value) { return 1; } switch (brk_info->hit_condition) { case XDEBUG_HIT_GREATER_EQUAL: if (brk_info->hit_count >= brk_info->hit_value) { return 1; } break; case XDEBUG_HIT_EQUAL: if (brk_info->hit_count == brk_info->hit_value) { return 1; } break; case XDEBUG_HIT_MOD: if (brk_info->hit_count % brk_info->hit_value == 0) { return 1; } break; case XDEBUG_HIT_DISABLED: return 1; break; } return 0; } /* {{{ proto integet xdebug_get_stack_depth() Returns the stack depth */ PHP_FUNCTION(xdebug_get_stack_depth) { /* We substract one so that the function call to xdebug_get_stack_depth() * is not part of the returned depth. */ RETURN_LONG(XG(stack)->size - 1); } /* {{{ proto array xdebug_get_function_stack() Returns an array representing the current stack */ PHP_FUNCTION(xdebug_get_function_stack) { xdebug_llist_element *le; int j; unsigned int k; zval *frame; zval *params; char *argument; array_init(return_value); le = XDEBUG_LLIST_HEAD(XG(stack)); for (k = 0; k < XG(stack)->size - 1; k++, le = XDEBUG_LLIST_NEXT(le)) { function_stack_entry *i = XDEBUG_LLIST_VALP(le); if (i->function.function) { if (strcmp(i->function.function, "xdebug_get_function_stack") == 0) { return; } } /* Initialize frame array */ MAKE_STD_ZVAL(frame); array_init(frame); /* Add data */ if (i->function.function) { add_assoc_string_ex(frame, "function", sizeof("function"), i->function.function, 1); } if (i->function.class) { add_assoc_string_ex(frame, "type", sizeof("type"), i->function.type == XFUNC_STATIC_MEMBER ? "static" : "dynamic", 1); add_assoc_string_ex(frame, "class", sizeof("class"), i->function.class, 1); } add_assoc_string_ex(frame, "file", sizeof("file"), i->filename, 1); add_assoc_long_ex(frame, "line", sizeof("line"), i->lineno); /* Add parameters */ MAKE_STD_ZVAL(params); array_init(params); for (j = 0; j < i->varc; j++) { if (i->var[j].addr) { argument = xdebug_get_zval_value(i->var[j].addr, 0, NULL); } else { argument = xdstrdup(""); } if (i->var[j].name) { add_assoc_string_ex(params, i->var[j].name, strlen(i->var[j].name) + 1, argument, 1); } else { add_index_string(params, j, argument, 1); } xdfree(argument); } add_assoc_zval_ex(frame, "params", sizeof("params"), params); if (i->include_filename) { add_assoc_string_ex(frame, "include_filename", sizeof("include_filename"), i->include_filename, 1); } add_next_index_zval(return_value, frame); } } /* }}} */ void xdebug_attach_used_var_names(void *return_value, xdebug_hash_element *he) { char *name = (char*) he->ptr; add_next_index_string(return_value, name, 1); } /* {{{ proto array xdebug_get_declared_vars() Returns an array representing the current stack */ PHP_FUNCTION(xdebug_get_declared_vars) { xdebug_llist_element *le; function_stack_entry *i; xdebug_hash *tmp_hash; array_init(return_value); le = XDEBUG_LLIST_TAIL(XG(stack)); le = XDEBUG_LLIST_PREV(le); i = XDEBUG_LLIST_VALP(le); /* Add declared vars */ if (i->used_vars) { tmp_hash = xdebug_used_var_hash_from_llist(i->used_vars); xdebug_hash_apply(tmp_hash, (void *) return_value, xdebug_attach_used_var_names); xdebug_hash_destroy(tmp_hash); } } /* }}} */ xdebug-2.2.3/xdebug_stack.h0000644000175000017500000000365012147043204015075 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #ifndef XDEBUG_STACK_H #define XDEBUG_STACK_H #include "xdebug_str.h" function_stack_entry *xdebug_add_stack_frame(zend_execute_data *zdata, zend_op_array *op_array, int type TSRMLS_DC); void xdebug_append_error_head(xdebug_str *str, int html, char *error_type_str TSRMLS_DC); void xdebug_append_error_description(xdebug_str *str, int html, const char *error_type_str, char *buffer, const char *error_filename, const int error_lineno TSRMLS_DC); void xdebug_append_printable_stack(xdebug_str *str, int html TSRMLS_DC); void xdebug_append_error_footer(xdebug_str *str, int html TSRMLS_DC); void xdebug_log_stack(const char *error_type_str, char *buffer, const char *error_filename, const int error_lineno TSRMLS_DC); void xdebug_do_jit(TSRMLS_D); int xdebug_handle_hit_value(xdebug_brk_info *brk_info); #endif xdebug-2.2.3/xdebug_str.c0000644000175000017500000000626212147043204014575 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #include #include #include #include #include #include "php.h" #include "ext/standard/php_string.h" #include "xdebug_mm.h" #include "xdebug_str.h" void xdebug_str_add(xdebug_str *xs, char *str, int f) { int l = strlen(str); if (xs->l + l > xs->a - 1) { xs->d = xdrealloc(xs->d, xs->a + l + XDEBUG_STR_PREALLOC); xs->a = xs->a + l + XDEBUG_STR_PREALLOC; } if (!xs->l) { xs->d[0] = '\0'; } memcpy(xs->d + xs->l, str, l); xs->d[xs->l + l] = '\0'; xs->l = xs->l + l; if (f) { xdfree(str); } } void xdebug_str_addl(xdebug_str *xs, char *str, int le, int f) { if (xs->l + le > xs->a - 1) { xs->d = xdrealloc(xs->d, xs->a + le + XDEBUG_STR_PREALLOC); xs->a = xs->a + le + XDEBUG_STR_PREALLOC; } if (!xs->l) { xs->d[0] = '\0'; } memcpy(xs->d + xs->l, str, le); xs->d[xs->l + le] = '\0'; xs->l = xs->l + le; if (f) { xdfree(str); } } void xdebug_str_chop(xdebug_str *xs, int c) { if (c > xs->l) { /* Do nothing if the chop amount is larger than the buffer size */ } else { xs->l -= c; xs->d[xs->l] = '\0'; } } void xdebug_str_free(xdebug_str *s) { if (s->d) { xdfree(s->d); } } char *xdebug_sprintf(const char* fmt, ...) { char *new_str; int size = 1; va_list args; char *orig_locale; orig_locale = xdstrdup(setlocale(LC_ALL, NULL)); setlocale(LC_ALL, "C"); new_str = (char *) xdmalloc(size); for (;;) { int n; va_start(args, fmt); n = vsnprintf(new_str, size, fmt, args); va_end(args); if (n > -1 && n < size) { break; } if (n < 0) { size *= 2; } else { size = n + 1; } new_str = (char *) xdrealloc(new_str, size); } setlocale(LC_ALL, orig_locale); xdfree(orig_locale); return new_str; } /** * Duplicate zend_strndup in core to avoid mismatches * in C-runtime libraries when xdebug and core are built * with different run-time libraries. */ char *xdebug_strndup(const char *s, int length) { char *p; p = (char *) xdmalloc(length + 1); if (p == NULL) { return p; } if (length) { memcpy(p, s, length); } p[length] = 0; return p; } xdebug-2.2.3/xdebug_str.h0000644000175000017500000000350412147043204014576 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #ifndef __HAVE_XDEBUG_STR_H__ #define __HAVE_XDEBUG_STR_H__ #include "xdebug_mm.h" #define XDEBUG_STR_PREALLOC 1024 #define xdebug_str_ptr_init(str) str = xdmalloc(sizeof(xdebug_str)); str->l = 0; str->a = 0; str->d = NULL; #define xdebug_str_ptr_dtor(str) xdfree(str->d); xdfree(str) #define xdebug_str_dtor(str) xdfree(str.d) typedef struct xdebug_str { int l; int a; char *d; } xdebug_str; void xdebug_str_add(xdebug_str *xs, char *str, int f); void xdebug_str_addl(xdebug_str *xs, char *str, int le, int f); void xdebug_str_chop(xdebug_str *xs, int c); void xdebug_str_free(xdebug_str *s); char* xdebug_sprintf (const char* fmt, ...); char* xdebug_strndup(const char *s, int length); #endif xdebug-2.2.3/xdebug_superglobals.c0000644000175000017500000001477512147043204016477 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Harald Radi | +----------------------------------------------------------------------+ */ #include "php_xdebug.h" #include "xdebug_private.h" #include "xdebug_var.h" #include "xdebug_compat.h" #include "xdebug_superglobals.h" #include "SAPI.h" extern ZEND_DECLARE_MODULE_GLOBALS(xdebug); void xdebug_superglobals_dump_dtor(void *user, void *ptr) { free(ptr); } static void dump_hash_elem(zval *z, char *name, long index, char *elem, int html, xdebug_str *str TSRMLS_DC) { int len; if (html) { if (elem) { xdebug_str_add(str, xdebug_sprintf("
$%s['%s'] =
", name, elem), 1); } else { xdebug_str_add(str, xdebug_sprintf("
$%s[%ld] =
", name, index), 1); } } if (z != NULL) { char *val; if (html) { val = xdebug_get_zval_value_fancy(NULL, z, &len, 0, NULL TSRMLS_CC); #if HAVE_PHP_MEMORY_USAGE xdebug_str_add(str, xdebug_sprintf(""), 1); #else xdebug_str_add(str, xdebug_sprintf(""), 1); #endif xdebug_str_addl(str, val, len, 0); xdebug_str_add(str, "", 0); } else { val = xdebug_get_zval_value(z, 0, NULL); xdebug_str_add(str, xdebug_sprintf("\n $%s['%s'] = %s", name, elem, val), 1); } xdfree(val); } else { /* not found */ if (html) { #if HAVE_PHP_MEMORY_USAGE xdebug_str_add(str, "undefined", 0); #else xdebug_str_add(str, "undefined", 0); #endif } else { xdebug_str_add(str, xdebug_sprintf("\n $%s['%s'] is undefined", name, elem), 1); } } if (html) { xdebug_str_add(str, "\n", 0); } } static int dump_hash_elem_va(void *pDest XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { int html; char *name; xdebug_str *str; #if defined(ZTS) && (!defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300) void ***tsrm_ls; #endif name = va_arg(args, char *); html = va_arg(args, int); str = va_arg(args, xdebug_str *); #if defined(ZTS) && (!defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300) tsrm_ls = va_arg(args, void ***); #endif if (hash_key->nKeyLength == 0) { dump_hash_elem(*((zval **) pDest), name, hash_key->h, NULL, html, str TSRMLS_CC); } else { dump_hash_elem(*((zval **) pDest), name, 0, (char *) hash_key->arKey, html, str TSRMLS_CC); } return SUCCESS; } static void dump_hash(xdebug_llist *l, char *name, int name_len, int html, xdebug_str *str TSRMLS_DC) { zval **z; HashTable *ht = NULL; xdebug_llist_element *elem; if (!XDEBUG_LLIST_COUNT(l)) { return; } if (zend_hash_find(&EG(symbol_table), name, name_len, (void **) &z) == SUCCESS) { if (Z_TYPE_PP(z) == IS_ARRAY) { ht = Z_ARRVAL_PP(z); } } if (html) { #if HAVE_PHP_MEMORY_USAGE xdebug_str_add(str, xdebug_sprintf("Dump $%s\n", name), 1); #else xdebug_str_add(str, xdebug_sprintf("Dump $%s\n", name), 1); #endif } else { xdebug_str_add(str, xdebug_sprintf("\nDump $%s", name), 1); } elem = XDEBUG_LLIST_HEAD(l); while (elem != NULL) { if (ht && (*((char *) (elem->ptr)) == '*')) { #if defined(ZTS) && (!defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300) zend_hash_apply_with_arguments(ht, dump_hash_elem_va, 4, name, html, str TSRMLS_CC); #else zend_hash_apply_with_arguments(ht TSRMLS_CC, dump_hash_elem_va, 3, name, html, str); #endif } else if (ht && zend_hash_find(ht, elem->ptr, strlen(elem->ptr) + 1, (void **) &z) == SUCCESS) { dump_hash_elem(*z, name, 0, elem->ptr, html, str TSRMLS_CC); } else if(XG(dump_undefined)) { dump_hash_elem(NULL, name, 0, elem->ptr, html, str TSRMLS_CC); } elem = XDEBUG_LLIST_NEXT(elem); } } char* xdebug_get_printable_superglobals(int html TSRMLS_DC) { xdebug_str str = {0, 0, NULL}; dump_hash(&XG(server), "_SERVER", 8, html, &str TSRMLS_CC); dump_hash(&XG(get), "_GET", 5, html, &str TSRMLS_CC); dump_hash(&XG(post), "_POST", 6, html, &str TSRMLS_CC); dump_hash(&XG(cookie), "_COOKIE", 8, html, &str TSRMLS_CC); dump_hash(&XG(files), "_FILES", 7, html, &str TSRMLS_CC); dump_hash(&XG(env), "_ENV", 5, html, &str TSRMLS_CC); dump_hash(&XG(session), "_SESSION", 9, html, &str TSRMLS_CC); dump_hash(&XG(request), "_REQUEST", 9, html, &str TSRMLS_CC); return str.d; } void xdebug_superglobals_dump_tok(xdebug_llist *l, char *str) { char *tok, *sep = ","; tok = strtok(str, sep); while (tok != NULL) { char *p = tok + strlen(tok) - 1; while ((*tok == ' ') || (*tok == '\t')) { tok++; } while ((p > tok) && ((*p == ' ') || (*p == '\t'))) { p--; } *(p+1) = 0; /* we need to strdup each element so that we can safely free it */ xdebug_llist_insert_next(l, NULL, strdup(tok)); tok = strtok(NULL, sep); } } PHP_FUNCTION(xdebug_dump_superglobals) { int html = PG(html_errors); char *superglobal_info = NULL; if (html) { php_printf("\n"); } superglobal_info = xdebug_get_printable_superglobals(html TSRMLS_CC); if (superglobal_info) { php_printf("%s", xdebug_get_printable_superglobals(html TSRMLS_CC)); } else { php_printf("\n"); } if (html) { php_printf("
No information about superglobals is available or configured.
\n"); } } xdebug-2.2.3/xdebug_superglobals.h0000644000175000017500000000326512147043204016474 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Harald Radi | +----------------------------------------------------------------------+ */ #ifndef __HAVE_XDEBUG_SUPERGLOBALS_H__ #define __HAVE_XDEBUG_SUPERGLOBALS_H__ #include "php.h" void xdebug_superglobals_dump_dtor(void *, void*); char *xdebug_get_printable_superglobals(int html TSRMLS_DC); void xdebug_superglobals_dump_tok(xdebug_llist *l, char *str); #define DUMP_TOK(__llist) \ xdebug_llist_empty(&XG(__llist), NULL); \ if (new_value && *new_value) { \ char *str = estrndup(new_value, new_value_length); \ xdebug_superglobals_dump_tok(&XG(__llist), str); \ efree(str); \ } \ return SUCCESS; #endif /* __HAVE_XDEBUG_SUPERGLOBALS_H__ */ xdebug-2.2.3/xdebug_tracing.c0000644000175000017500000003540312147043204015413 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #include "php_xdebug.h" #include "xdebug_private.h" #include "xdebug_str.h" #include "xdebug_tracing.h" #include "xdebug_var.h" #include "ext/standard/php_string.h" ZEND_EXTERN_MODULE_GLOBALS(xdebug) static char* return_trace_stack_frame_begin(function_stack_entry* i, int fnr TSRMLS_DC); static char* return_trace_stack_frame_end(function_stack_entry* i, int fnr TSRMLS_DC); void xdebug_trace_function_begin(function_stack_entry *fse, int function_nr TSRMLS_DC) { if (XG(do_trace) && XG(trace_file)) { char *t = return_trace_stack_frame_begin(fse, function_nr TSRMLS_CC); if (fprintf(XG(trace_file), "%s", t) < 0) { fclose(XG(trace_file)); XG(trace_file) = NULL; } else { fflush(XG(trace_file)); } xdfree(t); } } void xdebug_trace_function_end(function_stack_entry *fse, int function_nr TSRMLS_DC) { if (XG(do_trace) && XG(trace_file)) { char *t = return_trace_stack_frame_end(fse, function_nr TSRMLS_CC); if (fprintf(XG(trace_file), "%s", t) < 0) { fclose(XG(trace_file)); XG(trace_file) = NULL; } else { fflush(XG(trace_file)); } xdfree(t); } } char* xdebug_return_trace_assignment(function_stack_entry *i, char *varname, zval *retval, char *op, char *filename, int lineno TSRMLS_DC) { int j = 0; xdebug_str str = {0, 0, NULL}; char *tmp_value; if (XG(trace_format) != 0) { return xdstrdup(""); } xdebug_str_addl(&str, " ", 20, 0); if (XG(show_mem_delta)) { xdebug_str_addl(&str, " ", 8, 0); } for (j = 0; j <= i->level; j++) { xdebug_str_addl(&str, " ", 2, 0); } xdebug_str_addl(&str, " => ", 6, 0); xdebug_str_add(&str, varname, 0); if (op[0] != '\0' ) { /* pre/post inc/dec ops are special */ xdebug_str_add(&str, xdebug_sprintf(" %s ", op), 1); tmp_value = xdebug_get_zval_value(retval, 0, NULL); if (tmp_value) { xdebug_str_add(&str, tmp_value, 1); } else { xdebug_str_addl(&str, "NULL", 4, 0); } } xdebug_str_add(&str, xdebug_sprintf(" %s:%d\n", filename, lineno), 1); return str.d; } static void xdebug_return_trace_stack_common(xdebug_str *str, function_stack_entry *i TSRMLS_DC) { int j = 0; /* Counter */ xdebug_str_addl(str, " ", 20, 0); if (XG(show_mem_delta)) { xdebug_str_addl(str, " ", 8, 0); } for (j = 0; j < i->level; j++) { xdebug_str_addl(str, " ", 2, 0); } xdebug_str_addl(str, " >=> ", 7, 0); } char* xdebug_return_trace_stack_retval(function_stack_entry* i, zval* retval TSRMLS_DC) { xdebug_str str = {0, 0, NULL}; char *tmp_value; if (XG(trace_format) != 0) { return xdstrdup(""); } xdebug_return_trace_stack_common(&str, i TSRMLS_CC); tmp_value = xdebug_get_zval_value(retval, 0, NULL); if (tmp_value) { xdebug_str_add(&str, tmp_value, 1); } xdebug_str_addl(&str, "\n", 2, 0); return str.d; } #if PHP_VERSION_ID >= 50500 char* xdebug_return_trace_stack_generator_retval(function_stack_entry* i, zend_generator* generator TSRMLS_DC) { xdebug_str str = {0, 0, NULL}; char *tmp_value = NULL; if (XG(trace_format) != 0) { return xdstrdup(""); } /* Generator key */ tmp_value = xdebug_get_zval_value(generator->key, 0, NULL); if (tmp_value) { xdebug_return_trace_stack_common(&str, i TSRMLS_CC); xdebug_str_addl(&str, "(", 1, 0); xdebug_str_add(&str, tmp_value, 1); xdebug_str_addl(&str, " => ", 4, 0); tmp_value = xdebug_get_zval_value(generator->value, 0, NULL); if (tmp_value) { xdebug_str_add(&str, tmp_value, 1); } xdebug_str_addl(&str, ")", 1, 0); xdebug_str_addl(&str, "\n", 2, 0); return str.d; } else { return xdstrdup(""); } } #endif static char* return_trace_stack_frame_begin_normal(function_stack_entry* i TSRMLS_DC) { int c = 0; /* Comma flag */ int j = 0; /* Counter */ char *tmp_name; xdebug_str str = {0, 0, NULL}; tmp_name = xdebug_show_fname(i->function, 0, 0 TSRMLS_CC); xdebug_str_add(&str, xdebug_sprintf("%10.4f ", i->time - XG(start_time)), 1); xdebug_str_add(&str, xdebug_sprintf("%10lu ", i->memory), 1); if (XG(show_mem_delta)) { xdebug_str_add(&str, xdebug_sprintf("%+8ld ", i->memory - i->prev_memory), 1); } for (j = 0; j < i->level; j++) { xdebug_str_addl(&str, " ", 2, 0); } xdebug_str_add(&str, xdebug_sprintf("-> %s(", tmp_name), 1); xdfree(tmp_name); /* Printing vars */ if (XG(collect_params) > 0) { for (j = 0; j < i->varc; j++) { char *tmp_value; if (c) { xdebug_str_addl(&str, ", ", 2, 0); } else { c = 1; } if (i->var[j].name && XG(collect_params) >= 4) { xdebug_str_add(&str, xdebug_sprintf("$%s = ", i->var[j].name), 1); } switch (XG(collect_params)) { case 1: /* synopsis */ case 2: tmp_value = xdebug_get_zval_synopsis(i->var[j].addr, 0, NULL); break; case 3: default: tmp_value = xdebug_get_zval_value(i->var[j].addr, 0, NULL); break; } if (tmp_value) { xdebug_str_add(&str, tmp_value, 1); } else { xdebug_str_add(&str, "???", 0); } } } if (i->include_filename) { if (i->function.type == XFUNC_EVAL) { int tmp_len; char *escaped; escaped = php_addcslashes(i->include_filename, strlen(i->include_filename), &tmp_len, 0, "'\\\0..\37", 6 TSRMLS_CC); xdebug_str_add(&str, xdebug_sprintf("'%s'", escaped), 1); efree(escaped); } else { xdebug_str_add(&str, i->include_filename, 0); } } xdebug_str_add(&str, xdebug_sprintf(") %s:%d\n", i->filename, i->lineno), 1); return str.d; } #define return_trace_stack_frame_begin_computerized(i,f) return_trace_stack_frame_computerized((i), (f), 0 TSRMLS_CC) #define return_trace_stack_frame_end_computerized(i,f) return_trace_stack_frame_computerized((i), (f), 1 TSRMLS_CC) static char* return_trace_stack_frame_computerized(function_stack_entry* i, int fnr, int whence TSRMLS_DC) { char *tmp_name; xdebug_str str = {0, 0, NULL}; xdebug_str_add(&str, xdebug_sprintf("%d\t", i->level), 1); xdebug_str_add(&str, xdebug_sprintf("%d\t", fnr), 1); if (whence == 0) { /* start */ tmp_name = xdebug_show_fname(i->function, 0, 0 TSRMLS_CC); xdebug_str_add(&str, "0\t", 0); xdebug_str_add(&str, xdebug_sprintf("%f\t", i->time - XG(start_time)), 1); #if HAVE_PHP_MEMORY_USAGE xdebug_str_add(&str, xdebug_sprintf("%lu\t", i->memory), 1); #else xdebug_str_add(&str, "\t", 0); #endif xdebug_str_add(&str, xdebug_sprintf("%s\t", tmp_name), 1); xdebug_str_add(&str, xdebug_sprintf("%d\t", i->user_defined == XDEBUG_EXTERNAL ? 1 : 0), 1); xdfree(tmp_name); if (i->include_filename) { if (i->function.type == XFUNC_EVAL) { int tmp_len; char *escaped; escaped = php_addcslashes(i->include_filename, strlen(i->include_filename), &tmp_len, 0, "'\\\0..\37", 6 TSRMLS_CC); xdebug_str_add(&str, xdebug_sprintf("'%s'", escaped), 1); efree(escaped); } else { xdebug_str_add(&str, i->include_filename, 0); } } /* Filename and Lineno (9, 10) */ xdebug_str_add(&str, xdebug_sprintf("\t%s\t%d", i->filename, i->lineno), 1); if (XG(collect_params) > 0) { int j = 0; /* Counter */ /* Nr of arguments (11) */ xdebug_str_add(&str, xdebug_sprintf("\t%d", i->varc), 1); /* Arguments (12-...) */ for (j = 0; j < i->varc; j++) { char *tmp_value; xdebug_str_addl(&str, "\t", 1, 0); if (i->var[j].name && XG(collect_params) >= 4) { xdebug_str_add(&str, xdebug_sprintf("$%s = ", i->var[j].name), 1); } switch (XG(collect_params)) { case 1: /* synopsis */ case 2: tmp_value = xdebug_get_zval_synopsis(i->var[j].addr, 0, NULL); break; case 3: default: tmp_value = xdebug_get_zval_value(i->var[j].addr, 0, NULL); break; } if (tmp_value) { xdebug_str_add(&str, tmp_value, 1); } else { xdebug_str_add(&str, "???", 0); } } } /* Trailing \n */ xdebug_str_add(&str, "\n", 0); } else if (whence == 1) { /* end */ xdebug_str_add(&str, "1\t", 0); xdebug_str_add(&str, xdebug_sprintf("%f\t", xdebug_get_utime() - XG(start_time)), 1); #if HAVE_PHP_MEMORY_USAGE xdebug_str_add(&str, xdebug_sprintf("%lu\n", XG_MEMORY_USAGE()), 1); #else xdebug_str_add(&str, "\n", 0); #endif } return str.d; } static char* return_trace_stack_frame_begin_html(function_stack_entry* i, int fnr TSRMLS_DC) { char *tmp_name; int j; xdebug_str str = {0, 0, NULL}; xdebug_str_add(&str, "\t", 0); xdebug_str_add(&str, xdebug_sprintf("%d", fnr), 1); xdebug_str_add(&str, xdebug_sprintf("%0.6f", i->time - XG(start_time)), 1); #if HAVE_PHP_MEMORY_USAGE xdebug_str_add(&str, xdebug_sprintf("%lu", i->memory), 1); #endif xdebug_str_add(&str, "", 0); for (j = 0; j < i->level - 1; j++) { xdebug_str_add(&str, "   ", 0); } xdebug_str_add(&str, "->", 0); tmp_name = xdebug_show_fname(i->function, 0, 0 TSRMLS_CC); xdebug_str_add(&str, xdebug_sprintf("%s(", tmp_name), 1); xdfree(tmp_name); if (i->include_filename) { if (i->function.type == XFUNC_EVAL) { char *joined; xdebug_arg *parts = (xdebug_arg*) xdmalloc(sizeof(xdebug_arg)); xdebug_arg_init(parts); xdebug_explode("\n", i->include_filename, parts, 99999); joined = xdebug_join("
", parts, 0, 99999); xdebug_arg_dtor(parts); xdebug_str_add(&str, xdebug_sprintf("'%s'", joined), 1); xdfree(joined); } else { xdebug_str_add(&str, i->include_filename, 0); } } xdebug_str_add(&str, xdebug_sprintf(")%s:%d", i->filename, i->lineno), 1); xdebug_str_add(&str, "\n", 0); return str.d; } static char* return_trace_stack_frame_begin(function_stack_entry* i, int fnr TSRMLS_DC) { switch (XG(trace_format)) { case 0: return return_trace_stack_frame_begin_normal(i TSRMLS_CC); case 1: return return_trace_stack_frame_begin_computerized(i, fnr); case 2: return return_trace_stack_frame_begin_html(i, fnr TSRMLS_CC); default: return xdstrdup(""); } } static char* return_trace_stack_frame_end(function_stack_entry* i, int fnr TSRMLS_DC) { switch (XG(trace_format)) { case 1: return return_trace_stack_frame_end_computerized(i, fnr); default: return xdstrdup(""); } } PHP_FUNCTION(xdebug_start_trace) { char *fname = NULL; int fname_len = 0; char *trace_fname; long options = XG(trace_options); if (XG(do_trace) == 0) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sl", &fname, &fname_len, &options) == FAILURE) { return; } if ((trace_fname = xdebug_start_trace(fname, options TSRMLS_CC)) != NULL) { XG(do_trace) = 1; RETVAL_STRING(trace_fname, 1); xdfree(trace_fname); return; } else { php_error(E_NOTICE, "Trace could not be started"); } XG(do_trace) = 0; RETURN_FALSE; } else { php_error(E_NOTICE, "Function trace already started"); RETURN_FALSE; } } char* xdebug_start_trace(char* fname, long options TSRMLS_DC) { char *str_time; char *filename; char *tmp_fname = NULL; if (fname && strlen(fname)) { filename = xdstrdup(fname); } else { if (!strlen(XG(trace_output_name)) || xdebug_format_output_filename(&fname, XG(trace_output_name), NULL) <= 0 ) { /* Invalid or empty xdebug.trace_output_name */ return NULL; } if (IS_SLASH(XG(trace_output_dir)[strlen(XG(trace_output_dir)) - 1])) { filename = xdebug_sprintf("%s%s", XG(trace_output_dir), fname); } else { filename = xdebug_sprintf("%s%c%s", XG(trace_output_dir), DEFAULT_SLASH, fname); } xdfree(fname); } if (options & XDEBUG_TRACE_OPTION_APPEND) { XG(trace_file) = xdebug_fopen(filename, "a", "xt", (char**) &tmp_fname); } else { XG(trace_file) = xdebug_fopen(filename, "w", "xt", (char**) &tmp_fname); } xdfree(filename); if (options & XDEBUG_TRACE_OPTION_COMPUTERIZED) { XG(trace_format) = 1; } if (options & XDEBUG_TRACE_OPTION_HTML) { XG(trace_format) = 2; } if (XG(trace_file)) { if (XG(trace_format) == 1) { fprintf(XG(trace_file), "Version: %s\n", XDEBUG_VERSION); fprintf(XG(trace_file), "File format: 2\n"); } if (XG(trace_format) == 0 || XG(trace_format) == 1) { str_time = xdebug_get_time(); fprintf(XG(trace_file), "TRACE START [%s]\n", str_time); xdfree(str_time); } if (XG(trace_format) == 2) { fprintf(XG(trace_file), "\n"); fprintf(XG(trace_file), "\t"); #if HAVE_PHP_MEMORY_USAGE fprintf(XG(trace_file), ""); #endif fprintf(XG(trace_file), "\n"); } XG(do_trace) = 1; XG(tracefile_name) = tmp_fname; return xdstrdup(XG(tracefile_name)); } return NULL; } void xdebug_stop_trace(TSRMLS_D) { char *str_time; double u_time; char *tmp; XG(do_trace) = 0; if (XG(trace_file)) { if (XG(trace_format) == 0 || XG(trace_format) == 1) { u_time = xdebug_get_utime(); tmp = xdebug_sprintf(XG(trace_format) == 0 ? "%10.4f " : "\t\t\t%f\t", u_time - XG(start_time)); fprintf(XG(trace_file), "%s", tmp); xdfree(tmp); #if HAVE_PHP_MEMORY_USAGE fprintf(XG(trace_file), XG(trace_format) == 0 ? "%10zu" : "%lu", XG_MEMORY_USAGE()); #else fprintf(XG(trace_file), XG(trace_format) == 0 ? "%10u" : "", 0); #endif fprintf(XG(trace_file), "\n"); str_time = xdebug_get_time(); fprintf(XG(trace_file), "TRACE END [%s]\n\n", str_time); xdfree(str_time); } if (XG(trace_format) == 2) { fprintf(XG(trace_file), "
#TimeMemFunctionLocation
\n"); } fclose(XG(trace_file)); XG(trace_file) = NULL; } if (XG(tracefile_name)) { xdfree(XG(tracefile_name)); XG(tracefile_name) = NULL; } } PHP_FUNCTION(xdebug_stop_trace) { if (XG(do_trace) == 1) { RETVAL_STRING(XG(tracefile_name), 1); xdebug_stop_trace(TSRMLS_C); } else { RETVAL_FALSE; php_error(E_NOTICE, "Function trace was not started"); } } PHP_FUNCTION(xdebug_get_tracefile_name) { if (XG(tracefile_name)) { RETURN_STRING(XG(tracefile_name), 1); } else { RETURN_FALSE; } } xdebug-2.2.3/xdebug_tracing.h0000644000175000017500000000333212147043204015414 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #ifndef XDEBUG_TRACING_H #define XDEBUG_TRACING_H char* xdebug_return_trace_stack_retval(function_stack_entry* i, zval* retval TSRMLS_DC); #if PHP_VERSION_ID >= 50500 char* xdebug_return_trace_stack_generator_retval(function_stack_entry* i, zend_generator* generator TSRMLS_DC); #endif char* xdebug_return_trace_assignment(function_stack_entry *i, char *varname, zval *retval, char *op, char *file, int fileno TSRMLS_DC); void xdebug_trace_function_begin(function_stack_entry *fse, int function_nr TSRMLS_DC); void xdebug_trace_function_end(function_stack_entry *fse, int function_nr TSRMLS_DC); #endif xdebug-2.2.3/xdebug_var.c0000644000175000017500000016470112147043204014560 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #include "php.h" #include "ext/standard/php_string.h" #include "ext/standard/url.h" #include "zend.h" #include "zend_extensions.h" #include "php_xdebug.h" #include "xdebug_compat.h" #include "xdebug_private.h" #include "xdebug_mm.h" #include "xdebug_var.h" #include "xdebug_xml.h" ZEND_EXTERN_MODULE_GLOBALS(xdebug) char* xdebug_error_type_simple(int type) { switch (type) { case E_ERROR: case E_CORE_ERROR: case E_COMPILE_ERROR: case E_USER_ERROR: return xdstrdup("fatal-error"); break; #if PHP_VERSION_ID >= 50200 case E_RECOVERABLE_ERROR: return xdstrdup("catchable-fatal-error"); break; #endif case E_WARNING: case E_CORE_WARNING: case E_COMPILE_WARNING: case E_USER_WARNING: return xdstrdup("warning"); break; case E_PARSE: return xdstrdup("parse-error"); break; case E_NOTICE: case E_USER_NOTICE: return xdstrdup("notice"); break; case E_STRICT: return xdstrdup("strict-standards"); break; #if PHP_VERSION_ID >= 50300 case E_DEPRECATED: case E_USER_DEPRECATED: return xdstrdup("deprecated"); break; #endif case 0: return xdstrdup("xdebug"); break; default: return xdstrdup("unknown-error"); break; } } char* xdebug_error_type(int type) { switch (type) { case E_ERROR: case E_CORE_ERROR: case E_COMPILE_ERROR: case E_USER_ERROR: return xdstrdup("Fatal error"); break; #if PHP_VERSION_ID >= 50200 case E_RECOVERABLE_ERROR: return xdstrdup("Catchable fatal error"); break; #endif case E_WARNING: case E_CORE_WARNING: case E_COMPILE_WARNING: case E_USER_WARNING: return xdstrdup("Warning"); break; case E_PARSE: return xdstrdup("Parse error"); break; case E_NOTICE: case E_USER_NOTICE: return xdstrdup("Notice"); break; case E_STRICT: return xdstrdup("Strict standards"); break; #if PHP_VERSION_ID >= 50300 case E_DEPRECATED: case E_USER_DEPRECATED: return xdstrdup("Deprecated"); break; #endif case 0: return xdstrdup("Xdebug"); break; default: return xdstrdup("Unknown error"); break; } } /*************************************************************************************************************************************/ #if PHP_VERSION_ID >= 50500 # define T(offset) (*EX_TMP_VAR(zdata, offset)) #else # define T(offset) (*(temp_variable *)((char*)zdata->Ts + offset)) #endif zval *xdebug_get_zval(zend_execute_data *zdata, int node_type, XDEBUG_ZNODE *node, int *is_var) { switch (node_type) { case IS_CONST: #if PHP_VERSION_ID >= 50399 return node->zv; #else return &node->u.constant; #endif break; case IS_TMP_VAR: *is_var = 1; #if PHP_VERSION_ID >= 50399 return &T(node->var).tmp_var; #else return &T(node->u.var).tmp_var; #endif break; case IS_VAR: *is_var = 1; #if PHP_VERSION_ID >= 50399 if (T(node->var).var.ptr) { return T(node->var).var.ptr; #else if (T(node->u.var).var.ptr) { return T(node->u.var).var.ptr; #endif } break; case IS_CV: { zval **tmp; #if PHP_VERSION_ID >= 50399 tmp = zend_get_compiled_variable_value(zdata, node->constant); #else tmp = zend_get_compiled_variable_value(zdata, node->u.constant.value.lval); #endif if (tmp) { return *tmp; } break; } case IS_UNUSED: fprintf(stderr, "\nIS_UNUSED\n"); break; default: fprintf(stderr, "\ndefault %d\n", node_type); break; } *is_var = 1; return NULL; } /***************************************************************************** ** PHP Variable related utility functions */ zval* xdebug_get_php_symbol(char* name, int name_length) { HashTable *st = NULL; zval **retval; TSRMLS_FETCH(); st = XG(active_symbol_table); if (st && st->nNumOfElements && zend_hash_find(st, name, name_length, (void **) &retval) == SUCCESS) { return *retval; } st = EG(active_op_array)->static_variables; if (st) { if (zend_hash_find(st, name, name_length, (void **) &retval) == SUCCESS) { return *retval; } } st = &EG(symbol_table); if (zend_hash_find(st, name, name_length, (void **) &retval) == SUCCESS) { return *retval; } return NULL; } char* xdebug_get_property_info(char *mangled_property, int mangled_len, char **property_name, char **class_name) { const char *prop_name, *cls_name; #if PHP_VERSION_ID >= 50200 zend_unmangle_property_name(mangled_property, mangled_len - 1, &cls_name, &prop_name); #else zend_unmangle_property_name(mangled_property, &cls_name, &prop_name); #endif *property_name = (char *) prop_name; *class_name = (char *) cls_name; if (cls_name) { if (cls_name[0] == '*') { return "protected"; } else { return "private"; } } else { return "public"; } } #define XDEBUG_MAX_INT 2147483647 xdebug_var_export_options* xdebug_var_export_options_from_ini(TSRMLS_D) { xdebug_var_export_options *options; options = xdmalloc(sizeof(xdebug_var_export_options)); options->max_children = XG(display_max_children); options->max_data = XG(display_max_data); options->max_depth = XG(display_max_depth); options->show_hidden = 0; if (options->max_children == -1 || options->max_children > XDEBUG_MAX_INT) { options->max_children = XDEBUG_MAX_INT; } else if (options->max_children < 1) { options->max_children = 0; } if (options->max_data == -1 || options->max_data > XDEBUG_MAX_INT) { options->max_data = XDEBUG_MAX_INT; } else if (options->max_data < 1) { options->max_data = 0; } if (options->max_depth == -1 || options->max_depth > 1023) { options->max_depth = 1023; } else if (options->max_depth < 1) { options->max_depth = 0; } options->runtime = (xdebug_var_runtime_page*) xdmalloc((options->max_depth + 1) * sizeof(xdebug_var_runtime_page)); options->no_decoration = 0; return options; } xdebug_var_export_options xdebug_var_nolimit_options = { XDEBUG_MAX_INT, XDEBUG_MAX_INT, 1023, 1, NULL, 0 }; xdebug_var_export_options* xdebug_var_get_nolimit_options(TSRMLS_D) { return &xdebug_var_nolimit_options; } /***************************************************************************** ** Normal variable printing routines */ static int xdebug_array_element_export(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { int level, debug_zval; xdebug_str *str; xdebug_var_export_options *options; #if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300 TSRMLS_FETCH(); #endif level = va_arg(args, int); str = va_arg(args, struct xdebug_str*); debug_zval = va_arg(args, int); options = va_arg(args, xdebug_var_export_options*); if (options->runtime[level].current_element_nr >= options->runtime[level].start_element_nr && options->runtime[level].current_element_nr < options->runtime[level].end_element_nr) { if (hash_key->nKeyLength==0) { /* numeric key */ xdebug_str_add(str, xdebug_sprintf("%ld => ", hash_key->h), 1); } else { /* string key */ int newlen = 0; char *tmp, *tmp2; tmp = php_str_to_str((char *) hash_key->arKey, hash_key->nKeyLength, "'", 1, "\\'", 2, &newlen); tmp2 = php_str_to_str(tmp, newlen - 1, "\0", 1, "\\0", 2, &newlen); if (tmp) { efree(tmp); } xdebug_str_addl(str, "'", 1, 0); if (tmp2) { xdebug_str_addl(str, tmp2, newlen, 0); efree(tmp2); } xdebug_str_add(str, "' => ", 0); } xdebug_var_export(zv, str, level + 2, debug_zval, options TSRMLS_CC); xdebug_str_addl(str, ", ", 2, 0); } if (options->runtime[level].current_element_nr == options->runtime[level].end_element_nr) { xdebug_str_addl(str, "..., ", 5, 0); } options->runtime[level].current_element_nr++; return 0; } static int xdebug_object_element_export(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { int level, debug_zval; xdebug_str *str; xdebug_var_export_options *options; char *prop_name, *class_name, *modifier, *prop_class_name; #if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300 TSRMLS_FETCH(); #endif level = va_arg(args, int); str = va_arg(args, struct xdebug_str*); debug_zval = va_arg(args, int); options = va_arg(args, xdebug_var_export_options*); class_name = va_arg(args, char *); if (options->runtime[level].current_element_nr >= options->runtime[level].start_element_nr && options->runtime[level].current_element_nr < options->runtime[level].end_element_nr) { if (hash_key->nKeyLength != 0) { modifier = xdebug_get_property_info((char *) hash_key->arKey, hash_key->nKeyLength, &prop_name, &prop_class_name); if (strcmp(modifier, "private") != 0 || strcmp(class_name, prop_class_name) == 0) { xdebug_str_add(str, xdebug_sprintf("%s $%s = ", modifier, prop_name), 1); } else { xdebug_str_add(str, xdebug_sprintf("%s ${%s}:%s = ", modifier, prop_class_name, prop_name), 1); } } xdebug_var_export(zv, str, level + 2, debug_zval, options TSRMLS_CC); xdebug_str_addl(str, "; ", 2, 0); } if (options->runtime[level].current_element_nr == options->runtime[level].end_element_nr) { xdebug_str_addl(str, "...; ", 5, 0); } options->runtime[level].current_element_nr++; return 0; } void xdebug_var_export(zval **struc, xdebug_str *str, int level, int debug_zval, xdebug_var_export_options *options TSRMLS_DC) { HashTable *myht; char* tmp_str; int tmp_len; if (!struc || !(*struc)) { return; } if (debug_zval) { xdebug_str_add(str, xdebug_sprintf("(refcount=%d, is_ref=%d)=", (*struc)->XDEBUG_REFCOUNT, (*struc)->XDEBUG_IS_REF), 1); } switch (Z_TYPE_PP(struc)) { case IS_BOOL: xdebug_str_add(str, xdebug_sprintf("%s", Z_LVAL_PP(struc) ? "TRUE" : "FALSE"), 1); break; case IS_NULL: xdebug_str_addl(str, "NULL", 4, 0); break; case IS_LONG: xdebug_str_add(str, xdebug_sprintf("%ld", Z_LVAL_PP(struc)), 1); break; case IS_DOUBLE: xdebug_str_add(str, xdebug_sprintf("%.*G", (int) EG(precision), Z_DVAL_PP(struc)), 1); break; case IS_STRING: tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\\0..\37", 7 TSRMLS_CC); if (options->no_decoration) { xdebug_str_add(str, tmp_str, 0); } else if (Z_STRLEN_PP(struc) <= options->max_data) { xdebug_str_add(str, xdebug_sprintf("'%s'", tmp_str), 1); } else { xdebug_str_addl(str, "'", 1, 0); xdebug_str_addl(str, xdebug_sprintf("%s", tmp_str), options->max_data, 1); xdebug_str_addl(str, "...'", 4, 0); } efree(tmp_str); break; case IS_ARRAY: myht = Z_ARRVAL_PP(struc); if (myht->nApplyCount < 1) { xdebug_str_addl(str, "array (", 7, 0); if (level <= options->max_depth) { options->runtime[level].current_element_nr = 0; options->runtime[level].start_element_nr = 0; options->runtime[level].end_element_nr = options->max_children; zend_hash_apply_with_arguments(myht XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_array_element_export, 4, level, str, debug_zval, options); /* Remove the ", " at the end of the string */ if (myht->nNumOfElements > 0) { xdebug_str_chop(str, 2); } } else { xdebug_str_addl(str, "...", 3, 0); } xdebug_str_addl(str, ")", 1, 0); } else { xdebug_str_addl(str, "...", 3, 0); } break; case IS_OBJECT: myht = Z_OBJPROP_PP(struc); if (myht->nApplyCount < 1) { char *class_name; zend_uint class_name_len; zend_get_object_classname(*struc, (const char **) &class_name, &class_name_len TSRMLS_CC); xdebug_str_add(str, xdebug_sprintf("class %s { ", class_name), 1); if (level <= options->max_depth) { options->runtime[level].current_element_nr = 0; options->runtime[level].start_element_nr = 0; options->runtime[level].end_element_nr = options->max_children; zend_hash_apply_with_arguments(myht XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_object_element_export, 5, level, str, debug_zval, options, class_name); /* Remove the ", " at the end of the string */ if (myht->nNumOfElements > 0) { xdebug_str_chop(str, 2); } } else { xdebug_str_addl(str, "...", 3, 0); } xdebug_str_addl(str, " }", 2, 0); efree(class_name); } else { xdebug_str_addl(str, "...", 3, 0); } break; case IS_RESOURCE: { char *type_name; type_name = (char *) zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(struc) TSRMLS_CC); xdebug_str_add(str, xdebug_sprintf("resource(%ld) of type (%s)", Z_LVAL_PP(struc), type_name ? type_name : "Unknown"), 1); break; } default: xdebug_str_addl(str, "NULL", 4, 0); break; } } char* xdebug_get_zval_value(zval *val, int debug_zval, xdebug_var_export_options *options) { xdebug_str str = {0, 0, NULL}; int default_options = 0; TSRMLS_FETCH(); if (!options) { options = xdebug_var_export_options_from_ini(TSRMLS_C); default_options = 1; } xdebug_var_export(&val, (xdebug_str*) &str, 1, debug_zval, options TSRMLS_CC); if (default_options) { xdfree(options->runtime); xdfree(options); } return str.d; } static void xdebug_var_synopsis(zval **struc, xdebug_str *str, int level, int debug_zval, xdebug_var_export_options *options TSRMLS_DC) { HashTable *myht; if (!struc || !(*struc)) { return; } if (debug_zval) { xdebug_str_add(str, xdebug_sprintf("(refcount=%d, is_ref=%d)=", (*struc)->XDEBUG_REFCOUNT, (*struc)->XDEBUG_IS_REF), 1); } switch (Z_TYPE_PP(struc)) { case IS_BOOL: xdebug_str_addl(str, "bool", 4, 0); break; case IS_NULL: xdebug_str_addl(str, "null", 4, 0); break; case IS_LONG: xdebug_str_addl(str, "long", 4, 0); break; case IS_DOUBLE: xdebug_str_addl(str, "double", 6, 0); break; case IS_STRING: xdebug_str_add(str, xdebug_sprintf("string(%d)", Z_STRLEN_PP(struc)), 1); break; case IS_ARRAY: myht = Z_ARRVAL_PP(struc); xdebug_str_add(str, xdebug_sprintf("array(%d)", myht->nNumOfElements), 1); break; case IS_OBJECT: { char *class_name; zend_uint class_name_len; zend_get_object_classname(*struc, (const char **) &class_name, &class_name_len TSRMLS_CC); xdebug_str_add(str, xdebug_sprintf("class %s", class_name), 1); efree(class_name); break; } case IS_RESOURCE: { char *type_name; type_name = (char *) zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(struc) TSRMLS_CC); xdebug_str_add(str, xdebug_sprintf("resource(%ld) of type (%s)", Z_LVAL_PP(struc), type_name ? type_name : "Unknown"), 1); break; } } } char* xdebug_get_zval_synopsis(zval *val, int debug_zval, xdebug_var_export_options *options) { xdebug_str str = {0, 0, NULL}; int default_options = 0; TSRMLS_FETCH(); if (!options) { options = xdebug_var_export_options_from_ini(TSRMLS_C); default_options = 1; } xdebug_var_synopsis(&val, (xdebug_str*) &str, 1, debug_zval, options TSRMLS_CC); if (default_options) { xdfree(options->runtime); xdfree(options); } return str.d; } /***************************************************************************** ** Plain text/ANSI coloured variable printing routines */ #define ANSI_COLOR_POINTER (mode == 1 ? "" : "") #define ANSI_COLOR_BOOL (mode == 1 ? "" : "") #define ANSI_COLOR_LONG (mode == 1 ? "" : "") #define ANSI_COLOR_NULL (mode == 1 ? "" : "") #define ANSI_COLOR_DOUBLE (mode == 1 ? "" : "") #define ANSI_COLOR_STRING (mode == 1 ? "" : "") #define ANSI_COLOR_EMPTY (mode == 1 ? "" : "") #define ANSI_COLOR_ARRAY (mode == 1 ? "" : "") #define ANSI_COLOR_OBJECT (mode == 1 ? "" : "") #define ANSI_COLOR_RESOURCE (mode == 1 ? "" : "") #define ANSI_COLOR_MODIFIER (mode == 1 ? "" : "") #define ANSI_COLOR_RESET (mode == 1 ? "" : "") #define ANSI_COLOR_BOLD (mode == 1 ? "" : "") #define ANSI_COLOR_BOLD_OFF (mode == 1 ? "" : "") static int xdebug_array_element_export_text_ansi(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { int level, mode, debug_zval; xdebug_str *str; xdebug_var_export_options *options; #if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300 TSRMLS_FETCH(); #endif level = va_arg(args, int); mode = va_arg(args, int); str = va_arg(args, struct xdebug_str*); debug_zval = va_arg(args, int); options = va_arg(args, xdebug_var_export_options*); if (options->runtime[level].current_element_nr >= options->runtime[level].start_element_nr && options->runtime[level].current_element_nr < options->runtime[level].end_element_nr) { xdebug_str_add(str, xdebug_sprintf("%*s", (level * 2), ""), 1); if (hash_key->nKeyLength==0) { /* numeric key */ xdebug_str_add(str, xdebug_sprintf("[%ld] %s=>%s\n", hash_key->h, ANSI_COLOR_POINTER, ANSI_COLOR_RESET), 1); } else { /* string key */ int newlen = 0; char *tmp, *tmp2; tmp = php_str_to_str((char *) hash_key->arKey, hash_key->nKeyLength, "'", 1, "\\'", 2, &newlen); tmp2 = php_str_to_str(tmp, newlen - 1, "\0", 1, "\\0", 2, &newlen); if (tmp) { efree(tmp); } xdebug_str_addl(str, "'", 1, 0); if (tmp2) { xdebug_str_addl(str, tmp2, newlen, 0); efree(tmp2); } xdebug_str_add(str, "' =>\n", 0); } xdebug_var_export_text_ansi(zv, str, mode, level + 1, debug_zval, options TSRMLS_CC); } if (options->runtime[level].current_element_nr == options->runtime[level].end_element_nr) { xdebug_str_add(str, xdebug_sprintf("\n%*s(more elements)...\n", (level * 2), ""), 1); } options->runtime[level].current_element_nr++; return 0; } static int xdebug_object_element_export_text_ansi(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { int level, mode, debug_zval; xdebug_str *str; xdebug_var_export_options *options; char *prop_name, *class_name, *modifier; #if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300 TSRMLS_FETCH(); #endif level = va_arg(args, int); mode = va_arg(args, int); str = va_arg(args, struct xdebug_str*); debug_zval = va_arg(args, int); options = va_arg(args, xdebug_var_export_options*); if (options->runtime[level].current_element_nr >= options->runtime[level].start_element_nr && options->runtime[level].current_element_nr < options->runtime[level].end_element_nr) { xdebug_str_add(str, xdebug_sprintf("%*s", (level * 2), ""), 1); if (hash_key->nKeyLength != 0) { modifier = xdebug_get_property_info((char *) hash_key->arKey, hash_key->nKeyLength, &prop_name, &class_name); xdebug_str_add(str, xdebug_sprintf("%s%s%s%s%s $%s %s=>%s\n", ANSI_COLOR_MODIFIER, ANSI_COLOR_BOLD, modifier, ANSI_COLOR_BOLD_OFF, ANSI_COLOR_RESET, prop_name, ANSI_COLOR_POINTER, ANSI_COLOR_RESET), 1); } xdebug_var_export_text_ansi(zv, str, mode, level + 1, debug_zval, options TSRMLS_CC); } if (options->runtime[level].current_element_nr == options->runtime[level].end_element_nr) { xdebug_str_add(str, xdebug_sprintf("\n%*s(more elements)...\n", (level * 2), ""), 1); } options->runtime[level].current_element_nr++; return 0; } void xdebug_var_export_text_ansi(zval **struc, xdebug_str *str, int mode, int level, int debug_zval, xdebug_var_export_options *options TSRMLS_DC) { HashTable *myht; char* tmp_str; int tmp_len; #if PHP_VERSION_ID >= 50300 int is_temp; #endif if (!struc || !(*struc)) { return; } if (debug_zval) { xdebug_str_add(str, xdebug_sprintf("(refcount=%d, is_ref=%d)=", (*struc)->XDEBUG_REFCOUNT, (*struc)->XDEBUG_IS_REF), 1); } xdebug_str_add(str, xdebug_sprintf("%*s", (level * 2) - 2, ""), 1); switch (Z_TYPE_PP(struc)) { case IS_BOOL: xdebug_str_add(str, xdebug_sprintf("%sbool%s(%s%s%s)", ANSI_COLOR_BOLD, ANSI_COLOR_BOLD_OFF, ANSI_COLOR_BOOL, Z_LVAL_PP(struc) ? "true" : "false", ANSI_COLOR_RESET), 1); break; case IS_NULL: xdebug_str_add(str, xdebug_sprintf("%s%sNULL%s%s", ANSI_COLOR_BOLD, ANSI_COLOR_NULL, ANSI_COLOR_RESET, ANSI_COLOR_BOLD_OFF), 1); break; case IS_LONG: xdebug_str_add(str, xdebug_sprintf("%sint%s(%s%ld%s)", ANSI_COLOR_BOLD, ANSI_COLOR_BOLD_OFF, ANSI_COLOR_LONG, Z_LVAL_PP(struc), ANSI_COLOR_RESET), 1); break; case IS_DOUBLE: xdebug_str_add(str, xdebug_sprintf("%sdouble%s(%s%.*G%s)", ANSI_COLOR_BOLD, ANSI_COLOR_BOLD_OFF, ANSI_COLOR_DOUBLE, (int) EG(precision), Z_DVAL_PP(struc), ANSI_COLOR_RESET), 1); break; case IS_STRING: if (mode == 1) { tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\\0..\37", 7 TSRMLS_CC); } else { tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "\0", 1 TSRMLS_CC); } if (options->no_decoration) { xdebug_str_addl(str, tmp_str, tmp_len, 0); } else if (Z_STRLEN_PP(struc) <= options->max_data) { xdebug_str_add(str, xdebug_sprintf("%sstring%s(%s%ld%s) \"%s%s%s\"", ANSI_COLOR_BOLD, ANSI_COLOR_BOLD_OFF, ANSI_COLOR_LONG, Z_STRLEN_PP(struc), ANSI_COLOR_RESET, ANSI_COLOR_STRING, tmp_str, ANSI_COLOR_RESET), 1); } else { xdebug_str_add(str, xdebug_sprintf("%sstring%s(%s%ld%s) \"%s", ANSI_COLOR_BOLD, ANSI_COLOR_BOLD_OFF, ANSI_COLOR_LONG, Z_STRLEN_PP(struc), ANSI_COLOR_RESET, ANSI_COLOR_STRING), 1); xdebug_str_addl(str, tmp_str, options->max_data, 0); xdebug_str_add(str, xdebug_sprintf("%s\"...", ANSI_COLOR_RESET), 1); } efree(tmp_str); break; case IS_ARRAY: myht = Z_ARRVAL_PP(struc); if (myht->nApplyCount < 1) { xdebug_str_add(str, xdebug_sprintf("%sarray%s(%s%d%s) {\n", ANSI_COLOR_BOLD, ANSI_COLOR_BOLD_OFF, ANSI_COLOR_LONG, myht->nNumOfElements, ANSI_COLOR_RESET), 1); if (level <= options->max_depth) { options->runtime[level].current_element_nr = 0; options->runtime[level].start_element_nr = 0; options->runtime[level].end_element_nr = options->max_children; zend_hash_apply_with_arguments(myht XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_array_element_export_text_ansi, 5, level, mode, str, debug_zval, options); } else { xdebug_str_add(str, xdebug_sprintf("%*s...\n", (level * 2), ""), 1); } xdebug_str_add(str, xdebug_sprintf("%*s}", (level * 2) - 2 , ""), 1); } else { xdebug_str_add(str, xdebug_sprintf("&%sarray%s", ANSI_COLOR_BOLD, ANSI_COLOR_BOLD_OFF), 1); } break; case IS_OBJECT: #if PHP_VERSION_ID >= 50300 myht = Z_OBJDEBUG_PP(struc, is_temp); #else myht = Z_OBJPROP_PP(struc); #endif if (myht && myht->nApplyCount < 1) { char *class_name; zend_uint class_name_len; zend_get_object_classname(*struc, (const char **) &class_name, &class_name_len TSRMLS_CC); xdebug_str_add(str, xdebug_sprintf("%sclass%s %s%s%s#%d (%s%d%s) {\n", ANSI_COLOR_BOLD, ANSI_COLOR_BOLD_OFF, ANSI_COLOR_OBJECT, class_name, ANSI_COLOR_RESET, Z_OBJ_HANDLE_PP(struc), ANSI_COLOR_LONG, myht->nNumOfElements, ANSI_COLOR_RESET), 1); efree(class_name); if (level <= options->max_depth) { options->runtime[level].current_element_nr = 0; options->runtime[level].start_element_nr = 0; options->runtime[level].end_element_nr = options->max_children; zend_hash_apply_with_arguments(myht XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_object_element_export_text_ansi, 5, level, mode, str, debug_zval, options); } else { xdebug_str_add(str, xdebug_sprintf("%*s...\n", (level * 2), ""), 1); } xdebug_str_add(str, xdebug_sprintf("%*s}", (level * 2) - 2, ""), 1); } else { xdebug_str_add(str, xdebug_sprintf("%*s...\n", (level * 2), ""), 1); } #if PHP_VERSION_ID >= 50300 if (is_temp) { zend_hash_destroy(myht); efree(myht); } #endif break; case IS_RESOURCE: { char *type_name; type_name = (char *) zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(struc) TSRMLS_CC); xdebug_str_add(str, xdebug_sprintf("%sresource%s(%s%ld%s) of type (%s)", ANSI_COLOR_BOLD, ANSI_COLOR_BOLD_OFF, ANSI_COLOR_RESOURCE, Z_LVAL_PP(struc), ANSI_COLOR_RESET, type_name ? type_name : "Unknown"), 1); break; } default: xdebug_str_add(str, xdebug_sprintf("%sNULL%s", ANSI_COLOR_NULL, ANSI_COLOR_RESET), 0); break; } xdebug_str_addl(str, "\n", 1, 0); } char* xdebug_get_zval_value_text_ansi(zval *val, int mode, int debug_zval, xdebug_var_export_options *options TSRMLS_DC) { xdebug_str str = {0, 0, NULL}; int default_options = 0; if (!options) { options = xdebug_var_export_options_from_ini(TSRMLS_C); default_options = 1; } xdebug_var_export_text_ansi(&val, (xdebug_str*) &str, mode, 1, debug_zval, options TSRMLS_CC); if (default_options) { xdfree(options->runtime); xdfree(options); } return str.d; } static void xdebug_var_synopsis_text_ansi(zval **struc, xdebug_str *str, int mode, int level, int debug_zval, xdebug_var_export_options *options TSRMLS_DC) { HashTable *myht; if (!struc || !(*struc)) { return; } if (debug_zval) { xdebug_str_add(str, xdebug_sprintf("(refcount=%d, is_ref=%d)=", (*struc)->XDEBUG_REFCOUNT, (*struc)->XDEBUG_IS_REF), 1); } switch (Z_TYPE_PP(struc)) { case IS_BOOL: xdebug_str_add(str, xdebug_sprintf("%sbool%s", ANSI_COLOR_BOLD, ANSI_COLOR_BOLD_OFF), 1); break; case IS_NULL: xdebug_str_add(str, xdebug_sprintf("%snull%s", ANSI_COLOR_BOLD, ANSI_COLOR_BOLD_OFF), 1); break; case IS_LONG: xdebug_str_add(str, xdebug_sprintf("%sint%s", ANSI_COLOR_BOLD, ANSI_COLOR_BOLD_OFF), 1); break; case IS_DOUBLE: xdebug_str_add(str, xdebug_sprintf("%sdouble%s", ANSI_COLOR_BOLD, ANSI_COLOR_BOLD_OFF), 1); break; case IS_STRING: xdebug_str_add(str, xdebug_sprintf("%sstring%s(%s%d%s)", ANSI_COLOR_BOLD, ANSI_COLOR_BOLD_OFF, ANSI_COLOR_LONG, Z_STRLEN_PP(struc), ANSI_COLOR_RESET), 1); break; case IS_ARRAY: myht = Z_ARRVAL_PP(struc); xdebug_str_add(str, xdebug_sprintf("array(%s%d%s)", ANSI_COLOR_LONG, myht->nNumOfElements, ANSI_COLOR_RESET), 1); break; case IS_OBJECT: { char *class_name; zend_uint class_name_len; zend_get_object_classname(*struc, (const char **) &class_name, &class_name_len TSRMLS_CC); xdebug_str_add(str, xdebug_sprintf("class %s", class_name), 1); break; } case IS_RESOURCE: { char *type_name; type_name = (char *) zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(struc) TSRMLS_CC); xdebug_str_add(str, xdebug_sprintf("resource(%s%ld%s) of type (%s)", ANSI_COLOR_LONG, Z_LVAL_PP(struc), ANSI_COLOR_RESET, type_name ? type_name : "Unknown"), 1); break; } } } char* xdebug_get_zval_synopsis_text_ansi(zval *val, int mode, int debug_zval, xdebug_var_export_options *options TSRMLS_DC) { xdebug_str str = {0, 0, NULL}; int default_options = 0; if (!options) { options = xdebug_var_export_options_from_ini(TSRMLS_C); default_options = 1; } xdebug_var_synopsis_text_ansi(&val, (xdebug_str*) &str, mode, 1, debug_zval, options TSRMLS_CC); if (default_options) { xdfree(options->runtime); xdfree(options); } return str.d; } /***************************************************************************** ** XML node printing routines */ #define XDEBUG_OBJECT_ITEM_TYPE_PROPERTY 1 #define XDEBUG_OBJECT_ITEM_TYPE_STATIC_PROPERTY 2 typedef struct { char type; char *name; int name_len; zval *zv; } xdebug_object_item; static int object_item_add_to_merged_hash(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { HashTable *merged; int object_type; xdebug_object_item *item; merged = va_arg(args, HashTable*); object_type = va_arg(args, int); item = xdmalloc(sizeof(xdebug_object_item)); item->type = object_type; item->zv = *zv; item->name = (char *) hash_key->arKey; item->name_len = hash_key->nKeyLength; zend_hash_next_index_insert(merged, &item, sizeof(xdebug_object_item*), NULL); return 0; } #if PHP_VERSION_ID >= 50400 static int object_item_add_zend_prop_to_merged_hash(zend_property_info *zpp XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { HashTable *merged; int object_type; xdebug_object_item *item; zend_class_entry *ce; if ((zpp->flags & ZEND_ACC_STATIC) == 0) { return 0; } merged = va_arg(args, HashTable*); object_type = va_arg(args, int); ce = va_arg(args, zend_class_entry*); item = xdmalloc(sizeof(xdebug_object_item)); item->type = object_type; #if ZTS if (ce->type == 1) { item->zv = CG(static_members_table)[(zend_intptr_t) ce->static_members_table][zpp->offset]; } else { item->zv = ce->static_members_table[zpp->offset]; } #else item->zv = ce->static_members_table[zpp->offset]; #endif item->name = (char *) zpp->name; item->name_len = zpp->name_length; zend_hash_next_index_insert(merged, &item, sizeof(xdebug_object_item*), NULL); return 0; } #endif static int xdebug_array_element_export_xml_node(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { int level; xdebug_xml_node *parent; xdebug_xml_node *node; xdebug_var_export_options *options; char *name = NULL, *parent_name = NULL; int name_len = 0; xdebug_str full_name = { 0, 0, NULL }; #if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300 TSRMLS_FETCH(); #endif level = va_arg(args, int); parent = va_arg(args, xdebug_xml_node*); parent_name = va_arg(args, char *); options = va_arg(args, xdebug_var_export_options*); if (options->runtime[level].current_element_nr >= options->runtime[level].start_element_nr && options->runtime[level].current_element_nr < options->runtime[level].end_element_nr) { node = xdebug_xml_node_init("property"); if (hash_key->nKeyLength != 0) { name = xdstrndup(hash_key->arKey, hash_key->nKeyLength); name_len = hash_key->nKeyLength - 1; if (parent_name) { xdebug_str_add(&full_name, parent_name, 0); xdebug_str_addl(&full_name, "['", 2, 0); xdebug_str_addl(&full_name, name, name_len, 0); xdebug_str_addl(&full_name, "']", 2, 0); } } else { name = xdebug_sprintf("%ld", hash_key->h); name_len = strlen(name); if (parent_name) { xdebug_str_add(&full_name, xdebug_sprintf("%s[%s]", parent_name, name), 1); } } xdebug_xml_add_attribute_exl(node, "name", 4, name, name_len, 0, 1); if (full_name.l) { xdebug_xml_add_attribute_exl(node, "fullname", 8, full_name.d, full_name.l, 0, 1); } xdebug_xml_add_attribute_ex(node, "address", xdebug_sprintf("%ld", (long) *zv), 0, 1); xdebug_xml_add_child(parent, node); xdebug_var_export_xml_node(zv, full_name.d, node, options, level + 1 TSRMLS_CC); } options->runtime[level].current_element_nr++; return 0; } static int xdebug_object_element_export_xml_node(xdebug_object_item **item XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { int level; xdebug_xml_node *parent; xdebug_xml_node *node; xdebug_var_export_options *options; char *prop_name, *modifier, *class_name, *prop_class_name; char *parent_name = NULL, *full_name = NULL; #if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300 TSRMLS_FETCH(); #endif level = va_arg(args, int); parent = va_arg(args, xdebug_xml_node*); full_name = parent_name = va_arg(args, char *); options = va_arg(args, xdebug_var_export_options*); class_name = va_arg(args, char *); if (options->runtime[level].current_element_nr >= options->runtime[level].start_element_nr && options->runtime[level].current_element_nr < options->runtime[level].end_element_nr) { if ((*item)->name_len != 0) { modifier = xdebug_get_property_info((*item)->name, (*item)->name_len, &prop_name, &prop_class_name); node = xdebug_xml_node_init("property"); if (strcmp(modifier, "private") != 0 || strcmp(class_name, prop_class_name) == 0) { xdebug_xml_add_attribute_ex(node, "name", xdstrdup(prop_name), 0, 1); } else { xdebug_xml_add_attribute_ex(node, "name", xdebug_sprintf("*%s*%s", prop_class_name, prop_name), 0, 1); } if (parent_name) { if (strcmp(modifier, "private") != 0 || strcmp(class_name, prop_class_name) == 0) { full_name = xdebug_sprintf("%s%s%s", parent_name, (*item)->type == XDEBUG_OBJECT_ITEM_TYPE_STATIC_PROPERTY ? "::" : "->", prop_name); } else { full_name = xdebug_sprintf("%s%s*%s*%s", parent_name, (*item)->type == XDEBUG_OBJECT_ITEM_TYPE_STATIC_PROPERTY ? "::" : "->", prop_class_name, prop_name); } xdebug_xml_add_attribute_ex(node, "fullname", full_name, 0, 1); } xdebug_xml_add_attribute_ex(node, "facet", xdebug_sprintf("%s%s", (*item)->type == XDEBUG_OBJECT_ITEM_TYPE_STATIC_PROPERTY ? "static " : "", modifier), 0, 1); xdebug_xml_add_attribute_ex(node, "address", xdebug_sprintf("%ld", (long) (*item)->zv), 0, 1); xdebug_xml_add_child(parent, node); xdebug_var_export_xml_node(&((*item)->zv), full_name, node, options, level + 1 TSRMLS_CC); } } options->runtime[level].current_element_nr++; return 0; } static char *prepare_variable_name(char *name) { char *tmp_name; tmp_name = xdebug_sprintf("%s%s", (name[0] == '$' || name[0] == ':') ? "" : "$", name); if (tmp_name[strlen(tmp_name) - 2] == ':' && tmp_name[strlen(tmp_name) - 1] == ':') { tmp_name[strlen(tmp_name) - 2] = '\0'; } return tmp_name; } void xdebug_attach_uninitialized_var(xdebug_xml_node *node, char *name) { xdebug_xml_node *contents = NULL; char *tmp_name; contents = xdebug_xml_node_init("property"); tmp_name = prepare_variable_name(name); xdebug_xml_add_attribute_ex(contents, "name", xdstrdup(tmp_name), 0, 1); xdebug_xml_add_attribute_ex(contents, "fullname", xdstrdup(tmp_name), 0, 1); xdfree(tmp_name); xdebug_xml_add_attribute(contents, "type", "uninitialized"); xdebug_xml_add_child(node, contents); } #if PHP_VERSION_ID >= 50400 void xdebug_attach_property_with_contents(zend_property_info *prop_info XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { xdebug_xml_node *node; char *modifier; xdebug_xml_node *contents = NULL; char *class_name; zend_class_entry *class_entry; char *prop_name, *prop_class_name; xdebug_var_export_options *options; int *children_count; node = va_arg(args, xdebug_xml_node *); options = va_arg(args, xdebug_var_export_options *); class_entry = va_arg(args, zend_class_entry *); class_name = va_arg(args, char *); children_count = va_arg(args, int *); if ((prop_info->flags & ZEND_ACC_STATIC) == 0) { return; } (*children_count)++; modifier = xdebug_get_property_info((char *) prop_info->name, prop_info->name_length, &prop_name, &prop_class_name); if (strcmp(modifier, "private") != 0 || strcmp(class_name, prop_class_name) == 0) { contents = xdebug_get_zval_value_xml_node_ex(prop_name, class_entry->static_members_table[prop_info->offset], XDEBUG_VAR_TYPE_STATIC, options TSRMLS_CC); } else{ char *priv_name = xdebug_sprintf("*%s*%s", prop_class_name, prop_name); contents = xdebug_get_zval_value_xml_node_ex(priv_name, class_entry->static_members_table[prop_info->offset], XDEBUG_VAR_TYPE_STATIC, options TSRMLS_CC); xdfree(priv_name); } if (contents) { xdebug_xml_add_attribute_ex(contents, "facet", xdebug_sprintf("static %s", modifier), 0, 1); xdebug_xml_add_child(node, contents); } else { xdebug_attach_uninitialized_var(node, (char *) prop_info->name); } } #else void xdebug_attach_static_var_with_contents(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { xdebug_xml_node *node; char *name = (char *) hash_key->arKey; char *modifier; xdebug_xml_node *contents = NULL; char *class_name; char *prop_name, *prop_class_name; xdebug_var_export_options *options; #if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300 TSRMLS_FETCH(); #endif node = va_arg(args, xdebug_xml_node *); options = va_arg(args, xdebug_var_export_options *); class_name = va_arg(args, char *); modifier = xdebug_get_property_info(name, hash_key->nKeyLength, &prop_name, &prop_class_name); if (strcmp(modifier, "private") != 0 || strcmp(class_name, prop_class_name) == 0) { contents = xdebug_get_zval_value_xml_node_ex(prop_name, *zv, XDEBUG_VAR_TYPE_STATIC, options TSRMLS_CC); } else{ char *priv_name = xdebug_sprintf("*%s*%s", prop_class_name, prop_name); contents = xdebug_get_zval_value_xml_node_ex(priv_name, *zv, XDEBUG_VAR_TYPE_STATIC, options TSRMLS_CC); xdfree(priv_name); } if (contents) { xdebug_xml_add_attribute_ex(contents, "facet", xdebug_sprintf("static %s", modifier), 0, 1); xdebug_xml_add_child(node, contents); } else { xdebug_attach_uninitialized_var(node, name); } } #endif void xdebug_attach_static_vars(xdebug_xml_node *node, xdebug_var_export_options *options, zend_class_entry *ce TSRMLS_DC) { #if PHP_VERSION_ID >= 50400 HashTable *static_members = &ce->properties_info; int children = 0; #else HashTable *static_members = CE_STATIC_MEMBERS(ce); #endif xdebug_xml_node *static_container; static_container = xdebug_xml_node_init("property"); xdebug_xml_add_attribute(static_container, "name", "::"); xdebug_xml_add_attribute(static_container, "fullname", "::"); xdebug_xml_add_attribute(static_container, "type", "object"); xdebug_xml_add_attribute_ex(static_container, "classname", xdstrdup(ce->name), 0, 1); #if PHP_VERSION_ID >= 50400 zend_hash_apply_with_arguments(static_members XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_attach_property_with_contents, 5, static_container, options, ce, ce->name, &children); xdebug_xml_add_attribute(static_container, "children", children > 0 ? "1" : "0"); xdebug_xml_add_attribute_ex(static_container, "numchildren", xdebug_sprintf("%d", children), 0, 1); #else zend_hash_apply_with_arguments(static_members XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_attach_static_var_with_contents, 3, static_container, options, ce->name); xdebug_xml_add_attribute(static_container, "children", static_members->nNumOfElements > 0 ? "1" : "0"); xdebug_xml_add_attribute_ex(static_container, "numchildren", xdebug_sprintf("%d", zend_hash_num_elements(static_members)), 0, 1); #endif xdebug_xml_add_child(node, static_container); } void xdebug_var_export_xml_node(zval **struc, char *name, xdebug_xml_node *node, xdebug_var_export_options *options, int level TSRMLS_DC) { HashTable *myht; char *class_name; zend_uint class_name_len; switch (Z_TYPE_PP(struc)) { case IS_BOOL: xdebug_xml_add_attribute(node, "type", "bool"); xdebug_xml_add_text(node, xdebug_sprintf("%d", Z_LVAL_PP(struc))); break; case IS_NULL: xdebug_xml_add_attribute(node, "type", "null"); break; case IS_LONG: xdebug_xml_add_attribute(node, "type", "int"); xdebug_xml_add_text(node, xdebug_sprintf("%ld", Z_LVAL_PP(struc))); break; case IS_DOUBLE: xdebug_xml_add_attribute(node, "type", "float"); xdebug_xml_add_text(node, xdebug_sprintf("%.*G", (int) EG(precision), Z_DVAL_PP(struc))); break; case IS_STRING: xdebug_xml_add_attribute(node, "type", "string"); if (Z_STRLEN_PP(struc) <= options->max_data) { xdebug_xml_add_text_encodel(node, xdstrndup(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc)), Z_STRLEN_PP(struc)); } else { xdebug_xml_add_text_encodel(node, xdstrndup(Z_STRVAL_PP(struc), options->max_data), options->max_data); } xdebug_xml_add_attribute_ex(node, "size", xdebug_sprintf("%d", Z_STRLEN_PP(struc)), 0, 1); break; case IS_ARRAY: myht = Z_ARRVAL_PP(struc); xdebug_xml_add_attribute(node, "type", "array"); xdebug_xml_add_attribute(node, "children", myht->nNumOfElements > 0?"1":"0"); if (myht->nApplyCount < 1) { xdebug_xml_add_attribute_ex(node, "numchildren", xdebug_sprintf("%d", myht->nNumOfElements), 0, 1); if (level < options->max_depth) { xdebug_xml_add_attribute_ex(node, "page", xdebug_sprintf("%d", options->runtime[level].page), 0, 1); xdebug_xml_add_attribute_ex(node, "pagesize", xdebug_sprintf("%d", options->max_children), 0, 1); options->runtime[level].current_element_nr = 0; if (level == 0) { options->runtime[level].start_element_nr = options->max_children * options->runtime[level].page; options->runtime[level].end_element_nr = options->max_children * (options->runtime[level].page + 1); } else { options->runtime[level].start_element_nr = 0; options->runtime[level].end_element_nr = options->max_children; } zend_hash_apply_with_arguments(myht XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_array_element_export_xml_node, 4, level, node, name, options); } } else { xdebug_xml_add_attribute(node, "recursive", "1"); } break; case IS_OBJECT: { HashTable *merged_hash; zend_class_entry *ce; #if PHP_VERSION_ID >= 50400 int is_temp; #endif ALLOC_HASHTABLE(merged_hash); zend_hash_init(merged_hash, 128, NULL, NULL, 0); zend_get_object_classname(*struc, (const char **) &class_name, &class_name_len TSRMLS_CC); ce = zend_fetch_class(class_name, strlen(class_name), ZEND_FETCH_CLASS_DEFAULT TSRMLS_CC); #if PHP_VERSION_ID >= 50400 /* Adding static properties */ if (&ce->properties_info) { zend_hash_apply_with_arguments(&ce->properties_info XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) object_item_add_zend_prop_to_merged_hash, 3, merged_hash, (int) XDEBUG_OBJECT_ITEM_TYPE_STATIC_PROPERTY, ce); } /* Adding normal properties */ zend_hash_apply_with_arguments(Z_OBJDEBUG_PP(struc, is_temp) XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) object_item_add_to_merged_hash, 2, merged_hash, (int) XDEBUG_OBJECT_ITEM_TYPE_PROPERTY); #else /* Adding static properties */ if (CE_STATIC_MEMBERS(ce)) { zend_hash_apply_with_arguments(CE_STATIC_MEMBERS(ce) XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) object_item_add_to_merged_hash, 2, merged_hash, (int) XDEBUG_OBJECT_ITEM_TYPE_STATIC_PROPERTY); } /* Adding normal properties */ myht = Z_OBJPROP_PP(struc); if (myht) { zend_hash_apply_with_arguments(myht XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) object_item_add_to_merged_hash, 2, merged_hash, (int) XDEBUG_OBJECT_ITEM_TYPE_PROPERTY); } #endif xdebug_xml_add_attribute(node, "type", "object"); xdebug_xml_add_attribute_ex(node, "classname", xdstrdup(class_name), 0, 1); xdebug_xml_add_attribute(node, "children", merged_hash->nNumOfElements ? "1" : "0"); if (merged_hash->nApplyCount < 1) { xdebug_xml_add_attribute_ex(node, "numchildren", xdebug_sprintf("%d", zend_hash_num_elements(merged_hash)), 0, 1); if (level < options->max_depth) { xdebug_xml_add_attribute_ex(node, "page", xdebug_sprintf("%d", options->runtime[level].page), 0, 1); xdebug_xml_add_attribute_ex(node, "pagesize", xdebug_sprintf("%d", options->max_children), 0, 1); options->runtime[level].current_element_nr = 0; if (level == 0) { options->runtime[level].start_element_nr = options->max_children * options->runtime[level].page; options->runtime[level].end_element_nr = options->max_children * (options->runtime[level].page + 1); } else { options->runtime[level].start_element_nr = 0; options->runtime[level].end_element_nr = options->max_children; } zend_hash_apply_with_arguments(merged_hash XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_object_element_export_xml_node, 5, level, node, name, options, class_name); } } efree(class_name); break; } case IS_RESOURCE: { char *type_name; xdebug_xml_add_attribute(node, "type", "resource"); type_name = (char *) zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(struc) TSRMLS_CC); xdebug_xml_add_text(node, xdebug_sprintf("resource id='%ld' type='%s'", Z_LVAL_PP(struc), type_name ? type_name : "Unknown")); break; } default: xdebug_xml_add_attribute(node, "type", "null"); break; } } xdebug_xml_node* xdebug_get_zval_value_xml_node_ex(char *name, zval *val, int var_type, xdebug_var_export_options *options TSRMLS_DC) { xdebug_xml_node *node; char *short_name = NULL; char *full_name = NULL; node = xdebug_xml_node_init("property"); if (name) { switch (var_type) { case XDEBUG_VAR_TYPE_NORMAL: { char *tmp_name; tmp_name = prepare_variable_name(name); short_name = xdstrdup(tmp_name); full_name = xdstrdup(tmp_name); xdfree(tmp_name); } break; case XDEBUG_VAR_TYPE_STATIC: short_name = xdebug_sprintf("::%s", name); full_name = xdebug_sprintf("::%s", name); break; } xdebug_xml_add_attribute_ex(node, "name", short_name, 0, 1); xdebug_xml_add_attribute_ex(node, "fullname", full_name, 0, 1); } xdebug_xml_add_attribute_ex(node, "address", xdebug_sprintf("%ld", (long) val), 0, 1); xdebug_var_export_xml_node(&val, full_name, node, options, 0 TSRMLS_CC); return node; } /***************************************************************************** ** Fancy variable printing routines */ #define COLOR_POINTER "#888a85" #define COLOR_BOOL "#75507b" #define COLOR_LONG "#4e9a06" #define COLOR_NULL "#3465a4" #define COLOR_DOUBLE "#f57900" #define COLOR_STRING "#cc0000" #define COLOR_EMPTY "#888a85" #define COLOR_ARRAY "#ce5c00" #define COLOR_OBJECT "#8f5902" #define COLOR_RESOURCE "#2e3436" static int xdebug_array_element_export_fancy(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { int level, debug_zval, newlen; char *tmp_str; xdebug_str *str; xdebug_var_export_options *options; #if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300 TSRMLS_FETCH(); #endif level = va_arg(args, int); str = va_arg(args, struct xdebug_str*); debug_zval = va_arg(args, int); options = va_arg(args, xdebug_var_export_options*); if (options->runtime[level].current_element_nr >= options->runtime[level].start_element_nr && options->runtime[level].current_element_nr < options->runtime[level].end_element_nr) { xdebug_str_add(str, xdebug_sprintf("%*s", (level * 4) - 2, ""), 1); if (hash_key->nKeyLength==0) { /* numeric key */ xdebug_str_add(str, xdebug_sprintf("%ld => ", hash_key->h, COLOR_POINTER), 1); } else { /* string key */ xdebug_str_addl(str, "'", 1, 0); tmp_str = xdebug_xmlize((char *) hash_key->arKey, hash_key->nKeyLength - 1, &newlen); xdebug_str_addl(str, tmp_str, newlen, 0); efree(tmp_str); xdebug_str_add(str, xdebug_sprintf("' => ", COLOR_POINTER), 1); } xdebug_var_export_fancy(zv, str, level + 1, debug_zval, options TSRMLS_CC); } if (options->runtime[level].current_element_nr == options->runtime[level].end_element_nr) { xdebug_str_add(str, xdebug_sprintf("%*s", (level * 4) - 2, ""), 1); xdebug_str_addl(str, "more elements...\n", 24, 0); } options->runtime[level].current_element_nr++; return 0; } static int xdebug_object_element_export_fancy(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { int level, debug_zval; xdebug_str *str; xdebug_var_export_options *options; char *prop_name, *class_name, *modifier, *prop_class_name; #if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300 TSRMLS_FETCH(); #endif level = va_arg(args, int); str = va_arg(args, struct xdebug_str*); debug_zval = va_arg(args, int); options = va_arg(args, xdebug_var_export_options*); class_name = va_arg(args, char *); if (options->runtime[level].current_element_nr >= options->runtime[level].start_element_nr && options->runtime[level].current_element_nr < options->runtime[level].end_element_nr) { xdebug_str_add(str, xdebug_sprintf("%*s", (level * 4) - 2, ""), 1); if (hash_key->nKeyLength != 0) { modifier = xdebug_get_property_info((char *) hash_key->arKey, hash_key->nKeyLength, &prop_name, &prop_class_name); if (strcmp(modifier, "private") != 0 || strcmp(class_name, prop_class_name) == 0) { xdebug_str_add(str, xdebug_sprintf("%s '%s' => ", modifier, prop_name, COLOR_POINTER), 1); } else { xdebug_str_add(str, xdebug_sprintf("%s '%s' (%s) => ", modifier, prop_name, prop_class_name, COLOR_POINTER), 1); } } xdebug_var_export_fancy(zv, str, level + 1, debug_zval, options TSRMLS_CC); } if (options->runtime[level].current_element_nr == options->runtime[level].end_element_nr) { xdebug_str_add(str, xdebug_sprintf("%*s", (level * 4) - 2, ""), 1); xdebug_str_addl(str, "more elements...\n", 24, 0); } options->runtime[level].current_element_nr++; return 0; } void xdebug_var_export_fancy(zval **struc, xdebug_str *str, int level, int debug_zval, xdebug_var_export_options *options TSRMLS_DC) { HashTable *myht; char* tmp_str; int newlen; if (debug_zval) { xdebug_str_add(str, xdebug_sprintf("(refcount=%d, is_ref=%d),", (*struc)->XDEBUG_REFCOUNT, (*struc)->XDEBUG_IS_REF), 1); } else { if ((*struc)->XDEBUG_IS_REF) { xdebug_str_add(str, "&", 0); } } switch (Z_TYPE_PP(struc)) { case IS_BOOL: xdebug_str_add(str, xdebug_sprintf("boolean %s", COLOR_BOOL, Z_LVAL_PP(struc) ? "true" : "false"), 1); break; case IS_NULL: xdebug_str_add(str, xdebug_sprintf("null", COLOR_NULL), 1); break; case IS_LONG: xdebug_str_add(str, xdebug_sprintf("int %ld", COLOR_LONG, Z_LVAL_PP(struc)), 1); break; case IS_DOUBLE: xdebug_str_add(str, xdebug_sprintf("float %.*G", COLOR_DOUBLE, (int) EG(precision), Z_DVAL_PP(struc)), 1); break; case IS_STRING: xdebug_str_add(str, xdebug_sprintf("string '", COLOR_STRING), 1); if (Z_STRLEN_PP(struc) > options->max_data) { tmp_str = xdebug_xmlize(Z_STRVAL_PP(struc), options->max_data, &newlen); xdebug_str_addl(str, tmp_str, newlen, 0); efree(tmp_str); xdebug_str_addl(str, "'...", 11, 0); } else { tmp_str = xdebug_xmlize(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &newlen); xdebug_str_addl(str, tmp_str, newlen, 0); efree(tmp_str); xdebug_str_addl(str, "'", 8, 0); } xdebug_str_add(str, xdebug_sprintf(" (length=%d)", Z_STRLEN_PP(struc)), 1); break; case IS_ARRAY: myht = Z_ARRVAL_PP(struc); xdebug_str_add(str, xdebug_sprintf("\n%*s", (level - 1) * 4, ""), 1); if (myht->nApplyCount < 1) { xdebug_str_add(str, xdebug_sprintf("array (size=%d)\n", myht->nNumOfElements), 1); if (level <= options->max_depth) { if (myht->nNumOfElements) { options->runtime[level].current_element_nr = 0; options->runtime[level].start_element_nr = 0; options->runtime[level].end_element_nr = options->max_children; zend_hash_apply_with_arguments(myht XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_array_element_export_fancy, 4, level, str, debug_zval, options); } else { xdebug_str_add(str, xdebug_sprintf("%*s", (level * 4) - 2, ""), 1); xdebug_str_add(str, xdebug_sprintf("empty\n", COLOR_EMPTY), 1); } } else { xdebug_str_add(str, xdebug_sprintf("%*s...\n", (level * 4) - 2, ""), 1); } } else { xdebug_str_addl(str, "&array\n", 21, 0); } break; case IS_OBJECT: myht = Z_OBJPROP_PP(struc); xdebug_str_add(str, xdebug_sprintf("\n%*s", (level - 1) * 4, ""), 1); if (myht->nApplyCount < 1) { xdebug_str_add(str, xdebug_sprintf("object(%s)", Z_OBJCE_PP(struc)->name), 1); xdebug_str_add(str, xdebug_sprintf("[%d]\n", Z_OBJ_HANDLE_PP(struc)), 1); if (level <= options->max_depth) { options->runtime[level].current_element_nr = 0; options->runtime[level].start_element_nr = 0; options->runtime[level].end_element_nr = options->max_children; zend_hash_apply_with_arguments(myht XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_object_element_export_fancy, 5, level, str, debug_zval, options, Z_OBJCE_PP(struc)->name); } else { xdebug_str_add(str, xdebug_sprintf("%*s...\n", (level * 4) - 2, ""), 1); } } else { xdebug_str_add(str, xdebug_sprintf("&object(%s)", Z_OBJCE_PP(struc)->name), 1); xdebug_str_add(str, xdebug_sprintf("[%d]\n", Z_OBJ_HANDLE_PP(struc)), 1); } break; case IS_RESOURCE: { char *type_name; type_name = (char *) zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(struc) TSRMLS_CC); xdebug_str_add(str, xdebug_sprintf("resource(%ld, %s)", Z_LVAL_PP(struc), COLOR_RESOURCE, type_name ? type_name : "Unknown"), 1); break; } default: xdebug_str_add(str, xdebug_sprintf("null", COLOR_NULL), 0); break; } if (Z_TYPE_PP(struc) != IS_ARRAY && Z_TYPE_PP(struc) != IS_OBJECT) { xdebug_str_addl(str, "\n", 1, 0); } } char* xdebug_get_zval_value_fancy(char *name, zval *val, int *len, int debug_zval, xdebug_var_export_options *options TSRMLS_DC) { xdebug_str str = {0, 0, NULL}; int default_options = 0; if (!options) { options = xdebug_var_export_options_from_ini(TSRMLS_C); default_options = 1; } xdebug_str_addl(&str, "
", 39, 0);
	xdebug_var_export_fancy(&val, (xdebug_str*) &str, 1, debug_zval, options TSRMLS_CC);
	xdebug_str_addl(&str, "
", 6, 0); if (default_options) { xdfree(options->runtime); xdfree(options); } *len = str.l; return str.d; } static void xdebug_var_synopsis_fancy(zval **struc, xdebug_str *str, int level, int debug_zval, xdebug_var_export_options *options TSRMLS_DC) { HashTable *myht; if (debug_zval) { xdebug_str_add(str, xdebug_sprintf("(refcount=%d, is_ref=%d),", (*struc)->XDEBUG_REFCOUNT, (*struc)->XDEBUG_IS_REF), 1); } switch (Z_TYPE_PP(struc)) { case IS_BOOL: xdebug_str_add(str, xdebug_sprintf("bool", COLOR_BOOL), 1); break; case IS_NULL: xdebug_str_add(str, xdebug_sprintf("null", COLOR_NULL), 1); break; case IS_LONG: xdebug_str_add(str, xdebug_sprintf("long", COLOR_LONG), 1); break; case IS_DOUBLE: xdebug_str_add(str, xdebug_sprintf("double", COLOR_DOUBLE), 1); break; case IS_STRING: xdebug_str_add(str, xdebug_sprintf("string(%d)", COLOR_STRING, Z_STRLEN_PP(struc)), 1); break; case IS_ARRAY: myht = Z_ARRVAL_PP(struc); xdebug_str_add(str, xdebug_sprintf("array(%d)", COLOR_ARRAY, myht->nNumOfElements), 1); break; case IS_OBJECT: xdebug_str_add(str, xdebug_sprintf("object(%s)", COLOR_OBJECT, Z_OBJCE_PP(struc)->name), 1); xdebug_str_add(str, xdebug_sprintf("[%d]", Z_OBJ_HANDLE_PP(struc)), 1); xdebug_str_addl(str, "", 7, 0); break; case IS_RESOURCE: { char *type_name; type_name = (char *) zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(struc) TSRMLS_CC); xdebug_str_add(str, xdebug_sprintf("resource(%ld, %s)", COLOR_RESOURCE, Z_LVAL_PP(struc), type_name ? type_name : "Unknown"), 1); break; } } } char* xdebug_get_zval_synopsis_fancy(char *name, zval *val, int *len, int debug_zval, xdebug_var_export_options *options TSRMLS_DC) { xdebug_str str = {0, 0, NULL}; int default_options = 0; if (!options) { options = xdebug_var_export_options_from_ini(TSRMLS_C); default_options = 1; } xdebug_var_synopsis_fancy(&val, (xdebug_str*) &str, 1, debug_zval, options TSRMLS_CC); if (default_options) { xdfree(options->runtime); xdfree(options); } *len = str.l; return str.d; } /***************************************************************************** ** XML encoding function */ char* xdebug_xmlize(char *string, int len, int *newlen) { char *tmp; char *tmp2; if (len) { tmp = php_str_to_str(string, len, "&", 1, "&", 5, &len); tmp2 = php_str_to_str(tmp, len, ">", 1, ">", 4, &len); efree(tmp); tmp = php_str_to_str(tmp2, len, "<", 1, "<", 4, &len); efree(tmp2); tmp2 = php_str_to_str(tmp, len, "\"", 1, """, 6, &len); efree(tmp); tmp = php_str_to_str(tmp2, len, "'", 1, "'", 5, &len); efree(tmp2); tmp2 = php_str_to_str(tmp, len, "\n", 1, " ", 5, &len); efree(tmp); tmp = php_str_to_str(tmp2, len, "\r", 1, " ", 5, &len); efree(tmp2); tmp2 = php_str_to_str(tmp, len, "\0", 1, "�", 4, newlen); efree(tmp); return tmp2; } else { *newlen = len; return estrdup(string); } } /***************************************************************************** ** Function name printing function */ static char* xdebug_create_doc_link(xdebug_func f TSRMLS_DC) { char *tmp_target, *p, *retval; switch (f.type) { case XFUNC_NORMAL: { tmp_target = xdebug_sprintf("function.%s", f.function); break; } case XFUNC_STATIC_MEMBER: case XFUNC_MEMBER: { if (strcmp(f.function, "__construct") == 0) { tmp_target = xdebug_sprintf("%s.construct", f.class); } else { tmp_target = xdebug_sprintf("%s.%s", f.class, f.function); } break; } } while ((p = strchr(tmp_target, '_')) != NULL) { *p = '-'; } retval = xdebug_sprintf("%s\n", (PG(docref_root) && PG(docref_root)[0]) ? PG(docref_root) : "http://www.php.net/", tmp_target, PG(docref_ext), f.function); xdfree(tmp_target); return retval; } char* xdebug_show_fname(xdebug_func f, int html, int flags TSRMLS_DC) { char *tmp; switch (f.type) { case XFUNC_NORMAL: { if (PG(html_errors) && html && f.internal) { return xdebug_create_doc_link(f TSRMLS_CC); } else { return xdstrdup(f.function); } break; } case XFUNC_STATIC_MEMBER: case XFUNC_MEMBER: { if (PG(html_errors) && html && f.internal) { return xdebug_create_doc_link(f TSRMLS_CC); } else { return xdebug_sprintf("%s%s%s", f.class ? f.class : "?", f.type == XFUNC_STATIC_MEMBER ? "::" : "->", f.function ? f.function : "?" ); } break; } case XFUNC_EVAL: return xdstrdup("eval"); break; case XFUNC_INCLUDE: return xdstrdup("include"); break; case XFUNC_INCLUDE_ONCE: return xdstrdup("include_once"); break; case XFUNC_REQUIRE: return xdstrdup("require"); break; case XFUNC_REQUIRE_ONCE: return xdstrdup("require_once"); break; default: return xdstrdup("{unknown}"); } } xdebug-2.2.3/xdebug_var.h0000644000175000017500000001150712147043204014560 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #include "zend.h" #include "php_xdebug.h" #include "xdebug_compat.h" #include "xdebug_str.h" #include "xdebug_xml.h" #include "xdebug_compat.h" #include "xdebug_private.h" #ifndef __HAVE_XDEBUG_VAR_H__ #define __HAVE_XDEBUG_VAR_H__ typedef struct { int page; /* The number of the page to retrieve */ int current_element_nr; int start_element_nr; int end_element_nr; } xdebug_var_runtime_page; typedef struct xdebug_var_export_options { int max_children; int max_data; int max_depth; int show_hidden; xdebug_var_runtime_page *runtime; int no_decoration; } xdebug_var_export_options; #define XDEBUG_VAR_TYPE_NORMAL 0x00 #define XDEBUG_VAR_TYPE_STATIC 0x01 zval* xdebug_get_php_symbol(char* name, int name_length); char* xdebug_get_property_info(char *mangled_property, int mangled_len, char **property_name, char **class_name); xdebug_var_export_options* xdebug_var_export_options_from_ini(TSRMLS_D); xdebug_var_export_options* xdebug_var_get_nolimit_options(TSRMLS_D); void xdebug_var_export(zval **struc, xdebug_str *str, int level, int debug_zval, xdebug_var_export_options *options TSRMLS_DC); void xdebug_var_export_text_ansi(zval **struc, xdebug_str *str, int mode, int level, int debug_zval, xdebug_var_export_options *options TSRMLS_DC); #define debug_var_export_text(struc, str, level, debug_zval, options) xdebug_var_export_text_ansi(struc, str, 0, level, debug_zval, options TSRMLS_CC); #define debug_var_export_ansi(struc, str, level, debug_zval, options) xdebug_var_export_text_ansi(struc, str, 1, level, debug_zval, options TSRMLS_CC); void xdebug_var_export_xml(zval **struc, xdebug_str *str, int level TSRMLS_DC); void xdebug_var_export_fancy(zval **struc, xdebug_str *str, int level, int debug_zval, xdebug_var_export_options *options TSRMLS_DC); void xdebug_var_export_xml_node(zval **struc, char *name, xdebug_xml_node *node, xdebug_var_export_options *options, int level TSRMLS_DC); char* xdebug_xmlize(char *string, int len, int *newlen); char* xdebug_error_type_simple(int type); char* xdebug_error_type(int type); zval *xdebug_get_zval(zend_execute_data *zdata, int node_type, XDEBUG_ZNODE *node, int *is_var); char* xdebug_get_zval_value(zval *val, int debug_zval, xdebug_var_export_options *options); char* xdebug_get_zval_value_text_ansi(zval *val, int mode, int debug_zval, xdebug_var_export_options *options TSRMLS_DC); #define xdebug_get_zval_value_text(v,d,o) xdebug_get_zval_value_text_ansi(v,0,d,o TSRMLS_CC); #define xdebug_get_zval_value_ansi(v,d,o) xdebug_get_zval_value_text_ansi(v,1,d,o TSRMLS_CC); char* xdebug_get_zval_value_xml(char *name, zval *val); char* xdebug_get_zval_value_fancy(char *name, zval *val, int *len, int debug_zval, xdebug_var_export_options *options TSRMLS_DC); void xdebug_attach_static_vars(xdebug_xml_node *node, xdebug_var_export_options *options, zend_class_entry *ce TSRMLS_DC); void xdebug_attach_uninitialized_var(xdebug_xml_node *node, char *name); void xdebug_attach_static_var_with_contents(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key); #define xdebug_get_zval_value_xml_node(name, val, options) xdebug_get_zval_value_xml_node_ex(name, val, XDEBUG_VAR_TYPE_NORMAL, options) xdebug_xml_node* xdebug_get_zval_value_xml_node_ex(char *name, zval *val, int var_type, xdebug_var_export_options *options TSRMLS_DC); char* xdebug_get_zval_synopsis(zval *val, int debug_zval, xdebug_var_export_options *options); char* xdebug_get_zval_synopsis_text_ansi(zval *val, int mode, int debug_zval, xdebug_var_export_options *options TSRMLS_DC); char* xdebug_get_zval_synopsis_fancy(char *name, zval *val, int *len, int debug_zval, xdebug_var_export_options *options TSRMLS_DC); char* xdebug_show_fname(xdebug_func t, int html, int flags TSRMLS_DC); #endif xdebug-2.2.3/xdebug_xml.c0000644000175000017500000001302512147043204014560 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #include #include #include "xdebug_mm.h" #include "xdebug_str.h" #include "xdebug_var.h" #include "xdebug_xml.h" #include "xdebug_compat.h" static void xdebug_xml_return_attribute(xdebug_xml_attribute* attr, xdebug_str* output) { char *tmp; int newlen; xdebug_str_addl(output, " ", 1, 0); /* attribute name */ tmp = xdebug_xmlize(attr->name, attr->name_len, &newlen); xdebug_str_addl(output, tmp, newlen, 0); efree(tmp); /* attribute value */ xdebug_str_addl(output, "=\"", 2, 0); if (attr->value) { tmp = xdebug_xmlize(attr->value, attr->value_len, &newlen); xdebug_str_add(output, tmp, 0); efree(tmp); } xdebug_str_addl(output, "\"", 1, 0); if (attr->next) { xdebug_xml_return_attribute(attr->next, output); } } static void xdebug_xml_return_text_node(xdebug_xml_text_node* node, xdebug_str* output) { xdebug_str_addl(output, "encode) { /* if cdata tags are in the text, then we must base64 encode */ int new_len = 0; char *encoded_text; encoded_text = (char*) xdebug_base64_encode((unsigned char*) node->text, node->text_len, &new_len); xdebug_str_add(output, encoded_text, 0); efree(encoded_text); } else { xdebug_str_add(output, node->text, 0); } xdebug_str_addl(output, "]]>", 3, 0); } void xdebug_xml_return_node(xdebug_xml_node* node, struct xdebug_str *output) { xdebug_str_addl(output, "<", 1, 0); xdebug_str_add(output, node->tag, 0); if (node->text && node->text->encode) { xdebug_xml_add_attribute_ex(node, "encoding", "base64", 0, 0); } if (node->attribute) { xdebug_xml_return_attribute(node->attribute, output); } xdebug_str_addl(output, ">", 1, 0); if (node->child) { xdebug_xml_return_node(node->child, output); } if (node->text) { xdebug_xml_return_text_node(node->text, output); } xdebug_str_addl(output, "tag, 0); xdebug_str_addl(output, ">", 1, 0); if (node->next) { xdebug_xml_return_node(node->next, output); } } xdebug_xml_node *xdebug_xml_node_init_ex(char *tag, int free_tag) { xdebug_xml_node *xml = xdmalloc(sizeof (xdebug_xml_node)); xml->tag = tag; xml->text = NULL; xml->child = NULL; xml->attribute = NULL; xml->next = NULL; xml->free_tag = free_tag; return xml; } void xdebug_xml_add_attribute_exl(xdebug_xml_node* xml, char *attribute, size_t attribute_len, char *value, size_t value_len, int free_name, int free_value) { xdebug_xml_attribute *attr = xdmalloc(sizeof (xdebug_xml_attribute)); xdebug_xml_attribute **ptr; /* Init structure */ attr->name = attribute; attr->value = value; attr->name_len = attribute_len; attr->value_len = value_len; attr->next = NULL; attr->free_name = free_name; attr->free_value = free_value; /* Find last attribute in node */ ptr = &xml->attribute; while (*ptr != NULL) { ptr = &(*ptr)->next; } *ptr = attr; } void xdebug_xml_add_child(xdebug_xml_node *xml, xdebug_xml_node *child) { xdebug_xml_node **ptr; ptr = &xml->child; while (*ptr != NULL) { ptr = &((*ptr)->next); } *ptr = child; } static void xdebug_xml_text_node_dtor(xdebug_xml_text_node* node) { if (node->free_value && node->text) { xdfree(node->text); } xdfree(node); } void xdebug_xml_add_text(xdebug_xml_node *xml, char *text) { xdebug_xml_add_text_ex(xml, text, strlen(text), 1, 0); } void xdebug_xml_add_text_encode(xdebug_xml_node *xml, char *text) { xdebug_xml_add_text_ex(xml, text, strlen(text), 1, 1); } void xdebug_xml_add_text_ex(xdebug_xml_node *xml, char *text, int length, int free_text, int encode) { xdebug_xml_text_node *node = xdmalloc(sizeof (xdebug_xml_text_node)); node->free_value = free_text; node->encode = encode; if (xml->text) { xdebug_xml_text_node_dtor(xml->text); } node->text = text; node->text_len = length; xml->text = node; if (!encode && strstr(node->text, "]]>")) { node->encode = 1; } } static void xdebug_xml_attribute_dtor(xdebug_xml_attribute *attr) { if (attr->next) { xdebug_xml_attribute_dtor(attr->next); } if (attr->free_name) { xdfree(attr->name); } if (attr->free_value) { xdfree(attr->value); } xdfree(attr); } void xdebug_xml_node_dtor(xdebug_xml_node* xml) { if (xml->next) { xdebug_xml_node_dtor(xml->next); } if (xml->child) { xdebug_xml_node_dtor(xml->child); } if (xml->attribute) { xdebug_xml_attribute_dtor(xml->attribute); } if (xml->free_tag) { xdfree(xml->tag); } if (xml->text) { xdebug_xml_text_node_dtor(xml->text); } xdfree(xml); } xdebug-2.2.3/xdebug_xml.h0000644000175000017500000000604712147043204014573 0ustar derickderick/* +----------------------------------------------------------------------+ | Xdebug | +----------------------------------------------------------------------+ | Copyright (c) 2002-2013 Derick Rethans | +----------------------------------------------------------------------+ | This source file is subject to version 1.0 of the Xdebug license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://xdebug.derickrethans.nl/license.php | | If you did not receive a copy of the Xdebug license and are unable | | to obtain it through the world-wide-web, please send a note to | | xdebug@derickrethans.nl so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ */ #include "xdebug_str.h" #ifndef __HAVE_XDEBUG_XML_H__ #define __HAVE_XDEBUG_XML_H__ typedef struct _xdebug_xml_attribute xdebug_xml_attribute; typedef struct _xdebug_xml_text_node xdebug_xml_text_node; typedef struct _xdebug_xml_node xdebug_xml_node; struct _xdebug_xml_attribute { char *name; char *value; int name_len; int value_len; struct _xdebug_xml_attribute *next; int free_name; int free_value; }; /* todo: support multiple text nodes inside an element */ struct _xdebug_xml_text_node { char *text; int free_value; int encode; int text_len; }; struct _xdebug_xml_node { char *tag; struct _xdebug_xml_text_node *text; struct _xdebug_xml_attribute *attribute; struct _xdebug_xml_node *child; struct _xdebug_xml_node *next; int free_tag; }; #define xdebug_xml_node_init(t) xdebug_xml_node_init_ex((t), 0) #define xdebug_xml_add_attribute_ex(x,a,v,fa,fv) { char *ta = (a), *tv = (v); xdebug_xml_add_attribute_exl((x), (ta), strlen((ta)), (tv), strlen((tv)), fa, fv); } #define xdebug_xml_add_attribute(x,a,v) xdebug_xml_add_attribute_ex((x), (a), (v), 0, 0); xdebug_xml_node *xdebug_xml_node_init_ex(char *tag, int free_tag); void xdebug_xml_add_attribute_exl(xdebug_xml_node* xml, char *attribute, size_t attribute_len, char *value, size_t value_len, int free_name, int free_value); void xdebug_xml_add_child(xdebug_xml_node *xml, xdebug_xml_node *child); void xdebug_xml_add_text_ex(xdebug_xml_node *xml, char *text, int length, int free_text, int encode); void xdebug_xml_add_text(xdebug_xml_node *xml, char *text); void xdebug_xml_add_text_encode(xdebug_xml_node *xml, char *text); #define xdebug_xml_add_textl(x,t,l) xdebug_xml_add_text_ex((x), (t), (l), 1, 0) #define xdebug_xml_add_text_encodel(x,t,l) xdebug_xml_add_text_ex((x), (t), (l), 1, 1) void xdebug_xml_return_node(xdebug_xml_node* node, struct xdebug_str *output); void xdebug_xml_node_dtor(xdebug_xml_node* xml); #endif