[llvm-commits] [llvm] r112705 - in /llvm/trunk: include/llvm/System/Signals.h lib/System/Unix/Signals.inc lib/System/Win32/Signals.inc

NAKAMURA Takumi geek4civic at gmail.com
Wed Oct 20 23:07:54 PDT 2010


Good afternoon, Dan.

I knew why bugpoint stalls on mingw.

DontRemoveFileOnSignal() did not acquire the CriticalSection.
Please take a look into my patch.

Thank you in advance, ...Takumi


PASS: LLVM :: BugPoint/crash-narrowfunctiontest.ll (1 of 4)
PASS: LLVM :: BugPoint/metadata.ll (2 of 4)
PASS: LLVM :: BugPoint/remove_arguments_test.ll (3 of 4)
PASS: LLVM :: Feature/load_module.ll (4 of 4)


2010/9/1 Dan Gohman <gohman at apple.com>:
> Author: djg
> Date: Wed Sep  1 09:17:34 2010
> New Revision: 112705
>
> URL: http://llvm.org/viewvc/llvm-project?rev=112705&view=rev
> Log:
> Add an interface for unregistering a file from the FilesToRemove list.
>
> Modified:
>    llvm/trunk/include/llvm/System/Signals.h
>    llvm/trunk/lib/System/Unix/Signals.inc
>    llvm/trunk/lib/System/Win32/Signals.inc
>
> Modified: llvm/trunk/include/llvm/System/Signals.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Signals.h?rev=112705&r1=112704&r2=112705&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/System/Signals.h (original)
> +++ llvm/trunk/include/llvm/System/Signals.h Wed Sep  1 09:17:34 2010
> @@ -29,6 +29,10 @@
>   /// @brief Remove a file if a fatal signal occurs.
>   bool RemoveFileOnSignal(const Path &Filename, std::string* ErrMsg = 0);
>
> +  /// This function removes a file from the list of files to be removed on
> +  /// signal delivery.
> +  void DontRemoveFileOnSignal(const Path &Filename);
> +
>   /// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the
>   /// process, print a stack trace and then exit.
>   /// @brief Print a stack trace if a fatal signal occurs.
>
> Modified: llvm/trunk/lib/System/Unix/Signals.inc
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Signals.inc?rev=112705&r1=112704&r2=112705&view=diff
> ==============================================================================
> --- llvm/trunk/lib/System/Unix/Signals.inc (original)
> +++ llvm/trunk/lib/System/Unix/Signals.inc Wed Sep  1 09:17:34 2010
> @@ -182,6 +182,16 @@
>   return false;
>  }
>
> +// DontRemoveFileOnSignal - The public API
> +void llvm::sys::DontRemoveFileOnSignal(const sys::Path &Filename) {
> +  SignalsMutex.acquire();
> +  std::vector<sys::Path>::reverse_iterator I =
> +    std::find(FilesToRemove.rbegin(), FilesToRemove.rend(), Filename);
> +  if (I != FilesToRemove.rend())
> +    FilesToRemove.erase(I.base()-1);
> +  SignalsMutex.release();
> +}
> +
>  /// AddSignalHandler - Add a function to be called when a signal is delivered
>  /// to the process.  The handler can have a cookie passed to it to identify
>  /// what instance of the handler it is.
>
> Modified: llvm/trunk/lib/System/Win32/Signals.inc
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Signals.inc?rev=112705&r1=112704&r2=112705&view=diff
> ==============================================================================
> --- llvm/trunk/lib/System/Win32/Signals.inc (original)
> +++ llvm/trunk/lib/System/Win32/Signals.inc Wed Sep  1 09:17:34 2010
> @@ -140,6 +140,20 @@
>   return false;
>  }
>
> +// DontRemoveFileOnSignal - The public API
> +void sys::DontRemoveFileOnSignal(const sys::Path &Filename) {
> +  if (FilesToRemove == NULL)
> +    return;
> +
> +  FilesToRemove->push_back(Filename);
> +  std::vector<sys::Path>::reverse_iterator I =
> +  std::find(FilesToRemove->rbegin(), FilesToRemove->rend(), Filename);
> +  if (I != FilesToRemove->rend())
> +    FilesToRemove->erase(I.base()-1);
> +
> +  LeaveCriticalSection(&CriticalSection);
> +}
> +
>  /// PrintStackTraceOnErrorSignal - When an error signal (such as SIBABRT or
>  /// SIGSEGV) is delivered to the process, print a stack trace and then exit.
>  void sys::PrintStackTraceOnErrorSignal() {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Win32-Signals-DontRemoveFileOnSignal.patch
Type: application/octet-stream
Size: 742 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20101021/5a72c083/attachment.obj>


More information about the llvm-commits mailing list