Commit Graph

70 Commits (1855990fa804e3b54af64422d9f46e14e13726b1)

Author SHA1 Message Date
Freddie Witherden 18870edfd6 Revert r6921. The newline character on OS X is \n, only OS 9 used \r, which we do not target.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6922 4a71c877-e1ca-e34f-864e-861f7616d084
2009-03-30 16:10:59 +02:00
Giel van Schijndel 12eccf9d4c An end of line character is "\r" on the Mac
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6921 4a71c877-e1ca-e34f-864e-861f7616d084
2009-03-30 16:10:59 +02:00
Giel van Schijndel f179b6f092 Allow compiling and linking with lib/framework/stdio_ext.h and src/version.h from C++ code
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6920 4a71c877-e1ca-e34f-864e-861f7616d084
2009-03-30 16:10:59 +02:00
Dennis Schridde aac41748dc Bump copyright
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6617 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-10 18:01:48 +00:00
Dennis Schridde cbbc58d1e9 Move files which extend a c std library header to a filename of similar name
Extension functions dealing with ...
 * strings are in string_ext.h
 * stdio (namely printf variants) are in stdio_ext.h
 * math are in math_ext.h

These headers are no longer included by frame.h

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6613 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-10 17:23:09 +00:00
Giel van Schijndel 94cf481e0f Override operator<< for std::ostream (left operand) and PHYSFS_Version (right operand) instead of using a plain function to perform the version formatting
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6578 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-01 12:13:00 +00:00
Giel van Schijndel db0e543f40 * Fix warnings about "possibly dangerous code" added in r6570:
- Don't ignore write(2)'s return value, instead handle it properly to deal with the cases where write(2) gets interrupted (by a signal) or returns prematurely because of non-blocking I/O
  - Properly handle popen(3) returning NULL
 * Don't assume the data written to stdout by "which" will just fit in our buffer

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6577 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-01 11:54:25 +00:00
Dennis Schridde d585762747 Add a few warnings about possibly dangerous code
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6570 4a71c877-e1ca-e34f-864e-861f7616d084
2009-01-31 15:51:39 +00:00
Giel van Schijndel 0723d7a5b9 Fix compiling on MSVC:
* Use C89 style variable declarations (i.e. at the beginning of scope-blocks)
 * Use a proper set of #include paths

This should fix #160, patch by <i-NoD> slightly modified by me (moved variable declarations to the most local scope where used)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6385 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-25 23:53:44 +00:00
Giel van Schijndel a47f0e94a7 Oops, need to copy filename template into template buffer (see r6214, r6217)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6218 4a71c877-e1ca-e34f-864e-861f7616d084
2008-10-25 22:16:13 +00:00
Giel van Schijndel a5c5328609 Make sure we take sizeof(array), not sizeof(pointer)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6217 4a71c877-e1ca-e34f-864e-861f7616d084
2008-10-25 22:11:43 +00:00
Giel van Schijndel 0269d11d16 In the exception handler:
* use mkstemp(3) to create a temporary file that's guaranteed not to exist already

