Bug 1544825 - Use IPDL type names instead of truncated C++ names in deserialization error messages. r=nika
authorJed Davis <jld@mozilla.com>
Tue, 23 Apr 2019 14:40:48 +0000
changeset 470503 4f8806f0c9f0db51948b14556c24658de1753a9a
parent 470502 970ef36e6c09e748140ebf96c9ccfec6eb52ab5e
child 470504 0929ce86289280f106b3cd63d63290de507466a7
push id35906
push useraciure@mozilla.com
push dateTue, 23 Apr 2019 22:14:56 +0000
treeherdermozilla-central@0ce3633f8b80 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika
bugs1544825
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1544825 - Use IPDL type names instead of truncated C++ names in deserialization error messages. r=nika Currently, when deserialization fails, the error message contains the base name of the C++ type, without template parameters; this means we can get unhelpfully vague errors about `RefPtr` or `Maybe` or `nsTArray`. (The identical error cases are then merged by the compiler, so the execution path can't be recovered from the crash dump.) This patch uses the IPDL type instead. It would be possible to invoke the code generator to use the full C++ type, but more complicated for no real benefit. Differential Revision: https://phabricator.services.mozilla.com/D28401
ipc/ipdl/ipdl/lower.py
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -4621,17 +4621,17 @@ class _GenerateProtocolActorCode(ipdl.as
             # declare varCopy for each variable to deserialize.
             + [StmtDecl(Decl(p.bareType(side), p.var().name + 'Copy'))
                 for p in params]
             + [Whitespace.NL]
             #  checked Read(&(varCopy), &(msgverify__), &(msgverifyIter__))
             + [_ParamTraits.checkedRead(p.ipdltype,
                                         ExprAddrOf(ExprVar(p.var().name + 'Copy')),
                                         msgexpr, ExprAddrOf(itervar),
-                                        errfn, p.bareType(side).name,
+                                        errfn, p.ipdltype.name(),
                                         sentinelKey=p.name,
                                         errfnSentinel=errfnSentinel(),
                                         actor=ExprVar.THIS)
                 for p in params]
             + [self.endRead(msgvar, itervar)]
             # Move the message back to its source before sending.
             + [StmtExpr(ExprAssn(ExprDeref(msgsrcVar), ExprMove(msgvar)))]
         ))
@@ -4680,17 +4680,17 @@ class _GenerateProtocolActorCode(ipdl.as
         stmts.extend((
             [StmtDecl(Decl(_iterType(ptr=False), self.itervar.name),
                       initargs=[msgvar])]
             + decls + [StmtDecl(Decl(p.bareType(side), p.var().name))
                        for p in md.params]
             + [Whitespace.NL]
             + reads + [_ParamTraits.checkedRead(p.ipdltype, ExprAddrOf(p.var()),
                                                 msgexpr, ExprAddrOf(itervar),
-                                                errfn, "'%s'" % p.bareType(side).name,
+                                                errfn, "'%s'" % p.ipdltype.name(),
                                                 sentinelKey=p.name, errfnSentinel=errfnSent,
                                                 actor=ExprVar.THIS)
                        for p in md.params[start:]]
             + [self.endRead(msgvar, itervar)]))
 
         return stmts
 
     def deserializeAsyncReply(self, md, side, errfn, errfnSent):
@@ -4742,17 +4742,17 @@ class _GenerateProtocolActorCode(ipdl.as
             start = 1
 
         stmts = (
             decls + [StmtDecl(Decl(p.bareType(side), p.var().name))
                      for p in md.returns]
             + [Whitespace.NL]
             + reads + [_ParamTraits.checkedRead(p.ipdltype, ExprAddrOf(p.var()),
                                                 msgexpr, ExprAddrOf(itervar),
-                                                errfn, "'%s'" % p.bareType(side).name,
+                                                errfn, "'%s'" % p.ipdltype.name(),
                                                 sentinelKey=p.name, errfnSentinel=errfnSent,
                                                 actor=ExprVar.THIS)
                        for p in md.returns[start:]]
             + [self.endRead(msgvar, itervar)])
 
         return resolve, reason, prologue, desrej, stmts
 
     def deserializeReply(self, md, replyexpr, side, errfn, errfnSentinel, actor=None, decls=False):
@@ -4771,17 +4771,17 @@ class _GenerateProtocolActorCode(ipdl.as
             [Whitespace.NL,
              StmtDecl(Decl(_iterType(ptr=False), itervar.name),
                       initargs=[self.replyvar])]
             + declstmts
             + [Whitespace.NL]
             + [_ParamTraits.checkedRead(r.ipdltype, r.var(),
                                         ExprAddrOf(self.replyvar),
                                         ExprAddrOf(self.itervar),
-                                        errfn, "'%s'" % r.bareType(side).name,
+                                        errfn, "'%s'" % r.ipdltype.name(),
                                         sentinelKey=r.name, errfnSentinel=errfnSentinel,
                                         actor=ExprVar.THIS)
                 for r in md.returns]
             + [self.endRead(self.replyvar, itervar)])
 
         return stmts
 
     def sendAsync(self, md, msgexpr, actor=None):