summaryrefslogtreecommitdiffstats
path: root/base/debug_util_posix.cc
Commit message (Collapse)AuthorAgeFilesLines
* Changes to base/ from a combination of FreeBSD and OpenBSD patches.evan@chromium.org2009-12-291-1/+9
| | | | | | Review URL: http://codereview.chromium.org/495002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35321 0039d316-1c4b-4281-b951-d872f2087c98
* Demangle C++ symbols in stack traces for Linux.evan@chromium.org2009-10-141-1/+66
| | | | | | | | | | | | | | | | | | | | | | | | | My first Chromium linux build greeted me with a backtrace of mangled symbols (FWIW, my /dev/shm permission was wrong). That made me write this patch. BEFORE: ../sconsbuild/Debug/base_unittests(_ZN10StackTraceC1Ev+0x20) [0x817795e] ../sconsbuild/Debug/base_unittests(_ZN30StackTrace_OutputToStream_Test8TestBodyEv+0x18) [0x805fc98] ../sconsbuild/Debug/base_unittests(_ZN7testing4Test3RunEv+0x7e) [0x82005ea] AFTER: ../sconsbuild/Debug/base_unittests(StackTrace::StackTrace()+0x20) [0x817778c] ../sconsbuild/Debug/base_unittests(StackTrace_OutputToStream_Test::TestBody()+0x18) [0x805fc98] ../sconsbuild/Debug/base_unittests(testing::Test::Run()+0x7e) [0x8200786] BUG=none TEST=manually tested. also ran base_unittests Review URL: http://codereview.chromium.org/267074 Patch from Satoru Takabayashi <satorux@gmail.com>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28940 0039d316-1c4b-4281-b951-d872f2087c98
* Eliminate all uses of strerror() in code that uses src/base. strerror() is ↵tschmelcher@chromium.org2009-10-131-1/+2
| | | | | | | | | | | inherently unsafe in multi-threaded apps because it stores the string in a global buffer. It should never be used. If you want to log an error, use PLOG and friends, or if that's too high-level then use safe_strerror(). TEST=built on Linux in 32-bit and 64-bit mode; ran base_unittests in each case; ran Chromium itself in each case; try servers BUG=none Review URL: http://codereview.chromium.org/261055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28850 0039d316-1c4b-4281-b951-d872f2087c98
* Explicitly compare to NULL when looking for weak_import symbols.craig.schlenter@chromium.org2009-09-181-3/+3
| | | | | | | | | | | | | | Changing the comparison form affects the warning messages generated in various circumstances. See the codereview for details. Also, Apple docs claim that !symbol comparisons will not work. Spotted by Matthew Vosburgh. Review URL: http://codereview.chromium.org/214012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26569 0039d316-1c4b-4281-b951-d872f2087c98
* A build fix for gcc 4.3 (and later).craig.schlenter@chromium.org2009-09-171-25/+35
| | | | | | | | | | | | Comparing a function with NULL has been prohibited since gcc 4.3 and produces a compilation error. This change encloses your code which compares a function with NULL with "#if defined(OS_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5" and "#endif". BUG=none TEST=build chromium with gcc 4.3 (and later) Review URL: http://codereview.chromium.org/206024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26449 0039d316-1c4b-4281-b951-d872f2087c98
* Revert r26431.craig.schlenter@chromium.org2009-09-171-6/+0
| | | | | | | | | It broke the tree which seems unrelated but Mark also wants hbono's patch landed instead of this one. Review URL: http://codereview.chromium.org/211007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26432 0039d316-1c4b-4281-b951-d872f2087c98
* Squash warnings about backtrace et. al. not being NULL on Linux.craig.schlenter@chromium.org2009-09-171-0/+6
| | | | | | | | | The warnings are legit but it seems cleaner to do this than to do tons of #if defined(OS_MACOSX) bits to handle the changes from r26285. Review URL: http://codereview.chromium.org/206026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26431 0039d316-1c4b-4281-b951-d872f2087c98
* Changes needed for MacOS X 10.4 support.maf@google.com2009-09-151-20/+28
| | | | | | | | Add "support_macosx_10_4" option to common.gypi that causes it to change deployment target, and define a new preprocessor symbol on the Mac build. Setting this flag to true is harmless on non Mac builds and has no effect. Make various changes to source files where they modify their behavior in the presence of the new preprocessor symbol to become 10.4 compatible. Review URL: http://codereview.chromium.org/201122 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26285 0039d316-1c4b-4281-b951-d872f2087c98
* Move StringPiece into the base namespace. It is collidingtony@chromium.org2009-09-101-4/+4
| | | | | | | | | | with the StringPiece class in icu4.2, which is a problem when trying to use the system version of icu. Review URL: http://codereview.chromium.org/193072 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25920 0039d316-1c4b-4281-b951-d872f2087c98
* Print stack trace on exception in unit tests on Windows.maruel@chromium.org2009-09-081-18/+6
| | | | | | | | | | Also remove std::vector<> from StackTrace to reduce heap usage during potential unstable execution. TEST=none BUG=http://crbug.com/20996 Review URL: http://codereview.chromium.org/201050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25685 0039d316-1c4b-4281-b951-d872f2087c98
* Implement BreakDebugger for ARM.deanm@chromium.org2009-05-071-2/+4
| | | | | | | Review URL: http://codereview.chromium.org/115087 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15548 0039d316-1c4b-4281-b951-d872f2087c98
* Lands http://codereview.chromium.org/99349 for Ryan.sky@chromium.org2009-05-041-0/+2
| | | | | | | | | | | | | | Comments from Ryan: Some small changes to get chromium building on ARM. I tested these using the standard Linux tool chain and crosstools-ng. BUG=none TEST=none Review URL: http://codereview.chromium.org/99365 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15241 0039d316-1c4b-4281-b951-d872f2087c98
* POSIX: Add a macro for handling EINTR.agl@chromium.org2009-05-011-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On POSIX systems, system calls can be interrupted by signals. In this case, they'll return EINTR, indicating that the system call needs to be restarted. (The situation is a little more complicated than this with SA_RESTART, but you can read man 7 signal if you like.) The short of it is that you need to catch EINTR and restart the call for these system calls: * read, readv, write, writev, ioctl * open() when dealing with a fifo * wait* * Anything socket based (send*, recv*, connect, accept etc) * flock and lock control with fcntl * mq_ functions which can block * futex * sem_wait (and timed wait) * pause, sigsuspend, sigtimedwait, sigwaitinfo * poll, epoll_wait, select and 'p' versions of the same * msgrcv, msgsnd, semop, semtimedop * close (although, on Linux, EINTR won't happen here) * any sleep functions (careful, you need to handle this are restart with different arguments) We've been a little sloppy with this until now. This patch adds a macro for dealing with this and corrects every case of these system calls (that I found). The macro is HANDLE_EINTR in base/eintr_wrapper.h. It's safe to include on Windows and is a no-op there. On POSIX, it uses GCC magic to return the correct type based on the expression and restarts the system call if it throws EINTR. And you can use it like: HANDLE_EINTR(close(fd)); Or: ssize_t bytes_read = HANDLE_EINTR(read(fd, buffer, len)); *BEWARE* that it will evaluate the argument multiple times, so this is not safe: HANDLE_EINTR(close(FireMissiles())); http://groups.google.com/group/chromium-dev/browse_thread/thread/41a35b2a457d73a0 http://codereview.chromium.org/100225 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15102 0039d316-1c4b-4281-b951-d872f2087c98
* Print backtraces on FATAL log messages in debug mode.ajwong@chromium.org2009-04-241-4/+34
| | | | | | | | This provides basic support for looking up backtrace information on GNU libc systems and in Windows. The code is only enabled for FATAL log messages in debug mode. In a release build, it is unlikely that symbols will be available making the backtrace less useful. Review URL: http://codereview.chromium.org/62140 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14391 0039d316-1c4b-4281-b951-d872f2087c98
* Some fixes to ease debugging of the renderer process on OS X.jeremy@chromium.org2009-02-051-3/+17
| | | | | | Review URL: http://codereview.chromium.org/21084 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9225 0039d316-1c4b-4281-b951-d872f2087c98
* "Port" StackTrace to Macmark@chromium.org2009-01-161-26/+2
| | | | | | Review URL: http://codereview.chromium.org/18173 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8229 0039d316-1c4b-4281-b951-d872f2087c98
* Mac build fixagl@chromium.org2009-01-161-1/+1
| | | | | | | Review URL: http://codereview.chromium.org/18332 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8222 0039d316-1c4b-4281-b951-d872f2087c98
* Add StackTrace debugging utility class.agl@chromium.org2009-01-161-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the moment, it only works on Linux, although it should be pretty easy to get it working on Mac with __builtin_return_address and __builtin_frame_address. It will mostly fail to resolve functions. Use this wrapper script: import os import sys import subprocess import re address = re.compile('.*\[(0x[0-9a-fA-F]{4,8})\].*') if __name__ == '__main__': p = subprocess.Popen(sys.argv[1:], stderr = subprocess.STDOUT, stdout = subprocess.PIPE) addr2line = subprocess.Popen(['addr2line', '-e', sys.argv[1], '-f', '-C', '-s'], stdout = subprocess.PIPE, stdin = subprocess.PIPE) for line in p.stdout.readlines(): m = address.match(line); if m is not None: addr2line.stdin.write(m.groups()[0] + '\n') function = addr2line.stdout.readline()[:-1] location = addr2line.stdout.readline()[:-1] sys.stdout.write('%s (%s)\n' % (function, location)) else: sys.stdout.write(line) Review URL: http://codereview.chromium.org/18303 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8218 0039d316-1c4b-4281-b951-d872f2087c98
* Add Mac BeingDebugged implementationmark@chromium.org2008-10-081-7/+33
| | | | | | Review URL: http://codereview.chromium.org/6582 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3009 0039d316-1c4b-4281-b951-d872f2087c98
* Move NOTIMPLEMENTED() macro from "base/notimplemented.h" into "base/logging.h".ericroman@google.com2008-08-251-1/+1
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1300 0039d316-1c4b-4281-b951-d872f2087c98
* Use a more compact license header in source files.license.bot2008-08-241-28/+4
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1287 0039d316-1c4b-4281-b951-d872f2087c98
* Make debug_util cross platform, adding BeingDebugged and BreakDebugger. Linuxdeanm@google.com2008-08-131-0/+90
supported added, and Mac OSX left as a todo for the mac team. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@785 0039d316-1c4b-4281-b951-d872f2087c98