Patch tcmalloc's stack walking to be more strict and less likely to crash.
Patch tcmalloc's stack walking to be more strict and less likely to crash.

The issue from looking at the core dump is that tcmalloc crashes trying to
walk the call stack. This is why it is happening on the heap checker build
where it stores the stack of many calls. I can see from GDB that there is
something goofy with that stack frames. Tcmalloc is able to identity 4 frames
(same values as GDB) and then crashes on the next where GDB shows ???. GDB
can continue to show the rest of the stack so I don't think this is stack
corruption. The frames are in libstdc++ and I believe the issue is from a
compiler optimization to omit stack frame pointers. Tcmalloc's stack walking
is not tolerant of this. Debuggers have lots of logic to look around where the
stack should have started and recover.

We have a few options to handle this. Here's one proposed solution. I think we
can also consider setting NO_TCMALLOC_SAMPLE which will cause it to never collect
stacks. We can also try different options for different build types.

Change-Id: I98dfb5bccd5fe485ac50b56c6f0fe3f3ded9ff76
Reviewed-on: http://gerrit.ent.cloudera.com:8080/600
Tested-by: jenkins
Reviewed-by: Marcel Kornacker <44592b4eea36663c86b994bb0ea99d15309c1c7d@cloudera.com>

XiaominZhang/Impala,cchanning/Impala,andybab/Impala,ImpalaToGo/ImpalaToGo,placrosse/ImpalaToGo,mapr/impala,brightchen/Impala,rdblue/Impala,cgvarela/Impala,cgvarela/Impala,kapilrastogi/Impala,rampage644/impala-cut,henryr/Impala,bratatidas9/Impala-1,rdblue/Impala,mapr/impala,rampage644/impala-cut,ibmsoe/ImpalaPPC,cloudera/recordservice,ImpalaToGo/ImpalaToGo,grundprinzip/Impala,theyaa/Impala,gistic/PublicSpatialImpala,lnliuxing/Impala,cgvarela/Impala,caseyching/Impala,placrosse/ImpalaToGo,andybab/Impala,cloudera/recordservice,placrosse/ImpalaToGo,kapilrastogi/Impala,andybab/Impala,cchanning/Impala,scalingdata/Impala,ImpalaToGo/ImpalaToGo,cchanning/Impala,bratatidas9/Impala-1,gerashegalov/Impala,mapr/impala,brightchen/Impala,tempbottle/Impala,AtScaleInc/Impala,gistic/PublicSpatialImpala,kapilrastogi/Impala,brightchen/Impala,cloudera/recordservice,henryr/Impala,mapr/impala,cloudera/recordservice,grundprinzip/Impala,gistic/PublicSpatialImpala,grundprinzip/Impala,bowlofstew/Impala,scalingdata/Impala,XiaominZhang/Impala,mapr/impala,rampage644/impala-cut,AtScaleInc/Impala,henryr/Impala,bratatidas9/Impala-1,grundprinzip/Impala,theyaa/Impala,bowlofstew/Impala,gistic/PublicSpatialImpala,gerashegalov/Impala,bratatidas9/Impala-1,henryr/Impala,gerashegalov/Impala,XiaominZhang/Impala,rdblue/Impala,rampage644/impala-cut,kapilrastogi/Impala,tempbottle/Impala,cgvarela/Impala,scalingdata/Impala,ibmsoe/ImpalaPPC,bratatidas9/Impala-1,henryr/Impala,lnliuxing/Impala,kapilrastogi/Impala,scalingdata/Impala,rdblue/Impala,lirui-intel/Impala,gistic/PublicSpatialImpala,ImpalaToGo/ImpalaToGo,rdblue/Impala,cloudera/recordservice,tempbottle/Impala,bowlofstew/Impala,placrosse/ImpalaToGo,lirui-intel/Impala,caseyching/Impala,bowlofstew/Impala,ImpalaToGo/ImpalaToGo,theyaa/Impala,lirui-intel/Impala,XiaominZhang/Impala,cloudera/recordservice,grundprinzip/Impala,gerashegalov/Impala,placrosse/ImpalaToGo,XiaominZhang/Impala,bowlofstew/Impala,bowlofstew/Impala,bratatidas9/Impala-1,AtScaleInc/Impala,XiaominZhang/Impala,cgvarela/Impala,kapilrastogi/Impala,cgvarela/Impala,cloudera/recordservice,gerashegalov/Impala,gerashegalov/Impala,theyaa/Impala,rampage644/impala-cut,ibmsoe/ImpalaPPC,grundprinzip/Impala,scalingdata/Impala,rampage644/impala-cut,bratatidas9/Impala-1,theyaa/Impala,theyaa/Impala,caseyching/Impala,cchanning/Impala,kapilrastogi/Impala,caseyching/Impala,tempbottle/Impala,andybab/Impala,lirui-intel/Impala,lnliuxing/Impala,lirui-intel/Impala,AtScaleInc/Impala,placrosse/ImpalaToGo,tempbottle/Impala,caseyching/Impala,lirui-intel/Impala,henryr/Impala,bowlofstew/Impala,theyaa/Impala,ImpalaToGo/ImpalaToGo,lirui-intel/Impala,cchanning/Impala,tempbottle/Impala,ibmsoe/ImpalaPPC,caseyching/Impala,brightchen/Impala,lnliuxing/Impala,rdblue/Impala,AtScaleInc/Impala,gerashegalov/Impala,XiaominZhang/Impala,lnliuxing/Impala,brightchen/Impala,andybab/Impala,ibmsoe/ImpalaPPC,cchanning/Impala,ibmsoe/ImpalaPPC,cgvarela/Impala,tempbottle/Impala,lnliuxing/Impala,gistic/PublicSpatialImpala,lnliuxing/Impala,brightchen/Impala,caseyching/Impala,andybab/Impala,scalingdata/Impala,ibmsoe/ImpalaPPC,cchanning/Impala,brightchen/Impala,rdblue/Impala,AtScaleInc/Impala