Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Debugging early function exit with gdb
Breakpoint 11 at 0x5555557490ec: file ../src/app/commands/cmd_frame_tag_properties.cpp, line 100.
(gdb) c
Thread 1 "aseprite" hit Breakpoint 10, app::FrameTagPropertiesCommand::onExecute (this=<optimized out>, context=<optimized out>) at ../src/app/commands/cmd_frame_tag_properties.cpp:98
98 tx(new cmd::SetTagName(tag, name));
(gdb) list
93 Tx tx(writer.context(), friendlyName());
94 Tag* tag = const_cast<Tag*>(foundTag);
95
96 std::string name = window.nameValue();
97 if (tag->name() != name)
98 tx(new cmd::SetTagName(tag, name));
99
100 doc::frame_t from, to;
101 window.rangeValue(from, to);
102 if (tag->fromFrame() != from ||
(gdb) c
At this point I would expect breakpoint 11 to be hit, but it is not. No other breakpoints later in the same function are hit. After line 98, the program behaves as if this function had returned. Below are the results of stepping instead of continuing
(gdb) s
app::TagWindow::nameValue[abi:cxx11]() (this=0x7fffffffced0) at ../src/app/ui/tag_window.cpp:48
48 {
(gdb) s
49 return name()->text();
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string (__str="Flip", this=<optimized out>) at ../src/app/ui/tag_window.cpp:49
49 return name()->text();
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider::_Alloc_hider (__a=..., __dat=0x7fffffffce90 "", this=<optimized out>) at /usr/include/c++/9/ext/new_allocator.h:83
83 new_allocator(const new_allocator&) _GLIBCXX_USE_NOEXCEPT { }
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string (__str="Flip", this=<optimized out>) at /usr/include/c++/9/ext/new_allocator.h:89
89 ~new_allocator() _GLIBCXX_USE_NOEXCEPT { }
(gdb) s
186 _M_data() const
(gdb) s
451 { _M_construct(__str._M_data(), __str._M_data() + __str.length()); }
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*> (__end=0x5555566d5024 "", __beg=0x5555566d5020 "Flip", this=0x7fffffffce80)
at /usr/include/c++/9/bits/basic_string.h:451
451 { _M_construct(__str._M_data(), __str._M_data() + __str.length()); }
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*> (__end=0x5555566d5024 "", __beg=0x5555566d5020 "Flip", this=0x7fffffffce80)
at /usr/include/c++/9/bits/basic_string.h:451
451 { _M_construct(__str._M_data(), __str._M_data() + __str.length()); }
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*> (__end=0x5555566d5024 "", __beg=0x5555566d5020 "Flip", this=0x7fffffffce80)
at /usr/include/c++/9/bits/basic_string.tcc:206
206 basic_string<_CharT, _Traits, _Alloc>::
(gdb) s
225 { this->_S_copy_chars(_M_data(), __beg, __end); }
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy_chars (__k2=0x5555566d5024 "", __k1=0x5555566d5020 "Flip", __p=0x7fffffffce90 "")
at /usr/include/c++/9/bits/basic_string.tcc:225
225 { this->_S_copy_chars(_M_data(), __beg, __end); }
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy (__n=4, __s=0x5555566d5020 "Flip", __d=0x7fffffffce90 "") at /usr/include/c++/9/bits/basic_string.h:392
392 _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT
(gdb) s
app::TagWindow::nameValue[abi:cxx11]() (this=0x7fffffffced0) at ../src/app/ui/tag_window.cpp:49
49 return name()->text();
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string (__str="Flip", this=<optimized out>) at ../src/app/ui/tag_window.cpp:49
49 return name()->text();
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*> (__end=0x5555566d5024 "", __beg=0x5555566d5020 "Flip", this=0x7fffffffce80)
at ../src/app/ui/tag_window.cpp:49
49 return name()->text();
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*> (__end=0x5555566d5024 "", __beg=0x5555566d5020 "Flip", this=0x7fffffffce80)
at ../src/app/ui/tag_window.cpp:49
49 return name()->text();
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*> (__end=0x5555566d5024 "", __beg=0x5555566d5020 "Flip", this=0x7fffffffce80)
at ../src/app/ui/tag_window.cpp:49
49 return name()->text();
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy_chars (__k2=0x5555566d5024 "", __k1=0x5555566d5020 "Flip", __p=0x7fffffffce90 "") at ../src/app/ui/tag_window.cpp:49
49 return name()->text();
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy (__n=4, __s=0x5555566d5020 "Flip", __d=0x7fffffffce90 "") at ../src/app/ui/tag_window.cpp:49
49 return name()->text();
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy (__n=4, __s=0x5555566d5020 "Flip", __d=0x7fffffffce90 "") at ../src/app/ui/tag_window.cpp:49
49 return name()->text();
(gdb) s
std::char_traits<char>::copy (__n=4, __s2=0x5555566d5020 "Flip", __s1=0x7fffffffce90 "") at /usr/include/c++/9/bits/char_traits.h:363
363 if (__n == 0)
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*> (__end=0x5555566d5024 "", __beg=0x5555566d5020 "Flip", this=0x7fffffffce80)
at /usr/include/c++/9/bits/basic_string.tcc:225
225 { this->_S_copy_chars(_M_data(), __beg, __end); }
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy_chars (__k2=0x5555566d5024 "", __k1=0x5555566d5020 "Flip", __p=0x7fffffffce90 "")
at /usr/include/c++/9/bits/basic_string.tcc:225
225 { this->_S_copy_chars(_M_data(), __beg, __end); }
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy (__n=4, __s=0x5555566d5020 "Flip", __d=0x7fffffffce90 "") at /usr/include/c++/9/bits/basic_string.tcc:225
225 { this->_S_copy_chars(_M_data(), __beg, __end); }
(gdb) s
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy (__n=4, __s=0x5555566d5020 "Flip", __d=0x7fffffffce90 "") at /usr/include/c++/9/bits/basic_string.tcc:225
225 { this->_S_copy_chars(_M_data(), __beg, __end); }
(gdb) s
std::char_traits<char>::copy (__n=4, __s2=0x5555566d5020 "Flip", __s1=0x7fffffffce90 "") at /usr/include/c++/9/bits/char_traits.h:365
365 return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));
(gdb) s
Here, again, the program simply continues to run as if app::FrameTagPropertiesCommand::onExecute had returned from around line 99. How can I detect what is going on from here that leads to the rest of that function not being executed?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment