[cfe-commits] r111855 - /cfe/trunk/tools/libclang/CIndex.cpp
Daniel Dunbar
daniel at zuster.org
Mon Aug 23 15:35:34 PDT 2010
Author: ddunbar
Date: Mon Aug 23 17:35:34 2010
New Revision: 111855
URL: http://llvm.org/viewvc/llvm-project?rev=111855&view=rev
Log:
libclang: Print more information when recovering from crashes in
clang_parseTranslationUnit.
Modified:
cfe/trunk/tools/libclang/CIndex.cpp
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=111855&r1=111854&r2=111855&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Mon Aug 23 17:35:34 2010
@@ -1491,7 +1491,26 @@
llvm::CrashRecoveryContext CRC;
if (!CRC.RunSafely(clang_parseTranslationUnit_Impl, &PTUI)) {
- fprintf(stderr, "libclang: crash detected during parsing");
+ fprintf(stderr, "libclang: crash detected during parsing: {\n");
+ fprintf(stderr, " 'source_filename' : '%s'\n", source_filename);
+ fprintf(stderr, " 'command_line_args' : [");
+ for (int i = 0; i != num_command_line_args; ++i) {
+ if (i)
+ fprintf(stderr, ", ");
+ fprintf(stderr, "'%s'", command_line_args[i]);
+ }
+ fprintf(stderr, "],\n");
+ fprintf(stderr, " 'unsaved_files' : [");
+ for (unsigned i = 0; i != num_unsaved_files; ++i) {
+ if (i)
+ fprintf(stderr, ", ");
+ fprintf(stderr, "('%s', '...', %ld)", unsaved_files[i].Filename,
+ unsaved_files[i].Length);
+ }
+ fprintf(stderr, "],\n");
+ fprintf(stderr, " 'options' : %d,\n", options);
+ fprintf(stderr, "}\n");
+
return 0;
}
More information about the cfe-commits
mailing list