Commit Graph

40 Commits

Author SHA1 Message Date
Jeffrey Yasskin
b7ccf75de5 Fix a false-positive memory leak in code using RemoveFileOnSignal(). Because
libstdc++'s std::string class points to the interior of an allocation, valgrind
reports strings still alive at program termination as possible leaks.  I didn't
use a ManagedStatic for this because System can't depend on Support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98716 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 07:08:12 +00:00
Chris Lattner
782ab584e5 follow-on to PR6280
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96172 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-14 18:20:09 +00:00
Chris Lattner
6ae7bbb5ea improve support for minix, PR6280, patch by
Kees van Reeuwijk!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95946 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 00:37:46 +00:00
Dan Gohman
0b81e19d19 Most stack straces don't need 3 digits worth of levels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85575 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 02:45:10 +00:00
Owen Anderson
6ae8c73aca Add locking around signal handler registration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79254 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-17 17:07:22 +00:00
Chris Lattner
b7253150ab fix PR3965:SIGINT handler not restored after calling ParseAST(),
patch by Alexei Svitkine!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 23:33:13 +00:00
Chris Lattner
a8bd27ff66 fix a bug Alexei Svitkine pointed out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67510 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 06:46:20 +00:00
Chris Lattner
eab5cb3b55 When we restore signal handlers, restore them back to what they
were when we came around, not to their default handler.  This 
should fix PR3848


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67509 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 05:55:36 +00:00
Chris Lattner
1c4d8a00ab factorize signal registration, part of PR3848.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67508 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 05:42:29 +00:00
Chris Lattner
f48ba7b74c add some explicit llvm:: qualifiers to the unix side, fix problems on the windows side.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66386 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 19:13:45 +00:00
Chris Lattner
922a881f32 When a crash signal is delivered do two things: remove all of our
signal handlers to prevent reentrance on unrelated things (a sigabort
where the handle bus errors) also, clear the signal mask so that the
signal doesn't infinitely reissue.  This fixes rdar://6654827 -
Crash causes clang to loop



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66330 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 08:15:47 +00:00
Chris Lattner
0f6290d698 move some code to gracefully handle the case when a handler crashes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66171 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 18:22:14 +00:00
Chris Lattner
35033a5876 Add a new 'AddSignalHandler' function to Signals.h that allows
arbitrary functions to be run when a crash happens.  Delete 
RemoveDirectoryOnSignal as it is dead and has never had clients.

Change PrintStackTraceOnErrorSignal to be implemented in terms of
AddSignalHandler.

