[llvm] r288722 - [pdb] handle missing pdb streams more gracefully

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 5 15:26:33 PST 2016


On Mon, Dec 5, 2016 at 2:44 PM, Bob Haarman via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: inglorion
> Date: Mon Dec  5 16:44:00 2016
> New Revision: 288722
>
> URL: http://llvm.org/viewvc/llvm-project?rev=288722&view=rev
> Log:
> [pdb] handle missing pdb streams more gracefully
>
> Summary: The code we use to read PDBs assumed that streams we ask it to read exist, and would read memory outside a vector and crash if this wasn't the case. This would, for example, cause llvm-pdbdump to crash on PDBs generated by lld. This patch handles such cases more gracefully: the PDB reading code in LLVM now reports errors when asked to get a stream that is not present, and llvm-pdbdump will report missing streams and continue processing streams that are present.
>

This commit broke the build for me, you're accessing `Code` outside of
the class even if it's a private member.
The following fixed the build for me, but I'm not sure if it's the
best solution. Please take a look.

[davide at cupiditate llvm]$ git diff
diff --git a/include/llvm/DebugInfo/MSF/MSFError.h
b/include/llvm/DebugInfo/MSF/MSFError.h
index e66aeca..33ca490 100644
--- a/include/llvm/DebugInfo/MSF/MSFError.h
+++ b/include/llvm/DebugInfo/MSF/MSFError.h
@@ -37,9 +37,11 @@ public:
   const std::string &getErrorMessage() const;
   std::error_code convertToErrorCode() const override;

+public:
+  msf_error_code Code;
+
 private:
   std::string ErrMsg;
-  msf_error_code Code;
 };
 } // namespace msf
 } // namespace llvm

-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare


More information about the llvm-commits mailing list