[llvm] r194060 - Suppress OS crash dialog in llvm-rtdyld

Alp Toker alp at nuanti.com
Tue Nov 5 01:50:01 PST 2013


Incidentally, this is a pattern common to most of the tools..

|// Print a stack trace if we signal out.||
||sys::PrintStackTraceOnErrorSignal();||
||PrettyStackTraceProgram X(argc, argv);||
||llvm_shutdown_obj Y;  // Call llvm_shutdown() on exit.||
||cl::ParseCommandLineOptions(argc, argv, "llvm dwarf dumper\n");|

Could be rolled up into a more idiomatic LLVMProgram RAII object.

Alp.


On 05/11/2013 09:33, Alp Toker wrote:
> Author: alp
> Date: Tue Nov  5 03:33:43 2013
> New Revision: 194060
>
> URL: http://llvm.org/viewvc/llvm-project?rev=194060&view=rev
> Log:
> Suppress OS crash dialog in llvm-rtdyld
>
> All other tools have this -- it's needed to avoid hanging lit on Windows in
> case of a crash.
>
> Modified:
>     llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
>
> Modified: llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp?rev=194060&r1=194059&r2=194060&view=diff
> ==============================================================================
> --- llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp (original)
> +++ llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp Tue Nov  5 03:33:43 2013
> @@ -22,6 +22,8 @@
>  #include "llvm/Support/ManagedStatic.h"
>  #include "llvm/Support/Memory.h"
>  #include "llvm/Support/MemoryBuffer.h"
> +#include "llvm/Support/PrettyStackTrace.h"
> +#include "llvm/Support/Signals.h"
>  #include "llvm/Support/raw_ostream.h"
>  #include "llvm/Support/system_error.h"
>  using namespace llvm;
> @@ -239,6 +241,9 @@ static int executeInput() {
>  }
>  
>  int main(int argc, char **argv) {
> +  sys::PrintStackTraceOnErrorSignal();
> +  PrettyStackTraceProgram X(argc, argv);
> +
>    ProgramName = argv[0];
>    llvm_shutdown_obj Y;  // Call llvm_shutdown() on exit.
>  
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-- 
http://www.nuanti.com
the browser experts

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131105/257758e7/attachment.html>


More information about the llvm-commits mailing list