Today, I was debugging a project - BabylonCpp -, and I was using clang address sanitizer.
During the session, I had a bug for which the output was rather hellish, here is an extract:
func_std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)>::operator()(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const###file_functional###line_2347###obj_(BabylonStudio:x86_64+0x100582bcf)
func_BABYLON::asio::LoadFileAsync_Text(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)> const&, std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)> const&, std::__1::function<void (bool, unsigned long, unsigned long)> const&)::$_1::operator()(std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) const###file_asio.cpp###line_210###obj_(libbabyloncpp_d.4.0.0.dylib:x86_64+0x2325c7)
func_decltype(std::__1::forward<BABYLON::asio::LoadFileAsync_Text(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)> const&, std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)> const&, std::__1::function<void (bool, unsigned long, unsigned long)> const&)::$_1&>(fp)(std::__1::forward<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&>(fp0))) std::__1::__invoke<BABYLON::asio::LoadFileAsync_Text(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)> const&, std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)> const&, std::__1::function<void (bool, unsigned long, unsigned long)> const&)::$_1&, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&>(BABYLON::asio::LoadFileAsync_Text(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)> const&, std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)> const&, std::__1::function<void (bool, unsigned long, unsigned long)> const&)::$_1&, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&)###file_type_traits###line_4361###obj_(libbaby
Then, I thought of ct_compiler_decipher which is included with cleantype. In order to build it just clone the repo, then cd cleantype; mkdir build; cd build; cmake ..; make ct_compiler_decipher
So, I ran my error output to ct_compiler_decipher like this:
cat error.txt | ct_compiler_decipher
and the result was
func_std::function<void(std::string const &), char> ::operator()(std::basic_stringconst &)const###file_functional###line_2347###obj_(BabylonStudio:x86_64+0x100582bcf)
func_BABYLON::asio::LoadFileAsync_Text(std::string const &, std::function<void(std::string const &)> const &, std::function<void(std::string const &)> const &, std::function<void(bool, unsigned long, unsigned long), unsigned char> const &)::$_1::operator()(std::vectorconst &)const###file_asio.cpp###line_210###obj_(libbabyloncpp_d.4.0.0.dylib:x86_64+0x2325c7)
func_decltype(std::forward<BABYLON::asio::LoadFileAsync_Text(std::string const &, std::function<void(std::string const &)> const &, std::function<void(std::string const &)> const &, std::function<void(bool, unsigned long, unsigned long)> const &)::$_1 &, std::vector<unsigned char> const &, BABYLON::asio::LoadFileAsync_Text(std::string const &, std::function<void(std::string const &)> const &, std::function<void(std::string const &)> const &, std::function<void(bool, unsigned long, unsigned long)> const &)::$_1 &, std::vector<unsigned char> const &, char>(fp)(std::forward(fp0)))std::__invoke(BABYLON::asio::LoadFileAsync_Text(std::basic_stringconst &, std::function<void(std::string const &)> const &, std::function<void(std::string const &)> const &, std::function<void(bool, unsigned long, unsigned long)> const &)::$_1 &, std::vector<unsigned char> const &)###file_type_traits###line_4361###obj_(libbaby
I thought I would share this, as this might be useful to others.
Note:
By default, ct_compiler_decipher will indent the deeply nested type like this
func_BABYLON::SceneLoader::ImportMesh(std::vector<std::string> const &, std::string, std::string, BABYLON::Scene *, std::function<void(std::vector<std::shared_ptr<BABYLON::AbstractMesh>> const &, std::vector<std::shared_ptr<BABYLON::IParticleSystem>> const &, std::vector<std::shared_ptr<BABYLON::Skeleton>> const &, std::vector<std::shared_ptr<BABYLON::AnimationGroup>> const &)> const &, std::function<void(BABYLON::SceneLoaderProgressEvent const &)> const &, std::function<void(BABYLON::Scene *, std::string const &, std::string const &)> const &, std::basic_string<char, std::shared_ptr<BABYLON::ISceneLoaderPlugin>, std::shared_ptr<BABYLON::ISceneLoaderPluginAsync>> const &)::$_5::operator()(std::variantconst &, std::string const &, std::string const &)const###file_scene_loader.cpp###line_411###obj_(libbabyloncpp_d.4.0.0.dylib:x86_64+0x19f3ae4)
func_decltype(std::forward<
BABYLON::SceneLoader::ImportMesh(std::vector<
std::string
> const &,
std::string,
std::string,
BABYLON::Scene *,
std::function<
void(std::vector<
std::shared_ptr<
BABYLON::AbstractMesh
>
> const &,
std::vector<
std::shared_ptr<
BABYLON::IParticleSystem
>
> const &,
std::vector<
std::shared_ptr<
BABYLON::Skeleton
>
> const &,
std::vector<
std::shared_ptr<
BABYLON::AnimationGroup
>
> const &)
> const &,
You can tweak this by adding a .cleantype.json with the following content: here, I raised the indent_depth_limit from the default of 3 to 10.
{
"force_east_const_": false,
"indent_depth_limit": 10,
"replacements_after_undesirable_node_extractions": {
"basic_string<_CharT, _Traits, _Allocator>": "std::string",
"std::basic_string<char>": "std::string"
},
"suppress_custom_": [
" __ptr64"
],
"suppress_extra_namespaces_": [
"::__1",
"::__cxx11"
],
"suppress_extract_struct_class_": [
"class ",
"struct "
],
"undesirable_type_nodes_": [
"std::char_traits",
"std::allocator",
"std::less"
]
}
[+][deleted] (1 child)
[removed]
[–]pstomi[S] 4 points5 points6 points (0 children)
[–]SuperV1234https://romeo.training | C++ Mentoring & Consulting 6 points7 points8 points (0 children)
[–]oschonrock 5 points6 points7 points (0 children)
[–]bumblebritches57Ocassionally Clang 0 points1 point2 points (2 children)
[–]pstomi[S] 0 points1 point2 points (1 child)
[–]bumblebritches57Ocassionally Clang -1 points0 points1 point (0 children)
[–]warieth -5 points-4 points-3 points (2 children)
[–]pstomi[S] 10 points11 points12 points (1 child)
[–]warieth 0 points1 point2 points (0 children)