c++ - gdb shows weird stack trace -
I have a C ++ daemon that has a firefighter after a few days of work. I compiled it with the debug option (I'm sure I did it well, because I tested it with prequoted crashes and GDB showed the correct stack trace), but in the "real" crash on the output only I See the following trace:
(GDB) where # 0x00007ffff674d5a7 ?? () To /lib/x86_64-linux-gnu/libc.so.6 # 1 0xffffffffff in ?? () # 2 in 0x0000000000000000 ?? () What does this mean?
There is a potential problem with the following source code because it is the only new code because the daemon becomes shaky:
namespace Foo {bar> time :: instance = zero; Times * times: getInstance () {if (example! Example) example = new bar (); Return example; } Bar :: Bar () {curl = curl_easy_init (); CURLE_OK! = Curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1l) || CURLE_OK! = Curl_easy_setopt (curl, crio oak!) = Curl_ac_stopt (curl_ok! CURL_OK! CURLOPT_TIMEOUMSMS, bar :: timed out)) {std :: runtime_error (std :: string ("curl can not be started.")); }} Bar :: times () {curl_easy_cleanup (curl); } Std :: string bar :: getByIp (const std :: string and id) {times * self = getInstance (); Std :: string url = "example.com"; Url.append (id); Std :: ostringstream oss; If (CURLE_OK == self-> curl_arrayed (url, oss)) {std :: string output (oss.str ()); If (output.empty ()) return NULL_OBJECT; TiXmlDocument xml; Xml.Parse (output.c_str ()); If (xml.Error () || xml.firstChild ("a") = xml.FirstChild ("a") -> First Chilled ("B") ||! Xml.FirstChild ("a") - First Chald ("B") -> First Chilled Element ("Late") ||! XML First Chalk ("A") -> First Chalk ("B") -> First Chilled Element ("LNG") returns NULL_OBJECT; Std :: string lat = xml.FirstChild ("a") - & gt; First Chલ્ડ ("B") - & gt; First Chilled Element ("lat") - & gt; GetText (); Std :: string lng = xml.FirstChild ("a") - & gt; First Chલ્ડ ("B") - & gt; First Chilled Element ("LNG") - & gt; GetText (); Return Area :: Back Cord Indets (LNG, lat); } Return NULL_OBJECT; } Size_t bar :: data_write (zero * buf, size_t size, size_t nmemb, zero * userp) {if (userp) {std :: ostream & amp; Os = * static_cast & lt; Std :: ostream * & gt; (Userp); Std :: streamsize len = size * nmemb; If (OSI Lite (Static_cast and lieutenant; 4 *> (BF), Lane)) Return Lane; } Return 0; } CURLcode Bar :: curl_read (const std :: string and url, std :: ostringstream and os) {CURLcode code (CURLE_FAILED_INIT); If (curl) {if (CURLE_OK == (code = curl_easy_setopt (curl, CURLOPT_FILE, & amp; os)) & amp; amp ;; & amp; CURLE_OK == (code = curl_easy_setopt (curl, CURLOPT_URL, url.c_str ( )))) {Code = curl_ac_perform (curl); } } return code; It seems like memory corruption is affecting the script: write out allocated
Memory.
You can write your class the same way your Damon is probably in the loop. You can also run this program, with Valgin or any other Memory Checking Tool.
This can be a curl, a typical document or a caller calling your class.
Comments
Post a Comment