Reputation: 37724
I am learning debugging with GDB and I am not sure what to do.
I run a program inside GDB, that I need to get working, and it crashes with SEGFAULT. When I do backtrace
inside GDB, I see this.
(gdb) backtrace
#0 0x08200100 in boost::shared_ptr<boost::re_detail::basic_regex_implementation<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > >::get (this=0x2) at /usr/include/boost/smart_ptr/shared_ptr.hpp:668
#1 0x081f94c3 in boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::get_traits (this=0x2) at /usr/include/boost/regex/v4/basic_regex.hpp:619
#2 0x081ef769 in boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::string> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::perl_matcher (this=0xb60d3eb4, first=..., end=..., what=..., e=...,
f=boost::regex_constants::match_any, l_base=...) at /usr/include/boost/regex/v4/perl_matcher.hpp:372
#3 0x081e2214 in boost::regex_match<__gnu_cxx::__normal_iterator<char const*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::string> > >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > (first=..., last=..., m=..., e=..., flags=boost::regex_constants::match_any)
at /usr/include/boost/regex/v4/regex_match.hpp:49
#4 0x081d43bf in boost::regex_match<std::char_traits<char>, std::allocator<char>, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > (s=..., e=..., flags=boost::regex_constants::match_default)
at /usr/include/boost/regex/v4/regex_match.hpp:100
#5 0x081ca3c1 in [my project] (this=0x2, request=0xb5706630)
at [source of my project]:127
[more calls here]
Now I want to examine what was inside request
at #5
, on the line 127. Request is a C-style pointer to C++ object of class request_data
, which is defined in my project. The definition of my function is bool match_request(request_data *request) const
.
What should I write in gdb
to actually get to the content of request
as it was before the program segfaulted?
Upvotes: 2
Views: 1781
Reputation: 76
Well, your this
pointer at #5 does not look too healthy, but aside from that, I think you need a GDB tutorial:
Upvotes: 3