Prevents a potential symlink attack (e.g. where /tmp/warzone2100.gdmp is symlinked by user A to a file owned by user B, then having user B crash warzone)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6214 4a71c877-e1ca-e34f-864e-861f7616d084
2008-10-25 21:47:00 +00:00
Giel van Schijndel 55aaffac40 Construct programPath from the iterators of "buf" not from a char* pointer
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6152 4a71c877-e1ca-e34f-864e-861f7616d084
2008-10-14 13:00:36 +00:00
Giel van Schijndel 0c1a577ee7 * Use GlobalAlloc and GlobalFree instead of malloc() and free() respectively
Do this because we cannot trust malloc()'s heaps to be intact at the time an exception handler gets called.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6146 4a71c877-e1ca-e34f-864e-861f7616d084
2008-10-13 15:41:50 +00:00
Giel van Schijndel 810fac209b * Wrap all file lists in the automake and win32 makefiles across lines such that there's only one file on each line
* Alphabetically sort the file lists

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6144 4a71c877-e1ca-e34f-864e-861f7616d084
2008-10-13 13:04:37 +00:00
Giel van Schijndel fd0084951e Prevent some infinite recursion
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5867 4a71c877-e1ca-e34f-864e-861f7616d084
2008-08-24 16:13:20 +00:00
Giel van Schijndel 2b572a9492 Work around the fact that on FreeBSD POLL_ERR and POLL_HUP are defined to the same value
This problem is similar to DebianBug:492786

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5795 4a71c877-e1ca-e34f-864e-861f7616d084
2008-08-11 15:29:51 +00:00
Giel van Schijndel 11cd7ac69f Fix the MSVC project for compiling lib/exceptionhandler
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5712 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-29 21:27:17 +00:00
Roman C f1c2eacb00 Fix release build on MSVC. Patch by Buginator.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5676 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-26 20:41:16 +00:00
Giel van Schijndel 0651625733 * Remove unused variable `line_num`
* win32 Makefile system:
  * Compile with debug symbols and all warnings enabled on both debug ''and'' non-debug builds
  * Only use -Werror-implicit-function-declaration when compiling C sources, as for C++ implicit function declarations are illegal anyway (and g++ thus doesn't like this compiler option)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5647 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-23 13:59:12 +00:00
Giel van Schijndel 1feee6ea95 Replace uses of "\n" and std::endl with uses of constant `endl`, which is defined to the platform's native line ending.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5620 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-20 22:46:50 +00:00
Giel van Schijndel d451b3f5a1 Remove the terminating newline ('\n') from ctime's output to allow different newline styles (e.g. "\r\n" on Windows)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5619 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-20 22:46:46 +00:00
Giel van Schijndel e029c11bb4 In the MinGW stack dumper, use dbgDumpHeader to dump a generic debug info header, instead of custom crafted (and duplicated) code.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5618 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-20 22:46:26 +00:00
Giel van Schijndel 461c6f1002 Don't #include debug.h as we depend on dumpinfo.h instead (thus #include that file instead)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5612 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-20 15:27:17 +00:00
Giel van Schijndel ed3f1508b8 * Remove the dumpLog function and associated code from debug.c
* Add a new function dbgDumpLog to dumpinfo.cpp for dumping the last debug messages
 * Add a debug output callback to dumpinfo.cpp which is used to fetch the debug messages and store them in a ring buffer


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5581 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-19 01:08:07 +00:00
Giel van Schijndel ec4784973e Add the used command line to crash dump reports
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5536 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-13 21:26:09 +00:00
Giel van Schijndel 83b63b71b9 Add PhysicsFS version info to crash dump files
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5535 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-13 21:01:28 +00:00
Dennis Schridde 022315eef0 Hardcode top_srcdir to make building from non-topdir possible, dont depend on the touch command, fix LDFLAGS to not depend on the removed TARGET variable
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5476 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-10 20:10:16 +00:00
Dennis Schridde 302a557478 Rename "raw" Makefiles to "win32" Makefiles
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5402 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-06 14:29:04 +00:00
Giel van Schijndel a4e8c96977 Move the code to spawn GDB, and arrange for a communication pipe, to a separate function: execGdb
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5391 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-04 22:41:33 +00:00
Giel van Schijndel 619e1e1943 * Deal with a failure of exeve() by writing a debug message indicating that it failed and terminating the child of our fork()
* Flush the write end of the pipe after writing all GDB commands into it
 * Process the return data (both return value and the contents of the output integer) from waitpid()

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5390 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-04 22:41:25 +00:00
Giel van Schijndel 2d6615a30a Refactor function gdbExtendedBacktrace:
* return as soon as an error condition is detected, thus preventing the need for deep nested if-branches.
 * Add some additional comments
 * Return true or false, false indicating an error, true indicating success

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5389 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-04 22:41:17 +00:00
Giel van Schijndel 6953f0fd6d Move the code that provides GDB backtraces in a function of its own to refactor it later (i.e. get rid of the deep if-branch nesting)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5388 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-04 22:41:07 +00:00
Giel van Schijndel aadfec4677 Document the gdb commands; what they do and why they're there
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5387 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-04 22:41:00 +00:00
Giel van Schijndel 38eea0b640 The syscall open() returns -1 on an error *not* 0, as 0 is a *valid* file descriptor:
* Thus check for a return value of -1, not 0

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5386 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-04 22:40:52 +00:00
Giel van Schijndel f8e5f8ddb8 * Don't duplicate code just because there's a single platform (Mac OSX) on which it isn't used
* Instead compile that code on all platforms except for the given one (Mac OSX)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5385 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-04 22:40:43 +00:00
Giel van Schijndel 43bdd9575d Factor out the code to retrieve absolute program paths and move it into a separate function of its own: fetchProgramPath
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5384 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-04 22:40:20 +00:00
Giel van Schijndel fd6b6262ba Apply patch #1078: Expand the GDB exceptionhandler.
With our current backtrace dumps I quite oftenly find that in case of segfaults, which combined with assert failures are the most common crash cause, I cannot easily see what value the dereferenced pointer held.

To be able to see this the exception handler will now invoke the "disassemble" and "info registers" commands when producing a back trace using GDB. This gives us the ability to see the precise assembly instruction that triggered the crash, together with the value of the register that was used as pointer.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5352 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-01 20:40:40 +00:00
Dennis Schridde 45f23a4926 Merge commit 'HEAD@{3}'
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5347 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-28 22:32:44 +00:00
Dennis Schridde 050ec39c11 Use the (also new in this commit) relative variants of the directories almost everywhere.
Exception is when generating the .wz files, where we need the path to the build directory and building a reverse relative path to $(srcdir) will be messy.
Also silence submake.mk a great deal.
Bug #11883 should be fixed now for the most part.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5325 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-24 23:41:52 +00:00
Dennis Schridde fd2bfb0e0f Prepare for another fix for parts of bug #11883: Issues with the improved raw Makefiles
- Rename Makefile.raw to lowercase


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5321 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-24 22:48:45 +00:00
Dennis Schridde 73b35ab8d6 Rename top_srcdir/top_builddir to abs_top_srcdir/abs_top_builddir, to make this more obvious.
Their use is currently flawed, since it will not work in directories with spaces in them... (


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5319 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-24 20:19:54 +00:00
Dennis Schridde 9bd8b24921 Boost raw Makefiles
- Use PACKAGE, PACKAGE_VERSION, remove VERSION
- Allow out-of-source-dir builds (mkdir build && cd build && make -f ../Makefile.raw)
- Move config.mk from $(top_srcdir)/makerules/config.mk to $(top_builddir)/config.mk
   When keeping current behaviour (srcdir=builddir), this means: Move it from makerules into the main directory


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5308 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-23 13:54:47 +00:00
Giel van Schijndel 05d71e2b19 Don't bother warning about some unused parameters in exchndl.c
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5239 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-09 19:58:56 +00:00
Giel van Schijndel f6693eebdf Fix a typo strrcat => sstrcat
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5183 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-25 15:42:02 +00:00
Giel van Schijndel 855ec725d4 Use sstrcpy|sstrcat instead of strlcpy|strlcat for manipulation of statically sized strings
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5176 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-25 13:46:49 +00:00
Giel van Schijndel bfb035d41a Merge r4804 from the 2.1 branch into trunk (except for the removal of the SQLite stuff from the XCode projectfile)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4849 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-28 21:41:12 +00:00
Giel van Schijndel fbf8efefde Only truncate the programPath if it's followed by an EOL
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4847 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-28 21:16:51 +00:00
Giel van Schijndel 0555874c44 Pass programCommand to dbgDumpInit() so that it can use that to set up debug dump info
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4844 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-28 20:45:28 +00:00
Giel van Schijndel 61c8bbc4b9 * Don't "Guarantee nul-termination" after snprintf as snprintf does that itself already (per the C99 spec)
* Use strlcpy for copying strings instead of snprintf "%s"
 * Don't cast the return value from vsnprintf to (void)
 * When we use va_start make sure to use va_end as well...
 * Fix indentation


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4785 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-26 14:21:41 +00:00