• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Debugging memory corruption? (C++)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Debugging memory corruption? (C++)


  • Subject: Re: Debugging memory corruption? (C++)
  • From: Jean-Denis Muys <email@hidden>
  • Date: Mon, 02 Nov 2009 23:25:24 +0100

Well, I thought I had solved my memory corruption bug. Not so fast! It still seems to happen. I have managed to trace the crash in mySQL C++/ Connector to the call of a destructor at exit of the routine listed below. And according to *my* understanding of C++ that destructor should not have been called from that routine, because, the destructor is not called on an automatic variable, but on a data member of this.

But really, its very difficult to trace through a chain of destructors when there is no source code to see. So here is my question:

Is there a way to see/produce the call graph generated by GCC? An assembly listing would fit the bill, but I really hope for something a bit higher level, since my last time with assembly was on the 68K with Macsbug. But I guess assembly with symbolic calls would be OK.

Thanks,

PS: here is the routine. The destructor is called on result_bind, a data member of MySQL_Prepared_ResultSet of type auto_ptr, through an exception raised inside the result_bind->bindResult(); call. The top of the backtrace follows.


MySQL_Prepared_ResultSet::MySQL_Prepared_ResultSet(
MYSQL_STMT * s,
MySQL_ResultBind * r_bind,
sql::ResultSet::enum_type rset_type,
MySQL_Prepared_Statement * par,
sql::mysql::util::my_shared_ptr< MySQL_DebugLogger > * l
)
: row(NULL), stmt(s), row_position(0), parent(par), is_valid(true),
logger(l? l->getReference():NULL), result_bind(r_bind),
resultset_type(rset_type)
{
CPP_ENTER("MySQL_Prepared_ResultSet::MySQL_Prepared_ResultSet");
result_bind->bindResult(); // this call never returns because it throws an exception


	MYSQL_RES * result_meta = mysql_stmt_result_metadata(stmt);
	num_fields = mysql_stmt_field_count(stmt);
	num_rows = mysql_stmt_num_rows(stmt);

CPP_INFO_FMT("num_fields=%u num_rows=%u", num_fields, num_rows);
for (unsigned int i = 0; i < num_fields; ++i) {
sql::mysql::util::my_array_guard< char > upstring (sql::mysql::util::utf8_strup(mysql_fetch_field(result_meta)->name, 0));
field_name_to_index_map[std::string(upstring.get())] = i;
}
mysql_free_result(result_meta);
result_meta = NULL;
rs_meta.reset(new MySQL_Prepared_ResultSetMetaData(stmt, logger));
} // <--- this is line 91 in the backtrace




#0 0x9625e97a in memset ()
#1 0x00000002 in ?? ()
#2 0x96265288 in free ()
#3 0x044c2aec in std::auto_ptr<sql::mysql::MySQL_ResultBind>::~auto_ptr (this=0x279dd930) at memory:259
#4 0x044c8e88 in sql::mysql::MySQL_Prepared_ResultSet::MySQL_Prepared_ResultSet (this=0x279dd8e0, s=0x3ba5a00, r_bind=0x2822a110, rset_type=sql::ResultSet::TYPE_SCROLL_INSENSITIVE, par=0x2822a070, l=0x27ba7910) at /Volumes/Prune/Development/4D/4D V11.4 Fr/RepliKator/ mysql_ps_resultset.cpp:91
#5 0x044c18b8 in sql::mysql::MySQL_Prepared_Statement::executeQuery (this=0x2822a070) at /Volumes/Prune/Development/4D/4D V11.4 Fr/ RepliKator/mysql_prepared_statement.cpp:327



_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Debugging memory corruption? (C++)
      • From: Jens Alfke <email@hidden>
References: 
 >Re: Debugging memory corruption? (C++) (From: Jean-Denis Muys <email@hidden>)
 >Re: Debugging memory corruption? (C++) (From: Dave Carrigan <email@hidden>)

  • Prev by Date: Re: Version Control [was: Damaging the source code]
  • Next by Date: Re: Version Control [was: Damaging the source code]
  • Previous by thread: Re: Debugging memory corruption? (C++)
  • Next by thread: Re: Debugging memory corruption? (C++)
  • Index(es):
    • Date
    • Thread