I updated the Win32 versions of these APIs, but can't test them.
If there are any problems, I'd be happy to fix them as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66072 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 21:21:36 +00:00
Dan Gohman
d4e1845849 Use const, to support platforms where strrchr returns a const char *.
This fixes PR3535.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64224 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-10 17:56:28 +00:00
Dan Gohman
dd17b25611 Don't use plain %x to print pointer values. I had changed it from %p
since %p isn't formatted consistently, but obviously plain %x is wrong.
PRIxPTR with a cast to uintptr_t would work here, but that requires
inconvenient build-system changes. %lu works on all current and
foreseable future hosts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60616 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 23:39:24 +00:00
Dan Gohman
56d9b6dff3 Demangle and pretty-print symbols in internal backtraces. Patch by
Wesley Peck, with a few fixes by me.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 20:12:48 +00:00
Dan Gohman
4d9dd6beae Make PreVerifyID, IntSigsEnd, and KillSigsEnd const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51088 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-14 00:42:30 +00:00
Evan Cheng
34cd4a484e Fix more -Wshorten-64-to-32 warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50659 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 18:30:58 +00:00
Dan Gohman
3bd659ba20 Make several symbols static.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49496 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 21:11:47 +00:00
Dan Gohman
32f3b19a06 Avoid calling array_endof in a static initializer, as it incurs
dynamic initialization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48666 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 23:44:21 +00:00
Lauro Ramos Venancio
2e78b7879d It is not safe to call fork in PrintStackTrace. Sometimes it freezes the program.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47161 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-15 18:05:54 +00:00
Chris Lattner
4ee451de36 Remove attribution from file headers, per discussion on llvmdev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:36:04 +00:00
Owen Anderson
718cb665ca Add lengthof and endof templates that hide a lot of sizeof computations.
Patch by Sterling Stein!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41758 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-07 04:06:50 +00:00
Reid Spencer
2ae9d11b7c For PR1291:
Implement the PathWithStatus class and its use throughout lib/System.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35742 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 18:52:17 +00:00
Reid Spencer
8475ec068c For PR789:
Make the sys::Path::getFileStatus function more efficient by having it
return a pointer to the FileStatus structure rather than copy it. Adjust
uses of the function accordingly. Also, fix some memory issues in sys::Path.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35476 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-29 19:05:44 +00:00
Reid Spencer
0554575567 For PR797:
Make the Win32 code exception free (untested/uncompiled) which forced some
interface changes which had ripple effect. This should be the last of 797.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29884 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-25 21:37:17 +00:00
Reid Spencer
25259a3149 Remove extraneous #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29541 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-07 05:36:24 +00:00
Reid Spencer
a8e80c5188 Make the removal of files use Path::eraseFromDisk just like it does for
the removal of directories. Using std::remove is indiscriminate and can
lead to the removal of things like /dev/null if run as root. The
Path::eraseFromDisk method ensures that we only ever remove regular files
or directories, but never character or block special nodes.  This should
clear up the problem with usage like: llvm-as -o /dev/null which is used
in the llvm-test makefiles.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29540 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-07 05:34:08 +00:00
Chris Lattner
8961501c9b Use getFileStatus instead of Path::isDirectory().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29443 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-01 17:59:14 +00:00
Reid Spencer
dc6830ff25 Only print the stack trace if it was requested. Previously, any call into
the Signals module that registered the handlers would cause the stack trace
to be generated. Now, you must explicitly call PrintStackTraceOnErrorSignal
in order for that to happen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28810 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-16 00:00:57 +00:00
Chris Lattner
fa8c292ebd Implement sys::SetInterruptFunction on Unix, stub it on win32 so that the
build will not fail


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22578 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 02:14:22 +00:00
Reid Spencer
a229c5cce7 Final Changes For PR495:
This chagne just renames some sys::Path methods to ensure they are not
misused. The Path documentation now divides methods into two dimensions:
Path/Disk and accessor/mutator. Path accessors and mutators only operate
on the Path object itself without making any disk accesses. Disk accessors
and mutators will also access or modify the file system. Because of the
potentially destructive nature of disk mutators, it was decided that all
such methods should end in the work "Disk" to ensure the user recognizes
that the change will occur on the file system. This patch makes that
change. The method name changes are:

makeReadable        -> makeReadableOnDisk
makeWriteable       -> makeWriteableOnDisk
makeExecutable      -> makeExecutableOnDisk
setStatusInfo       -> setStatusInfoOnDisk
createDirectory     -> createDirectoryOnDisk
createFile          -> createFileOnDisk
createTemporaryFile -> createTemporaryFileOnDisk
destroy             -> eraseFromDisk
rename              -> renamePathOnDisk

These changes pass the Linux Deja Gnu tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22354 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 03:08:58 +00:00
Reid Spencer
dd04df0ec3 For PR495:
Get rid of the difference between file paths and directory paths. The Path
class now simply stores a path that can refer to either a file or a
directory. This required various changes in the implementation and interface
of the class with the corresponding impact to its users. Doxygen comments were
also updated to reflect these changes. Interface changes are:

appendDirectory -> appendComponent
appendFile -> appendComponent
elideDirectory -> eraseComponent
elideFile -> eraseComponent
elideSuffix -> eraseSuffix
renameFile -> rename
setDirectory -> set
setFile -> set

Changes pass Dejagnu and llvm-test/SingleSource tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22349 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 23:21:43 +00:00
Misha Brukman
6b8a63ae58 Remove vim settings from source code; people should use llvm/utils/vim/vimrc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21704 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 22:33:09 +00:00
Alkis Evlogimenos
38da41cc44 Silence gcc-4.0.0 warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21453 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 17:56:01 +00:00
Reid Spencer
cdf54d04c7 For PR351:
* Ensure #includes are wrapped with appropriate HAVE_ guards


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19156 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-27 06:16:52 +00:00
Reid Spencer
1fce09125c Path::get -> Path::toString
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18785 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 00:14:15 +00:00
Reid Spencer
944655922e Update for prototype changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17781 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 22:09:22 +00:00
Reid Spencer
07adb2836b Stop propagating method names that violate the coding standard
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17498 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-05 22:15:36 +00:00
Reid Spencer
496c277a6d Initial platform independent implementation of operating system concept
of "Signals" (cleanup after fatal errors).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16085 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-29 19:22:48 +00:00