gut gut - 1 month ago 127
C++ Question

Abbreviate c++ templates on GDB for readability purposes?

I want to truncate / abbreviate the template when the list is too long. E.g:

0x219f524c <HPHP::jit::DfsWalker::dfs<HPHP::jit::PostorderWalker::dfs(Post) [with Post = HPHP::jit::vasm_lower(HPHP::jit::Vunit&, Vlower) [with Vlower = HPHP::jit::(anonymous namespace)::lowerForPPC64(HPHP::jit::Vunit&)::<lambda(const HPHP::jit::VLS&, HPHP::jit::Vinstr&, HPHP::jit::Vlabel, size_t)>]::<lambda(HPHP::jit::Vlabel)>]::<lambda(HPHP::jit::Vlabel)>, HPHP::jit::vasm_lower(HPHP::jit::Vunit&, Vlower) [with Vlower = HPHP::jit::(anonymous namespace)::lowerForPPC64(HPHP::jit::Vunit&)::<lambda(const HPHP::jit::VLS&, HPHP::jit::Vinstr&, HPHP::jit::Vlabel, size_t)>]::<lambda(HPHP::jit::Vlabel)> >(HPHP::jit::Vlabel, HPHP::jit::<lambda(HPHP::jit::Vlabel)>)+412>: addi r30,r30,4
0x219f5250 <HPHP::jit::DfsWalker::dfs<HPHP::jit::PostorderWalker::dfs(Post) [with Post = HPHP::jit::vasm_lower(HPHP::jit::Vunit&, Vlower) [with Vlower = HPHP::jit::(anonymous namespace)::lowerForPPC64(HPHP::jit::Vunit&)::<lambda(const HPHP::jit::VLS&, HPHP::jit::Vinstr&, HPHP::jit::Vlabel, size_t)>]::<lambda(HPHP::jit::Vlabel)>]::<lambda(HPHP::jit::Vlabel)>, HPHP::jit::vasm_lower(HPHP::jit::Vunit&, Vlower) [with Vlower = HPHP::jit::(anonymous namespace)::lowerForPPC64(HPHP::jit::Vunit&)::<lambda(const HPHP::jit::VLS&, HPHP::jit::Vinstr&, HPHP::jit::Vlabel, size_t)>]::<lambda(HPHP::jit::Vlabel)> >(HPHP::jit::Vlabel, HPHP::jit::<lambda(HPHP::jit::Vlabel)>)+416>: cmpld cr7,r28,r9
0x219f5254 <HPHP::jit::DfsWalker::dfs<HPHP::jit::PostorderWalker::dfs(Post) [with Post = HPHP::jit::vasm_lower(HPHP::jit::Vunit&, Vlower) [with Vlower = HPHP::jit::(anonymous namespace)::lowerForPPC64(HPHP::jit::Vunit&)::<lambda(const HPHP::jit::VLS&, HPHP::jit::Vinstr&, HPHP::jit::Vlabel, size_t)>]::<lambda(HPHP::jit::Vlabel)>]::<lambda(HPHP::jit::Vlabel)>, HPHP::jit::vasm_lower(HPHP::jit::Vunit&, Vlower) [with Vlower = HPHP::jit::(anonymous namespace)::lowerForPPC64(HPHP::jit::Vunit&)::<lambda(const HPHP::jit::VLS&, HPHP::jit::Vinstr&, HPHP::jit::Vlabel, size_t)>]::<lambda(HPHP::jit::Vlabel)> >(HPHP::jit::Vlabel, HPHP::jit::<lambda(HPHP::jit::Vlabel)>)+420>: bne cr7,0x219f5220 <HPHP::jit::DfsWalker::dfs<HPHP::jit::PostorderWalker::dfs(Post) [with Post = HPHP::jit::vasm_lower(HPHP::jit::Vunit&, Vlower) [with Vlower = HPHP::jit::(anonymous namespace)::lowerForPPC64(HPHP::jit::Vunit&)::<lambda(const HPHP::jit::VLS&, HPHP::jit::Vinstr&, HPHP::jit::Vlabel, size_t)>]::<lambda(HPHP::jit::Vlabel)>]::<lambda(HPHP::jit::Vlabel)>, HPHP::jit::vasm_lower(HPHP::jit::Vunit&, Vlower) [with Vlower = HPHP::jit::(anonymous namespace)::lowerForPPC64(HPHP::jit::Vunit&)::<lambda(const HPHP::jit::VLS&, HPHP::jit::Vinstr&, HPHP::jit::Vlabel, size_t)>]::<lambda(HPHP::jit::Vlabel)> >(HPHP::jit::Vlabel, HPHP::jit::<lambda(HPHP::jit::Vlabel)>)+368>
0x219f5258 <HPHP::jit::DfsWalker::dfs<HPHP::jit::PostorderWalker::dfs(Post) [with Post = HPHP::jit::vasm_lower(HPHP::jit::Vunit&, Vlower) [with Vlower = HPHP::jit::(anonymous namespace)::lowerForPPC64(HPHP::jit::Vunit&)::<lambda(const HPHP::jit::VLS&, HPHP::jit::Vinstr&, HPHP::jit::Vlabel, size_t)>]::<lambda(HPHP::jit::Vlabel)>]::<lambda(HPHP::jit::Vlabel)>, HPHP::jit::vasm_lower(HPHP::jit::Vunit&, Vlower) [with Vlower = HPHP::jit::(anonymous namespace)::lowerForPPC64(HPHP::jit::Vunit&)::<lambda(const HPHP::jit::VLS&, HPHP::jit::Vinstr&, HPHP::jit::Vlabel, size_t)>]::<lambda(HPHP::jit::Vlabel)> >(HPHP::jit::Vlabel, HPHP::jit::<lambda(HPHP::jit::Vlabel)>)+424>: ld r10,0(r27)


Anything that would fit my screen better would be nicer. Specially because when the line breaks I just miss the instructions completely.

Suggestion:

0x219f524c <HPHP::jit::DfsWalker::dfs<[...]>)+412>: addi r30,r30,4
0x219f5250 <HPHP::jit::DfsWalker::dfs<[...]>)+416>: cmpld cr7,r28,r9
0x219f5254 <HPHP::jit::DfsWalker::dfs<[...]>)+420>: bne cr7,0x219f5220 <HPHP::jit::DfsWalker::dfs<[...]>)+368>
0x219f5258 <HPHP::jit::DfsWalker::dfs<[...]>)+424>: ld r10,0(r27)


I don't want it to be the default, but in my case I'm not caring about which template is being used all the times.

Answer Source

Try set print max-symbolic-offset <max-offset> as specified in the docs, where <max-offset> is an integer.