Few debug related fixes

- make logthreadnames work correctly without logtimestamps (and with emty strings again)
 - fix crash in debug (it3)
 - log debug info about locks in one line
 - show actual DS rounds instead of n/a in coin control while in debug mode
 - fix initial string in debug.log: "Bitcoin version" -> "Dash version"
This commit is contained in:
UdjinM6 2016-03-25 02:15:03 +03:00
parent dee72ad0cd
commit 981efed749
5 changed files with 12 additions and 13 deletions

View File

@ -875,7 +875,7 @@ void InitLogging()
fLogIPs = GetBoolArg("-logips", DEFAULT_LOGIPS); fLogIPs = GetBoolArg("-logips", DEFAULT_LOGIPS);
LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
LogPrintf("Bitcoin version %s (%s)\n", FormatFullVersion(), CLIENT_DATE); LogPrintf("Dash version %s (%s)\n", FormatFullVersion(), CLIENT_DATE);
} }
/** Initialize dash. /** Initialize dash.
@ -1702,7 +1702,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
pwalletMain->SetBestChain(chainActive.GetLocator()); pwalletMain->SetBestChain(chainActive.GetLocator());
} }
if(!strErrors.str().empty()) LogPrintf("%s", strErrors.str()); LogPrintf("%s", strErrors.str());
LogPrintf(" wallet %15dms\n", GetTimeMillis() - nStart); LogPrintf(" wallet %15dms\n", GetTimeMillis() - nStart);
RegisterValidationInterface(pwalletMain); RegisterValidationInterface(pwalletMain);

View File

@ -342,7 +342,7 @@ void CMasternodeMan::CheckAndRemove(bool forceExpiredRemoval)
map<uint256, CMasternodePing>::iterator it4 = mapSeenMasternodePing.begin(); map<uint256, CMasternodePing>::iterator it4 = mapSeenMasternodePing.begin();
while(it4 != mapSeenMasternodePing.end()){ while(it4 != mapSeenMasternodePing.end()){
if((*it4).second.sigTime < GetTime() - MASTERNODE_REMOVAL_SECONDS*2){ if((*it4).second.sigTime < GetTime() - MASTERNODE_REMOVAL_SECONDS*2){
LogPrint("masternode", "CMasternodeMan::CheckAndRemove - Removing expired Masternode ping %s\n", (*it3).second.GetHash().ToString()); LogPrint("masternode", "CMasternodeMan::CheckAndRemove - Removing expired Masternode ping %s\n", (*it4).second.GetHash().ToString());
mapSeenMasternodePing.erase(it4++); mapSeenMasternodePing.erase(it4++);
} else { } else {
++it4; ++it4;

View File

@ -845,7 +845,7 @@ void CoinControlDialog::updateView()
CTxIn vin = CTxIn(out.tx->GetHash(), out.i); CTxIn vin = CTxIn(out.tx->GetHash(), out.i);
int rounds = pwalletMain->GetInputDarksendRounds(vin); int rounds = pwalletMain->GetInputDarksendRounds(vin);
if(rounds >= 0) itemOutput->setText(COLUMN_DARKSEND_ROUNDS, strPad(QString::number(rounds), 11, " ")); if(rounds >= 0 || fDebug) itemOutput->setText(COLUMN_DARKSEND_ROUNDS, strPad(QString::number(rounds), 11, " "));
else itemOutput->setText(COLUMN_DARKSEND_ROUNDS, strPad(QString(tr("n/a")), 11, " ")); else itemOutput->setText(COLUMN_DARKSEND_ROUNDS, strPad(QString(tr("n/a")), 11, " "));

View File

@ -15,8 +15,7 @@
#ifdef DEBUG_LOCKCONTENTION #ifdef DEBUG_LOCKCONTENTION
void PrintLockContention(const char* pszName, const char* pszFile, int nLine) void PrintLockContention(const char* pszName, const char* pszFile, int nLine)
{ {
LogPrintf("LOCKCONTENTION: %s\n", pszName); LogPrintf("LOCKCONTENTION: %s Locker: %s:%d\n", pszName, pszFile, nLine);
LogPrintf("Locker: %s:%d\n", pszFile, nLine);
} }
#endif /* DEBUG_LOCKCONTENTION */ #endif /* DEBUG_LOCKCONTENTION */

View File

@ -300,7 +300,7 @@ bool LogAcceptCategory(const char* category)
/** /**
* fStartedNewLine is a state variable held by the calling context that will * fStartedNewLine is a state variable held by the calling context that will
* suppress printing of the timestamp when multiple calls are made that don't * suppress printing of the timestamp when multiple calls are made that don't
* end in a newline. Initialize it to true, and hold it, in the calling context. * end in a newline. Initialize it to true, and hold/manage it, in the calling context.
*/ */
static std::string LogTimestampStr(const std::string &str, bool *fStartedNewLine) static std::string LogTimestampStr(const std::string &str, bool *fStartedNewLine)
{ {
@ -318,18 +318,13 @@ static std::string LogTimestampStr(const std::string &str, bool *fStartedNewLine
} else } else
strStamped = str; strStamped = str;
if (!str.empty() && str[str.size()-1] == '\n')
*fStartedNewLine = true;
else
*fStartedNewLine = false;
return strStamped; return strStamped;
} }
/** /**
* fStartedNewLine is a state variable held by the calling context that will * fStartedNewLine is a state variable held by the calling context that will
* suppress printing of the thread name when multiple calls are made that don't * suppress printing of the thread name when multiple calls are made that don't
* end in a newline. Initialize it to true, and hold it, in the calling context. * end in a newline. Initialize it to true, and hold/manage it, in the calling context.
*/ */
static std::string LogThreadNameStr(const std::string &str, bool *fStartedNewLine) static std::string LogThreadNameStr(const std::string &str, bool *fStartedNewLine)
{ {
@ -356,6 +351,11 @@ int LogPrintStr(const std::string &str)
std::string strThreadLogged = LogThreadNameStr(str, &fStartedNewLine); std::string strThreadLogged = LogThreadNameStr(str, &fStartedNewLine);
std::string strTimestamped = LogTimestampStr(strThreadLogged, &fStartedNewLine); std::string strTimestamped = LogTimestampStr(strThreadLogged, &fStartedNewLine);
if (!str.empty() && str[str.size()-1] == '\n')
fStartedNewLine = true;
else
fStartedNewLine = false;
if (fPrintToConsole) if (fPrintToConsole)
{ {
// print to console // print to console