Linux debug...

develop
Petr Mrázek 2011-08-16 23:39:18 +02:00
parent 7898d2b6b2
commit 03e3e9002b
4 changed files with 39 additions and 12 deletions

@ -25,7 +25,7 @@ set(DF_VERSION_MINOR "31")
set(DF_VERSION_PATCH "25")
set(DF_VERSION "${DF_VERSION_MAJOR}.${DF_VERSION_MINOR}.${DF_VERSION_PATCH}")
set(DFHACK_RELEASE "1")
set(DFHACK_RELEASE "3")
## where to install things (after the build is done, classic 'make install' or package structure)
# the dfhack libraries will be installed here:

@ -407,13 +407,25 @@ bool Core::Init()
vif = new DFHack::VersionInfoFactory(path);
p = new DFHack::Process(vif);
vinfo = p->getDescriptor();
// dump offsets to a file
std::ofstream dump("offsets.log");
if(!dump.fail())
if(!vinfo)
{
dump << vinfo->PrintOffsets();
dump.close();
cerr << "Couldn't retrieve version information.\n";
errorstate = true;
delete p;
p = NULL;
return false;
}
if (!p->isIdentified())
{
cerr << "Couldn't identify this version of DF.\n";
errorstate = true;
delete p;
p = NULL;
return false;
}
// init the console.
Gui * g = getGui();
if(g->init)
@ -426,13 +438,12 @@ bool Core::Init()
}
else con.init(false);
if (!p->isIdentified())
// dump offsets to a file
std::ofstream dump("offsets.log");
if(!dump.fail())
{
con.printerr("Couldn't identify this version of DF.\n");
errorstate = true;
delete p;
p = NULL;
return false;
dump << vinfo->PrintOffsets();
dump.close();
}
// create mutex for syncing with interactive tasks

@ -58,6 +58,7 @@ Process::Process(VersionInfoFactory * known_versions)
target_result = readlink(exe_link_name, target_name, sizeof(target_name)-1);
if (target_result == -1)
{
cerr << "Failed to readlink(/proc/self/exe)\n";
return;
}
// make sure we have a null terminated string...
@ -77,6 +78,14 @@ Process::Process(VersionInfoFactory * known_versions)
my_descriptor->setParentProcess(this);
identified = true;
}
else
{
cerr << "Unable to retrieve version information.\n";
}
}
else
{
cerr << "This isn't DF.\n";
}
}

@ -28,6 +28,7 @@ distribution.
#include <vector>
#include <algorithm>
#include <map>
#include <iostream>
using namespace std;
#include "dfhack/VersionInfoFactory.h"
@ -680,12 +681,18 @@ void VersionInfoFactory::ParseVersion (TiXmlElement* entry, VersionInfo* mem)
bool VersionInfoFactory::loadFile(string path_to_xml)
{
TiXmlDocument doc( path_to_xml.c_str() );
std::cerr << "Loading " << path_to_xml << " ... ";
//bool loadOkay = doc.LoadFile();
if (!doc.LoadFile())
{
error = true;
cerr << "failed!\n";
throw Error::MemoryXmlParse(doc.ErrorDesc(), doc.ErrorId(), doc.ErrorRow(), doc.ErrorCol());
}
else
{
cerr << "OK\n";
}
TiXmlHandle hDoc(&doc);
TiXmlElement* pElem;
TiXmlHandle hRoot(0);