Remove DSTACK support (#6346)

Debugstacks is not useful, we don't really use it, the DebugStack is not pertinent, gdb and lldb are better if we really want to debug.
This commit is contained in:
Loïc Blot 2017-08-30 08:09:41 +02:00 committed by GitHub
parent 43f9e948a1
commit bd6b90359c
22 changed files with 1 additions and 327 deletions

@ -252,8 +252,6 @@ Client::~Client()
void Client::connect(Address address, bool is_local_server) void Client::connect(Address address, bool is_local_server)
{ {
DSTACK(FUNCTION_NAME);
initLocalMapSaving(address, m_address_name, is_local_server); initLocalMapSaving(address, m_address_name, is_local_server);
m_con->SetTimeoutMs(0); m_con->SetTimeoutMs(0);
@ -262,8 +260,6 @@ void Client::connect(Address address, bool is_local_server)
void Client::step(float dtime) void Client::step(float dtime)
{ {
DSTACK(FUNCTION_NAME);
// Limit a bit // Limit a bit
if(dtime > 2.0) if(dtime > 2.0)
dtime = 2.0; dtime = 2.0;
@ -773,7 +769,6 @@ void Client::initLocalMapSaving(const Address &address,
void Client::ReceiveAll() void Client::ReceiveAll()
{ {
DSTACK(FUNCTION_NAME);
u64 start_ms = porting::getTimeMs(); u64 start_ms = porting::getTimeMs();
for(;;) for(;;)
{ {
@ -799,7 +794,6 @@ void Client::ReceiveAll()
void Client::Receive() void Client::Receive()
{ {
DSTACK(FUNCTION_NAME);
NetworkPacket pkt; NetworkPacket pkt;
m_con->Receive(&pkt); m_con->Receive(&pkt);
ProcessData(&pkt); ProcessData(&pkt);
@ -816,8 +810,6 @@ inline void Client::handleCommand(NetworkPacket* pkt)
*/ */
void Client::ProcessData(NetworkPacket *pkt) void Client::ProcessData(NetworkPacket *pkt)
{ {
DSTACK(FUNCTION_NAME);
ToClientCommand command = (ToClientCommand) pkt->getCommand(); ToClientCommand command = (ToClientCommand) pkt->getCommand();
u32 sender_peer_id = pkt->getPeerId(); u32 sender_peer_id = pkt->getPeerId();
@ -1235,8 +1227,6 @@ void Client::sendChangePassword(const std::string &oldpassword,
void Client::sendDamage(u8 damage) void Client::sendDamage(u8 damage)
{ {
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOSERVER_DAMAGE, sizeof(u8)); NetworkPacket pkt(TOSERVER_DAMAGE, sizeof(u8));
pkt << damage; pkt << damage;
Send(&pkt); Send(&pkt);
@ -1244,8 +1234,6 @@ void Client::sendDamage(u8 damage)
void Client::sendBreath(u16 breath) void Client::sendBreath(u16 breath)
{ {
DSTACK(FUNCTION_NAME);
// Protocol v29 make this obsolete // Protocol v29 make this obsolete
if (m_proto_ver >= 29) if (m_proto_ver >= 29)
return; return;
@ -1257,16 +1245,12 @@ void Client::sendBreath(u16 breath)
void Client::sendRespawn() void Client::sendRespawn()
{ {
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOSERVER_RESPAWN, 0); NetworkPacket pkt(TOSERVER_RESPAWN, 0);
Send(&pkt); Send(&pkt);
} }
void Client::sendReady() void Client::sendReady()
{ {
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOSERVER_CLIENT_READY, NetworkPacket pkt(TOSERVER_CLIENT_READY,
1 + 1 + 1 + 1 + 2 + sizeof(char) * strlen(g_version_hash)); 1 + 1 + 1 + 1 + 2 + sizeof(char) * strlen(g_version_hash));

@ -73,8 +73,6 @@ public:
QUICKTUNE_INC, QUICKTUNE_INC,
QUICKTUNE_DEC, QUICKTUNE_DEC,
DEBUG_STACKS,
// hotbar // hotbar
SLOT_1, SLOT_1,
SLOT_2, SLOT_2,

@ -79,7 +79,6 @@ ClientMap & ClientEnvironment::getClientMap()
void ClientEnvironment::setLocalPlayer(LocalPlayer *player) void ClientEnvironment::setLocalPlayer(LocalPlayer *player)
{ {
DSTACK(FUNCTION_NAME);
/* /*
It is a failure if already is a local player It is a failure if already is a local player
*/ */
@ -91,8 +90,6 @@ void ClientEnvironment::setLocalPlayer(LocalPlayer *player)
void ClientEnvironment::step(float dtime) void ClientEnvironment::step(float dtime)
{ {
DSTACK(FUNCTION_NAME);
/* Step time of day */ /* Step time of day */
stepTimeOfDay(dtime); stepTimeOfDay(dtime);

@ -66,9 +66,6 @@ void RemoteClient::GetNextBlocks (
float dtime, float dtime,
std::vector<PrioritySortedBlockTransfer> &dest) std::vector<PrioritySortedBlockTransfer> &dest)
{ {
DSTACK(FUNCTION_NAME);
// Increment timers // Increment timers
m_nothing_to_send_pause_timer -= dtime; m_nothing_to_send_pause_timer -= dtime;
m_nearest_unsent_reset_timer += dtime; m_nearest_unsent_reset_timer += dtime;

@ -62,7 +62,6 @@ ClientMap::ClientMap(
MapSector * ClientMap::emergeSector(v2s16 p2d) MapSector * ClientMap::emergeSector(v2s16 p2d)
{ {
DSTACK(FUNCTION_NAME);
// Check that it doesn't exist already // Check that it doesn't exist already
try { try {
return getSectorNoGenerate(p2d); return getSectorNoGenerate(p2d);
@ -303,8 +302,6 @@ struct MeshBufListList
void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass) void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
{ {
DSTACK(FUNCTION_NAME);
bool is_transparent_pass = pass == scene::ESNRP_TRANSPARENT; bool is_transparent_pass = pass == scene::ESNRP_TRANSPARENT;
std::string prefix; std::string prefix;

@ -56,8 +56,6 @@ void sanity_check_fn(const char *assertion, const char *file,
errorstream << file << ":" << line << ": " << function errorstream << file << ":" << line << ": " << function
<< ": An engine assumption '" << assertion << "' failed." << std::endl; << ": An engine assumption '" << assertion << "' failed." << std::endl;
debug_stacks_print_to(errorstream);
abort(); abort();
} }
@ -73,140 +71,9 @@ void fatal_error_fn(const char *msg, const char *file,
errorstream << file << ":" << line << ": " << function errorstream << file << ":" << line << ": " << function
<< ": A fatal error occured: " << msg << std::endl; << ": A fatal error occured: " << msg << std::endl;
debug_stacks_print_to(errorstream);
abort(); abort();
} }
/*
DebugStack
*/
struct DebugStack
{
DebugStack(std::thread::id id);
void print(FILE *file, bool everything);
void print(std::ostream &os, bool everything);
std::thread::id thread_id;
char stack[DEBUG_STACK_SIZE][DEBUG_STACK_TEXT_SIZE];
int stack_i; // Points to the lowest empty position
int stack_max_i; // Highest i that was seen
};
DebugStack::DebugStack(std::thread::id id)
{
thread_id = id;
stack_i = 0;
stack_max_i = 0;
memset(stack, 0, DEBUG_STACK_SIZE*DEBUG_STACK_TEXT_SIZE);
}
void DebugStack::print(FILE *file, bool everything)
{
std::ostringstream os;
os << thread_id;
fprintf(file, "DEBUG STACK FOR THREAD %s:\n",
os.str().c_str());
for (int i = 0; i < stack_max_i; i++) {
if (i == stack_i && !everything)
break;
if (i < stack_i)
fprintf(file, "#%d %s\n", i, stack[i]);
else
fprintf(file, "(Leftover data: #%d %s)\n", i, stack[i]);
}
if (stack_i == DEBUG_STACK_SIZE)
fprintf(file, "Probably overflown.\n");
}
void DebugStack::print(std::ostream &os, bool everything)
{
os<<"DEBUG STACK FOR THREAD "<<thread_id<<": "<<std::endl;
for(int i = 0; i < stack_max_i; i++) {
if(i == stack_i && !everything)
break;
if (i < stack_i)
os<<"#"<<i<<" "<<stack[i]<<std::endl;
else
os<<"(Leftover data: #"<<i<<" "<<stack[i]<<")"<<std::endl;
}
if (stack_i == DEBUG_STACK_SIZE)
os<<"Probably overflown."<<std::endl;
}
std::map<std::thread::id, DebugStack*> g_debug_stacks;
std::mutex g_debug_stacks_mutex;
void debug_stacks_print_to(std::ostream &os)
{
MutexAutoLock lock(g_debug_stacks_mutex);
os<<"Debug stacks:"<<std::endl;
for (auto it : g_debug_stacks) {
it.second->print(os, false);
}
}
void debug_stacks_print()
{
debug_stacks_print_to(errorstream);
}
DebugStacker::DebugStacker(const char *text)
{
std::thread::id thread_id = std::this_thread::get_id();
MutexAutoLock lock(g_debug_stacks_mutex);
auto n = g_debug_stacks.find(thread_id);
if (n != g_debug_stacks.end()) {
m_stack = n->second;
} else {
/*DEBUGPRINT("Creating new debug stack for thread %x\n",
(unsigned int)thread_id);*/
m_stack = new DebugStack(thread_id);
g_debug_stacks[thread_id] = m_stack;
}
if (m_stack->stack_i >= DEBUG_STACK_SIZE) {
m_overflowed = true;
} else {
m_overflowed = false;
snprintf(m_stack->stack[m_stack->stack_i],
DEBUG_STACK_TEXT_SIZE, "%s", text);
m_stack->stack_i++;
if (m_stack->stack_i > m_stack->stack_max_i)
m_stack->stack_max_i = m_stack->stack_i;
}
}
DebugStacker::~DebugStacker()
{
MutexAutoLock lock(g_debug_stacks_mutex);
if (m_overflowed)
return;
m_stack->stack_i--;
if (m_stack->stack_i == 0) {
std::thread::id thread_id = m_stack->thread_id;
/*DEBUGPRINT("Deleting debug stack for thread %x\n",
(unsigned int)thread_id);*/
delete m_stack;
g_debug_stacks.erase(thread_id);
}
}
#ifdef _MSC_VER #ifdef _MSC_VER
const char *Win32ExceptionCodeToString(DWORD exception_code) const char *Win32ExceptionCodeToString(DWORD exception_code)

@ -83,36 +83,6 @@ NORETURN extern void sanity_check_fn(
void debug_set_exception_handler(); void debug_set_exception_handler();
/*
DebugStack
*/
#define DEBUG_STACK_SIZE 50
#define DEBUG_STACK_TEXT_SIZE 300
extern void debug_stacks_print_to(std::ostream &os);
extern void debug_stacks_print();
struct DebugStack;
class DebugStacker
{
public:
DebugStacker(const char *text);
~DebugStacker();
private:
DebugStack *m_stack;
bool m_overflowed;
};
#define DSTACK(msg) \
DebugStacker __debug_stacker(msg);
#define DSTACKF(...) \
char __buf[DEBUG_STACK_TEXT_SIZE]; \
snprintf(__buf, DEBUG_STACK_TEXT_SIZE, __VA_ARGS__); \
DebugStacker __debug_stacker(__buf);
/* /*
These should be put into every thread These should be put into every thread
*/ */

@ -598,7 +598,6 @@ MapBlock *EmergeThread::finishGen(v3s16 pos, BlockMakeData *bmdata,
void *EmergeThread::run() void *EmergeThread::run()
{ {
DSTACK(FUNCTION_NAME);
BEGIN_DEBUG_EXCEPTION_HANDLER BEGIN_DEBUG_EXCEPTION_HANDLER
v3s16 pos; v3s16 pos;

@ -1099,8 +1099,6 @@ void KeyCache::populate()
key[KeyType::QUICKTUNE_INC] = getKeySetting("keymap_quicktune_inc"); key[KeyType::QUICKTUNE_INC] = getKeySetting("keymap_quicktune_inc");
key[KeyType::QUICKTUNE_DEC] = getKeySetting("keymap_quicktune_dec"); key[KeyType::QUICKTUNE_DEC] = getKeySetting("keymap_quicktune_dec");
key[KeyType::DEBUG_STACKS] = getKeySetting("keymap_print_debug_stacks");
for (int i = 0; i < 23; i++) { for (int i = 0; i < 23; i++) {
std::string slot_key_name = "keymap_slot" + std::to_string(i + 1); std::string slot_key_name = "keymap_slot" + std::to_string(i + 1);
key[KeyType::SLOT_1 + i] = getKeySetting(slot_key_name.c_str()); key[KeyType::SLOT_1 + i] = getKeySetting(slot_key_name.c_str());
@ -2609,14 +2607,6 @@ void Game::processKeyInput()
quicktune->inc(); quicktune->inc();
} else if (wasKeyDown(KeyType::QUICKTUNE_DEC)) { } else if (wasKeyDown(KeyType::QUICKTUNE_DEC)) {
quicktune->dec(); quicktune->dec();
} else if (wasKeyDown(KeyType::DEBUG_STACKS)) {
// Print debug stacks
dstream << "-----------------------------------------"
<< std::endl;
dstream << "Printing debug stacks:" << std::endl;
dstream << "-----------------------------------------"
<< std::endl;
debug_stacks_print();
} }
if (!isKeyDown(KeyType::JUMP) && runData.reset_jump_timer) { if (!isKeyDown(KeyType::JUMP) && runData.reset_jump_timer) {

@ -63,7 +63,6 @@ enum
GUI_ID_KEY_MUTE_BUTTON, GUI_ID_KEY_MUTE_BUTTON,
GUI_ID_KEY_DEC_VOLUME_BUTTON, GUI_ID_KEY_DEC_VOLUME_BUTTON,
GUI_ID_KEY_INC_VOLUME_BUTTON, GUI_ID_KEY_INC_VOLUME_BUTTON,
GUI_ID_KEY_DUMP_BUTTON,
GUI_ID_KEY_RANGE_BUTTON, GUI_ID_KEY_RANGE_BUTTON,
GUI_ID_KEY_ZOOM_BUTTON, GUI_ID_KEY_ZOOM_BUTTON,
GUI_ID_KEY_CAMERA_BUTTON, GUI_ID_KEY_CAMERA_BUTTON,
@ -433,6 +432,5 @@ void GUIKeyChangeMenu::init_keys()
this->add_key(GUI_ID_KEY_HUD_BUTTON, wgettext("Toggle HUD"), "keymap_toggle_hud"); this->add_key(GUI_ID_KEY_HUD_BUTTON, wgettext("Toggle HUD"), "keymap_toggle_hud");
this->add_key(GUI_ID_KEY_CHATLOG_BUTTON, wgettext("Toggle chat log"), "keymap_toggle_chat"); this->add_key(GUI_ID_KEY_CHATLOG_BUTTON, wgettext("Toggle chat log"), "keymap_toggle_chat");
this->add_key(GUI_ID_KEY_FOG_BUTTON, wgettext("Toggle fog"), "keymap_toggle_force_fog_off"); this->add_key(GUI_ID_KEY_FOG_BUTTON, wgettext("Toggle fog"), "keymap_toggle_force_fog_off");
this->add_key(GUI_ID_KEY_DUMP_BUTTON, wgettext("Print stacks"), "keymap_print_debug_stacks");
} }

@ -642,8 +642,6 @@ protected:
void *run() void *run()
{ {
DSTACK(FUNCTION_NAME);
CurlHandlePool pool; CurlHandlePool pool;
m_multi = curl_multi_init(); m_multi = curl_multi_init();

@ -57,8 +57,6 @@ ItemStack::ItemStack(const std::string &name_, u16 count_,
void ItemStack::serialize(std::ostream &os) const void ItemStack::serialize(std::ostream &os) const
{ {
DSTACK(FUNCTION_NAME);
if (empty()) if (empty())
return; return;
@ -84,8 +82,6 @@ void ItemStack::serialize(std::ostream &os) const
void ItemStack::deSerialize(std::istream &is, IItemDefManager *itemdef) void ItemStack::deSerialize(std::istream &is, IItemDefManager *itemdef)
{ {
DSTACK(FUNCTION_NAME);
clear(); clear();
// Read name // Read name

@ -842,8 +842,6 @@ bool getCraftingResult(Inventory *inv, ItemStack &result,
std::vector<ItemStack> &output_replacements, std::vector<ItemStack> &output_replacements,
bool decrementInput, IGameDef *gamedef) bool decrementInput, IGameDef *gamedef)
{ {
DSTACK(FUNCTION_NAME);
result.clear(); result.clear();
// Get the InventoryList in which we will operate // Get the InventoryList in which we will operate

@ -151,9 +151,6 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
// Initialize debug stacks
DSTACK(FUNCTION_NAME);
// Debug handler // Debug handler
BEGIN_DEBUG_EXCEPTION_HANDLER BEGIN_DEBUG_EXCEPTION_HANDLER
@ -779,8 +776,6 @@ static bool determine_subgame(GameParams *game_params)
*****************************************************************************/ *****************************************************************************/
static bool run_dedicated_server(const GameParams &game_params, const Settings &cmd_args) static bool run_dedicated_server(const GameParams &game_params, const Settings &cmd_args)
{ {
DSTACK("Dedicated server branch");
verbosestream << _("Using world path") << " [" verbosestream << _("Using world path") << " ["
<< game_params.world_path << "]" << std::endl; << game_params.world_path << "]" << std::endl;
verbosestream << _("Using gameid") << " [" verbosestream << _("Using gameid") << " ["

@ -220,7 +220,6 @@ void Map::setNode(v3s16 p, MapNode & n)
<<" while trying to replace \"" <<" while trying to replace \""
<<m_nodedef->get(block->getNodeNoCheck(relpos, &temp_bool)).name <<m_nodedef->get(block->getNodeNoCheck(relpos, &temp_bool)).name
<<"\" at "<<PP(p)<<" (block "<<PP(blockpos)<<")"<<std::endl; <<"\" at "<<PP(p)<<" (block "<<PP(blockpos)<<")"<<std::endl;
debug_stacks_print_to(infostream);
return; return;
} }
block->setNodeNoCheck(relpos, n); block->setNodeNoCheck(relpos, n);
@ -546,9 +545,6 @@ s32 Map::transforming_liquid_size() {
void Map::transformLiquids(std::map<v3s16, MapBlock*> &modified_blocks, void Map::transformLiquids(std::map<v3s16, MapBlock*> &modified_blocks,
ServerEnvironment *env) ServerEnvironment *env)
{ {
DSTACK(FUNCTION_NAME);
//TimeTaker timer("transformLiquids()");
u32 loopcount = 0; u32 loopcount = 0;
u32 initial_size = m_transforming_liquid.size(); u32 initial_size = m_transforming_liquid.size();
@ -1432,10 +1428,6 @@ void ServerMap::finishBlockMake(BlockMakeData *data,
MapSector *ServerMap::createSector(v2s16 p2d) MapSector *ServerMap::createSector(v2s16 p2d)
{ {
DSTACKF("%s: p2d=(%d,%d)",
FUNCTION_NAME,
p2d.X, p2d.Y);
/* /*
Check if it exists already in memory Check if it exists already in memory
*/ */
@ -1479,12 +1471,6 @@ MapBlock * ServerMap::generateBlock(
std::map<v3s16, MapBlock*> &modified_blocks std::map<v3s16, MapBlock*> &modified_blocks
) )
{ {
DSTACKF("%s: p=(%d,%d,%d)", FUNCTION_NAME, p.X, p.Y, p.Z);
/*infostream<<"generateBlock(): "
<<"("<<p.X<<","<<p.Y<<","<<p.Z<<")"
<<std::endl;*/
bool enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info"); bool enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
TimeTaker timer("generateBlock"); TimeTaker timer("generateBlock");
@ -1588,9 +1574,6 @@ MapBlock * ServerMap::generateBlock(
MapBlock * ServerMap::createBlock(v3s16 p) MapBlock * ServerMap::createBlock(v3s16 p)
{ {
DSTACKF("%s: p=(%d,%d,%d)",
FUNCTION_NAME, p.X, p.Y, p.Z);
/* /*
Do not create over max mapgen limit Do not create over max mapgen limit
*/ */
@ -1632,10 +1615,6 @@ MapBlock * ServerMap::createBlock(v3s16 p)
MapBlock * ServerMap::emergeBlock(v3s16 p, bool create_blank) MapBlock * ServerMap::emergeBlock(v3s16 p, bool create_blank)
{ {
DSTACKF("%s: p=(%d,%d,%d), create_blank=%d",
FUNCTION_NAME,
p.X, p.Y, p.Z, create_blank);
{ {
MapBlock *block = getBlockNoCreateNoEx(p); MapBlock *block = getBlockNoCreateNoEx(p);
if (block && !block->isDummy()) if (block && !block->isDummy())
@ -1825,7 +1804,6 @@ std::string ServerMap::getBlockFilename(v3s16 p)
void ServerMap::save(ModifiedState save_level) void ServerMap::save(ModifiedState save_level)
{ {
DSTACK(FUNCTION_NAME);
if (!m_map_saving_enabled) { if (!m_map_saving_enabled) {
warningstream<<"Not saving map, saving disabled."<<std::endl; warningstream<<"Not saving map, saving disabled."<<std::endl;
return; return;
@ -1991,8 +1969,6 @@ bool ServerMap::saveBlock(MapBlock *block, MapDatabase *db)
void ServerMap::loadBlock(const std::string &sectordir, const std::string &blockfile, void ServerMap::loadBlock(const std::string &sectordir, const std::string &blockfile,
MapSector *sector, bool save_after_load) MapSector *sector, bool save_after_load)
{ {
DSTACK(FUNCTION_NAME);
std::string fullpath = sectordir + DIR_DELIM + blockfile; std::string fullpath = sectordir + DIR_DELIM + blockfile;
try { try {
std::ifstream is(fullpath.c_str(), std::ios_base::binary); std::ifstream is(fullpath.c_str(), std::ios_base::binary);
@ -2069,8 +2045,6 @@ void ServerMap::loadBlock(const std::string &sectordir, const std::string &block
void ServerMap::loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool save_after_load) void ServerMap::loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool save_after_load)
{ {
DSTACK(FUNCTION_NAME);
try { try {
std::istringstream is(*blob, std::ios_base::binary); std::istringstream is(*blob, std::ios_base::binary);
@ -2132,8 +2106,6 @@ void ServerMap::loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool
MapBlock* ServerMap::loadBlock(v3s16 blockpos) MapBlock* ServerMap::loadBlock(v3s16 blockpos)
{ {
DSTACK(FUNCTION_NAME);
bool created_new = (getBlockNoCreateNoEx(blockpos) == NULL); bool created_new = (getBlockNoCreateNoEx(blockpos) == NULL);
v2s16 p2d(blockpos.X, blockpos.Z); v2s16 p2d(blockpos.X, blockpos.Z);

@ -74,8 +74,6 @@ MeshUpdateQueue::~MeshUpdateQueue()
void MeshUpdateQueue::addBlock(Map *map, v3s16 p, bool ack_block_to_server, bool urgent) void MeshUpdateQueue::addBlock(Map *map, v3s16 p, bool ack_block_to_server, bool urgent)
{ {
DSTACK(FUNCTION_NAME);
MutexAutoLock lock(m_mutex); MutexAutoLock lock(m_mutex);
cleanupCache(); cleanupCache();

@ -90,7 +90,6 @@ private:
void *ServerThread::run() void *ServerThread::run()
{ {
DSTACK(FUNCTION_NAME);
BEGIN_DEBUG_EXCEPTION_HANDLER BEGIN_DEBUG_EXCEPTION_HANDLER
m_server->AsyncRunStep(true); m_server->AsyncRunStep(true);
@ -367,8 +366,6 @@ Server::~Server()
void Server::start(Address bind_addr) void Server::start(Address bind_addr)
{ {
DSTACK(FUNCTION_NAME);
m_bind_addr = bind_addr; m_bind_addr = bind_addr;
infostream<<"Starting server on " infostream<<"Starting server on "
@ -400,8 +397,6 @@ void Server::start(Address bind_addr)
void Server::stop() void Server::stop()
{ {
DSTACK(FUNCTION_NAME);
infostream<<"Server: Stopping and waiting threads"<<std::endl; infostream<<"Server: Stopping and waiting threads"<<std::endl;
// Stop threads (set run=false first so both start stopping) // Stop threads (set run=false first so both start stopping)
@ -415,7 +410,6 @@ void Server::stop()
void Server::step(float dtime) void Server::step(float dtime)
{ {
DSTACK(FUNCTION_NAME);
// Limit a bit // Limit a bit
if (dtime > 2.0) if (dtime > 2.0)
dtime = 2.0; dtime = 2.0;
@ -437,8 +431,6 @@ void Server::step(float dtime)
void Server::AsyncRunStep(bool initial_step) void Server::AsyncRunStep(bool initial_step)
{ {
DSTACK(FUNCTION_NAME);
g_profiler->add("Server::AsyncRunStep (num)", 1); g_profiler->add("Server::AsyncRunStep (num)", 1);
float dtime; float dtime;
@ -980,7 +972,6 @@ void Server::AsyncRunStep(bool initial_step)
void Server::Receive() void Server::Receive()
{ {
DSTACK(FUNCTION_NAME);
u16 peer_id; u16 peer_id;
try { try {
NetworkPacket pkt; NetworkPacket pkt;
@ -1093,7 +1084,6 @@ inline void Server::handleCommand(NetworkPacket* pkt)
void Server::ProcessData(NetworkPacket *pkt) void Server::ProcessData(NetworkPacket *pkt)
{ {
DSTACK(FUNCTION_NAME);
// Environment is locked first. // Environment is locked first.
MutexAutoLock envlock(m_env_mutex); MutexAutoLock envlock(m_env_mutex);
@ -1290,7 +1280,6 @@ void Server::SetBlocksNotSent(std::map<v3s16, MapBlock *>& block)
void Server::peerAdded(con::Peer *peer) void Server::peerAdded(con::Peer *peer)
{ {
DSTACK(FUNCTION_NAME);
verbosestream<<"Server::peerAdded(): peer->id=" verbosestream<<"Server::peerAdded(): peer->id="
<<peer->id<<std::endl; <<peer->id<<std::endl;
@ -1299,7 +1288,6 @@ void Server::peerAdded(con::Peer *peer)
void Server::deletingPeer(con::Peer *peer, bool timeout) void Server::deletingPeer(con::Peer *peer, bool timeout)
{ {
DSTACK(FUNCTION_NAME);
verbosestream<<"Server::deletingPeer(): peer->id=" verbosestream<<"Server::deletingPeer(): peer->id="
<<peer->id<<", timeout="<<timeout<<std::endl; <<peer->id<<", timeout="<<timeout<<std::endl;
@ -1396,7 +1384,6 @@ void Server::Send(NetworkPacket* pkt)
void Server::SendMovement(u16 peer_id) void Server::SendMovement(u16 peer_id)
{ {
DSTACK(FUNCTION_NAME);
std::ostringstream os(std::ios_base::binary); std::ostringstream os(std::ios_base::binary);
NetworkPacket pkt(TOCLIENT_MOVEMENT, 12 * sizeof(float), peer_id); NetworkPacket pkt(TOCLIENT_MOVEMENT, 12 * sizeof(float), peer_id);
@ -1433,8 +1420,6 @@ void Server::SendPlayerHPOrDie(PlayerSAO *playersao)
void Server::SendHP(u16 peer_id, u16 hp) void Server::SendHP(u16 peer_id, u16 hp)
{ {
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOCLIENT_HP, 1, peer_id); NetworkPacket pkt(TOCLIENT_HP, 1, peer_id);
pkt << hp; pkt << hp;
Send(&pkt); Send(&pkt);
@ -1442,8 +1427,6 @@ void Server::SendHP(u16 peer_id, u16 hp)
void Server::SendBreath(u16 peer_id, u16 breath) void Server::SendBreath(u16 peer_id, u16 breath)
{ {
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOCLIENT_BREATH, 2, peer_id); NetworkPacket pkt(TOCLIENT_BREATH, 2, peer_id);
pkt << (u16) breath; pkt << (u16) breath;
Send(&pkt); Send(&pkt);
@ -1466,8 +1449,6 @@ void Server::SendAccessDenied(u16 peer_id, AccessDeniedCode reason,
void Server::SendAccessDenied_Legacy(u16 peer_id,const std::wstring &reason) void Server::SendAccessDenied_Legacy(u16 peer_id,const std::wstring &reason)
{ {
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOCLIENT_ACCESS_DENIED_LEGACY, 0, peer_id); NetworkPacket pkt(TOCLIENT_ACCESS_DENIED_LEGACY, 0, peer_id);
pkt << reason; pkt << reason;
Send(&pkt); Send(&pkt);
@ -1476,8 +1457,6 @@ void Server::SendAccessDenied_Legacy(u16 peer_id,const std::wstring &reason)
void Server::SendDeathscreen(u16 peer_id,bool set_camera_point_target, void Server::SendDeathscreen(u16 peer_id,bool set_camera_point_target,
v3f camera_point_target) v3f camera_point_target)
{ {
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOCLIENT_DEATHSCREEN, 1 + sizeof(v3f), peer_id); NetworkPacket pkt(TOCLIENT_DEATHSCREEN, 1 + sizeof(v3f), peer_id);
pkt << set_camera_point_target << camera_point_target; pkt << set_camera_point_target << camera_point_target;
Send(&pkt); Send(&pkt);
@ -1486,8 +1465,6 @@ void Server::SendDeathscreen(u16 peer_id,bool set_camera_point_target,
void Server::SendItemDef(u16 peer_id, void Server::SendItemDef(u16 peer_id,
IItemDefManager *itemdef, u16 protocol_version) IItemDefManager *itemdef, u16 protocol_version)
{ {
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOCLIENT_ITEMDEF, 0, peer_id); NetworkPacket pkt(TOCLIENT_ITEMDEF, 0, peer_id);
/* /*
@ -1511,8 +1488,6 @@ void Server::SendItemDef(u16 peer_id,
void Server::SendNodeDef(u16 peer_id, void Server::SendNodeDef(u16 peer_id,
INodeDefManager *nodedef, u16 protocol_version) INodeDefManager *nodedef, u16 protocol_version)
{ {
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOCLIENT_NODEDEF, 0, peer_id); NetworkPacket pkt(TOCLIENT_NODEDEF, 0, peer_id);
/* /*
@ -1540,8 +1515,6 @@ void Server::SendNodeDef(u16 peer_id,
void Server::SendInventory(PlayerSAO* playerSAO) void Server::SendInventory(PlayerSAO* playerSAO)
{ {
DSTACK(FUNCTION_NAME);
UpdateCrafting(playerSAO->getPlayer()); UpdateCrafting(playerSAO->getPlayer());
/* /*
@ -1561,8 +1534,6 @@ void Server::SendInventory(PlayerSAO* playerSAO)
void Server::SendChatMessage(u16 peer_id, const ChatMessage &message) void Server::SendChatMessage(u16 peer_id, const ChatMessage &message)
{ {
DSTACK(FUNCTION_NAME);
NetworkPacket legacypkt(TOCLIENT_CHAT_MESSAGE_OLD, 0, peer_id); NetworkPacket legacypkt(TOCLIENT_CHAT_MESSAGE_OLD, 0, peer_id);
legacypkt << message.message; legacypkt << message.message;
@ -1588,8 +1559,6 @@ void Server::SendChatMessage(u16 peer_id, const ChatMessage &message)
void Server::SendShowFormspecMessage(u16 peer_id, const std::string &formspec, void Server::SendShowFormspecMessage(u16 peer_id, const std::string &formspec,
const std::string &formname) const std::string &formname)
{ {
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOCLIENT_SHOW_FORMSPEC, 0 , peer_id); NetworkPacket pkt(TOCLIENT_SHOW_FORMSPEC, 0 , peer_id);
if (formspec.empty()){ if (formspec.empty()){
//the client should close the formspec //the client should close the formspec
@ -1610,7 +1579,6 @@ void Server::SendSpawnParticle(u16 peer_id, u16 protocol_version,
bool vertical, const std::string &texture, bool vertical, const std::string &texture,
const struct TileAnimationParams &animation, u8 glow) const struct TileAnimationParams &animation, u8 glow)
{ {
DSTACK(FUNCTION_NAME);
static thread_local const float radius = static thread_local const float radius =
g_settings->getS16("max_block_send_distance") * MAP_BLOCKSIZE * BS; g_settings->getS16("max_block_send_distance") * MAP_BLOCKSIZE * BS;
@ -1662,7 +1630,6 @@ void Server::SendAddParticleSpawner(u16 peer_id, u16 protocol_version,
u16 attached_id, bool vertical, const std::string &texture, u32 id, u16 attached_id, bool vertical, const std::string &texture, u32 id,
const struct TileAnimationParams &animation, u8 glow) const struct TileAnimationParams &animation, u8 glow)
{ {
DSTACK(FUNCTION_NAME);
if (peer_id == PEER_ID_INEXISTENT) { if (peer_id == PEER_ID_INEXISTENT) {
// This sucks and should be replaced: // This sucks and should be replaced:
std::vector<u16> clients = m_clients.getClientIDs(); std::vector<u16> clients = m_clients.getClientIDs();
@ -1701,8 +1668,6 @@ void Server::SendAddParticleSpawner(u16 peer_id, u16 protocol_version,
void Server::SendDeleteParticleSpawner(u16 peer_id, u32 id) void Server::SendDeleteParticleSpawner(u16 peer_id, u32 id)
{ {
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOCLIENT_DELETE_PARTICLESPAWNER_LEGACY, 2, peer_id); NetworkPacket pkt(TOCLIENT_DELETE_PARTICLESPAWNER_LEGACY, 2, peer_id);
// Ugly error in this packet // Ugly error in this packet
@ -1828,8 +1793,6 @@ void Server::SendOverrideDayNightRatio(u16 peer_id, bool do_override,
void Server::SendTimeOfDay(u16 peer_id, u16 time, f32 time_speed) void Server::SendTimeOfDay(u16 peer_id, u16 time, f32 time_speed)
{ {
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOCLIENT_TIME_OF_DAY, 0, peer_id); NetworkPacket pkt(TOCLIENT_TIME_OF_DAY, 0, peer_id);
pkt << time << time_speed; pkt << time << time_speed;
@ -1843,7 +1806,6 @@ void Server::SendTimeOfDay(u16 peer_id, u16 time, f32 time_speed)
void Server::SendPlayerHP(u16 peer_id) void Server::SendPlayerHP(u16 peer_id)
{ {
DSTACK(FUNCTION_NAME);
PlayerSAO *playersao = getPlayerSAO(peer_id); PlayerSAO *playersao = getPlayerSAO(peer_id);
// In some rare case if the player is disconnected // In some rare case if the player is disconnected
// while Lua call l_punch, for example, this can be NULL // while Lua call l_punch, for example, this can be NULL
@ -1861,7 +1823,6 @@ void Server::SendPlayerHP(u16 peer_id)
void Server::SendPlayerBreath(PlayerSAO *sao) void Server::SendPlayerBreath(PlayerSAO *sao)
{ {
DSTACK(FUNCTION_NAME);
assert(sao); assert(sao);
m_script->player_event(sao, "breath_changed"); m_script->player_event(sao, "breath_changed");
@ -1870,7 +1831,6 @@ void Server::SendPlayerBreath(PlayerSAO *sao)
void Server::SendMovePlayer(u16 peer_id) void Server::SendMovePlayer(u16 peer_id)
{ {
DSTACK(FUNCTION_NAME);
RemotePlayer *player = m_env->getPlayer(peer_id); RemotePlayer *player = m_env->getPlayer(peer_id);
assert(player); assert(player);
PlayerSAO *sao = player->getPlayerSAO(); PlayerSAO *sao = player->getPlayerSAO();
@ -2194,8 +2154,6 @@ void Server::setBlockNotSent(v3s16 p)
void Server::SendBlockNoLock(u16 peer_id, MapBlock *block, u8 ver, u16 net_proto_version) void Server::SendBlockNoLock(u16 peer_id, MapBlock *block, u8 ver, u16 net_proto_version)
{ {
DSTACK(FUNCTION_NAME);
v3s16 p = block->getPos(); v3s16 p = block->getPos();
/* /*
@ -2216,8 +2174,6 @@ void Server::SendBlockNoLock(u16 peer_id, MapBlock *block, u8 ver, u16 net_proto
void Server::SendBlocks(float dtime) void Server::SendBlocks(float dtime)
{ {
DSTACK(FUNCTION_NAME);
MutexAutoLock envlock(m_env_mutex); MutexAutoLock envlock(m_env_mutex);
//TODO check if one big lock could be faster then multiple small ones //TODO check if one big lock could be faster then multiple small ones
@ -2282,8 +2238,6 @@ void Server::SendBlocks(float dtime)
void Server::fillMediaCache() void Server::fillMediaCache()
{ {
DSTACK(FUNCTION_NAME);
infostream<<"Server: Calculating media file checksums"<<std::endl; infostream<<"Server: Calculating media file checksums"<<std::endl;
// Collect all media file paths // Collect all media file paths
@ -2379,8 +2333,6 @@ void Server::fillMediaCache()
void Server::sendMediaAnnouncement(u16 peer_id, const std::string &lang_code) void Server::sendMediaAnnouncement(u16 peer_id, const std::string &lang_code)
{ {
DSTACK(FUNCTION_NAME);
verbosestream << "Server: Announcing files to id(" << peer_id << ")" verbosestream << "Server: Announcing files to id(" << peer_id << ")"
<< std::endl; << std::endl;
@ -2425,8 +2377,6 @@ struct SendableMedia
void Server::sendRequestedMedia(u16 peer_id, void Server::sendRequestedMedia(u16 peer_id,
const std::vector<std::string> &tosend) const std::vector<std::string> &tosend)
{ {
DSTACK(FUNCTION_NAME);
verbosestream<<"Server::sendRequestedMedia(): " verbosestream<<"Server::sendRequestedMedia(): "
<<"Sending files to client"<<std::endl; <<"Sending files to client"<<std::endl;
@ -2556,8 +2506,6 @@ void Server::sendDetachedInventory(const std::string &name, u16 peer_id)
void Server::sendDetachedInventories(u16 peer_id) void Server::sendDetachedInventories(u16 peer_id)
{ {
DSTACK(FUNCTION_NAME);
for (const auto &detached_inventory : m_detached_inventories) { for (const auto &detached_inventory : m_detached_inventories) {
const std::string &name = detached_inventory.first; const std::string &name = detached_inventory.first;
//Inventory *inv = i->second; //Inventory *inv = i->second;
@ -2571,7 +2519,6 @@ void Server::sendDetachedInventories(u16 peer_id)
void Server::DiePlayer(u16 peer_id) void Server::DiePlayer(u16 peer_id)
{ {
DSTACK(FUNCTION_NAME);
PlayerSAO *playersao = getPlayerSAO(peer_id); PlayerSAO *playersao = getPlayerSAO(peer_id);
// In some rare cases this can be NULL -- if the player is disconnected // In some rare cases this can be NULL -- if the player is disconnected
// when a Lua function modifies l_punch, for example // when a Lua function modifies l_punch, for example
@ -2593,8 +2540,6 @@ void Server::DiePlayer(u16 peer_id)
void Server::RespawnPlayer(u16 peer_id) void Server::RespawnPlayer(u16 peer_id)
{ {
DSTACK(FUNCTION_NAME);
PlayerSAO *playersao = getPlayerSAO(peer_id); PlayerSAO *playersao = getPlayerSAO(peer_id);
assert(playersao); assert(playersao);
@ -2617,8 +2562,6 @@ void Server::RespawnPlayer(u16 peer_id)
void Server::DenySudoAccess(u16 peer_id) void Server::DenySudoAccess(u16 peer_id)
{ {
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOCLIENT_DENY_SUDO_MODE, 0, peer_id); NetworkPacket pkt(TOCLIENT_DENY_SUDO_MODE, 0, peer_id);
Send(&pkt); Send(&pkt);
} }
@ -2643,8 +2586,6 @@ void Server::DenyAccessVerCompliant(u16 peer_id, u16 proto_ver, AccessDeniedCode
void Server::DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason) void Server::DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason)
{ {
DSTACK(FUNCTION_NAME);
SendAccessDenied(peer_id, reason, custom_reason); SendAccessDenied(peer_id, reason, custom_reason);
m_clients.event(peer_id, CSE_SetDenied); m_clients.event(peer_id, CSE_SetDenied);
m_con->DisconnectPeer(peer_id); m_con->DisconnectPeer(peer_id);
@ -2654,8 +2595,6 @@ void Server::DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string
// the minimum version for MT users, maybe in 1 year // the minimum version for MT users, maybe in 1 year
void Server::DenyAccess_Legacy(u16 peer_id, const std::wstring &reason) void Server::DenyAccess_Legacy(u16 peer_id, const std::wstring &reason)
{ {
DSTACK(FUNCTION_NAME);
SendAccessDenied_Legacy(peer_id, reason); SendAccessDenied_Legacy(peer_id, reason);
m_clients.event(peer_id, CSE_SetDenied); m_clients.event(peer_id, CSE_SetDenied);
m_con->DisconnectPeer(peer_id); m_con->DisconnectPeer(peer_id);
@ -2663,8 +2602,6 @@ void Server::DenyAccess_Legacy(u16 peer_id, const std::wstring &reason)
void Server::acceptAuth(u16 peer_id, bool forSudoMode) void Server::acceptAuth(u16 peer_id, bool forSudoMode)
{ {
DSTACK(FUNCTION_NAME);
if (!forSudoMode) { if (!forSudoMode) {
RemoteClient* client = getClient(peer_id, CS_Invalid); RemoteClient* client = getClient(peer_id, CS_Invalid);
@ -2694,7 +2631,6 @@ void Server::acceptAuth(u16 peer_id, bool forSudoMode)
void Server::DeleteClient(u16 peer_id, ClientDeletionReason reason) void Server::DeleteClient(u16 peer_id, ClientDeletionReason reason)
{ {
DSTACK(FUNCTION_NAME);
std::wstring message; std::wstring message;
{ {
/* /*
@ -2770,8 +2706,6 @@ void Server::DeleteClient(u16 peer_id, ClientDeletionReason reason)
void Server::UpdateCrafting(RemotePlayer *player) void Server::UpdateCrafting(RemotePlayer *player)
{ {
DSTACK(FUNCTION_NAME);
// Get a preview for crafting // Get a preview for crafting
ItemStack preview; ItemStack preview;
InventoryLocation loc; InventoryLocation loc;
@ -3608,8 +3542,6 @@ void Server::unregisterModStorage(const std::string &name)
void dedicated_server_loop(Server &server, bool &kill) void dedicated_server_loop(Server &server, bool &kill)
{ {
DSTACK(FUNCTION_NAME);
verbosestream<<"dedicated_server_loop()"<<std::endl; verbosestream<<"dedicated_server_loop()"<<std::endl;
IntervalLimiter m_profiler_interval; IntervalLimiter m_profiler_interval;

@ -424,7 +424,6 @@ RemotePlayer *ServerEnvironment::getPlayer(const char* name)
void ServerEnvironment::addPlayer(RemotePlayer *player) void ServerEnvironment::addPlayer(RemotePlayer *player)
{ {
DSTACK(FUNCTION_NAME);
/* /*
Check that peer_ids are unique. Check that peer_ids are unique.
Also check that names are unique. Also check that names are unique.
@ -1105,10 +1104,6 @@ void ServerEnvironment::clearObjects(ClearObjectsMode mode)
void ServerEnvironment::step(float dtime) void ServerEnvironment::step(float dtime)
{ {
DSTACK(FUNCTION_NAME);
//TimeTaker timer("ServerEnv step");
/* Step time of day */ /* Step time of day */
stepTimeOfDay(dtime); stepTimeOfDay(dtime);

@ -119,8 +119,6 @@ fake_function() {
gettext("Key for increasing the viewing range.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3"); gettext("Key for increasing the viewing range.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3");
gettext("View range decrease key"); gettext("View range decrease key");
gettext("Key for decreasing the viewing range.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3"); gettext("Key for decreasing the viewing range.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3");
gettext("Print stacks");
gettext("Key for printing debug stacks. Used for development.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3");
gettext("Network"); gettext("Network");
gettext("Server address"); gettext("Server address");
gettext("Address to connect to.\nLeave this blank to start a local server.\nNote that the address field in the main menu overrides this setting."); gettext("Address to connect to.\nLeave this blank to start a local server.\nNote that the address field in the main menu overrides this setting.");

@ -228,8 +228,6 @@ void TestGameDef::defineSomeNodes()
bool run_tests() bool run_tests()
{ {
DSTACK(FUNCTION_NAME);
u64 t1 = porting::getTimeMs(); u64 t1 = porting::getTimeMs();
TestGameDef gamedef; TestGameDef gamedef;

@ -123,8 +123,6 @@ void TestConnection::testHelpers()
void TestConnection::testConnectSendReceive() void TestConnection::testConnectSendReceive()
{ {
DSTACK("TestConnection::Run");
/* /*
Test some real connections Test some real connections

@ -203,7 +203,6 @@ public:
void *run() void *run()
{ {
DSTACK(FUNCTION_NAME);
BEGIN_DEBUG_EXCEPTION_HANDLER BEGIN_DEBUG_EXCEPTION_HANDLER
while (!stopRequested()) { while (!stopRequested()) {