Paste #DOr -- näytä pelkkänä tekstinä -- uusi tämän pohjalta
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 | From 2044e2185129886a57192672c5b5a878b2c6ab47 Mon Sep 17 00:00:00 2001 From: Perttu Ahola <celeron55@gmail.com> Date: Mon, 5 Aug 2013 18:24:41 +0300 Subject: [PATCH] Remove the ancient DebugStack framework - it hasn't turned out to be useful enough. --- minetest.conf.example | 1 - src/client.cpp | 14 ----- src/clientmap.cpp | 4 -- src/debug.cpp | 153 ----------------------------------------------- src/debug.h | 56 +++-------------- src/defaultsettings.cpp | 1 - src/emerge.cpp | 1 - src/environment.cpp | 6 -- src/game.cpp | 11 ---- src/guiKeyChangeMenu.cpp | 1 - src/inventory.cpp | 4 -- src/inventorymanager.cpp | 2 - src/main.cpp | 5 -- src/map.cpp | 34 ----------- src/porting.cpp | 11 ---- src/server.cpp | 62 +------------------ src/test.cpp | 4 -- 17 files changed, 10 insertions(+), 360 deletions(-) diff --git a/minetest.conf.example b/minetest.conf.example index 4c049f8..4f6448f 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -56,7 +56,6 @@ # If false aux1 is used to fly fast #always_fly_fast = true # Some (temporary) keys for debugging -#keymap_print_debug_stacks = KEY_KEY_P #keymap_quicktune_prev = KEY_HOME #keymap_quicktune_next = KEY_END #keymap_quicktune_dec = KEY_NEXT diff --git a/src/client.cpp b/src/client.cpp index f9908ad..e333e7b 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -101,8 +101,6 @@ static std::string getMediaCacheDir() */ void MeshUpdateQueue::addBlock(v3s16 p, MeshMakeData *data, bool ack_block_to_server, bool urgent) { - DSTACK(__FUNCTION_NAME); - assert(data); JMutexAutoLock lock(m_mutex); @@ -171,7 +169,6 @@ void * MeshUpdateThread::Thread() log_register_thread("MeshUpdateThread"); - DSTACK(__FUNCTION_NAME); BEGIN_DEBUG_EXCEPTION_HANDLER @@ -227,8 +224,6 @@ void * MediaFetchThread::Thread() log_register_thread("MediaFetchThread"); - DSTACK(__FUNCTION_NAME); - BEGIN_DEBUG_EXCEPTION_HANDLER #if USE_CURL @@ -378,7 +373,6 @@ void * MediaFetchThread::Thread() void Client::connect(Address address) { - DSTACK(__FUNCTION_NAME); //JMutexAutoLock lock(m_con_mutex); //bulk comment-out m_con.SetTimeoutMs(0); m_con.Connect(address); @@ -399,7 +393,6 @@ bool Client::connectedAndInitialized() void Client::step(float dtime) { - DSTACK(__FUNCTION_NAME); // Limit a bit if(dtime > 2.0) @@ -1068,7 +1061,6 @@ void Client::request_media(const std::list<MediaRequest> &file_requests) void Client::ReceiveAll() { - DSTACK(__FUNCTION_NAME); u32 start_ms = porting::getTimeMs(); for(;;) { @@ -1096,7 +1088,6 @@ void Client::ReceiveAll() void Client::Receive() { - DSTACK(__FUNCTION_NAME); SharedBuffer<u8> data; u16 sender_peer_id; u32 datasize; @@ -1114,8 +1105,6 @@ void Client::Receive() */ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id) { - DSTACK(__FUNCTION_NAME); - // Ignore packets that don't even fit a command if(datasize < 2) { @@ -2361,7 +2350,6 @@ void Client::sendChangePassword(const std::wstring oldpassword, void Client::sendDamage(u8 damage) { - DSTACK(__FUNCTION_NAME); std::ostringstream os(std::ios_base::binary); writeU16(os, TOSERVER_DAMAGE); @@ -2376,7 +2364,6 @@ void Client::sendDamage(u8 damage) void Client::sendBreath(u16 breath) { - DSTACK(__FUNCTION_NAME); std::ostringstream os(std::ios_base::binary); writeU16(os, TOSERVER_BREATH); @@ -2390,7 +2377,6 @@ void Client::sendBreath(u16 breath) void Client::sendRespawn() { - DSTACK(__FUNCTION_NAME); std::ostringstream os(std::ios_base::binary); writeU16(os, TOSERVER_RESPAWN); diff --git a/src/clientmap.cpp b/src/clientmap.cpp index e0c41c7..98b29e2 100644 --- a/src/clientmap.cpp +++ b/src/clientmap.cpp @@ -70,7 +70,6 @@ MapSector * ClientMap::emergeSector(v2s16 p2d) { - DSTACK(__FUNCTION_NAME); // Check that it doesn't exist already try{ return getSectorNoGenerate(p2d); @@ -93,7 +92,6 @@ MapSector * ClientMap::emergeSector(v2s16 p2d) #if 0 void ClientMap::deSerializeSector(v2s16 p2d, std::istream &is) { - DSTACK(__FUNCTION_NAME); ClientMapSector *sector = NULL; //JMutexAutoLock lock(m_sector_mutex); // Bulk comment-out @@ -406,8 +404,6 @@ struct MeshBufListList void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass) { - DSTACK(__FUNCTION_NAME); - bool is_transparent_pass = pass == scene::ESNRP_TRANSPARENT; std::string prefix; diff --git a/src/debug.cpp b/src/debug.cpp index 2e4992a..eba4015 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -71,163 +71,12 @@ void assert_fail(const char *assertion, const char *file, (unsigned long)get_current_thread_id(), file, line, function, assertion); - debug_stacks_print(); - if(g_debugstreams[1]) fclose(g_debugstreams[1]); abort(); } -/* - DebugStack -*/ - -DebugStack::DebugStack(threadid_t id) -{ - threadid = 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) -{ - fprintf(file, "DEBUG STACK FOR THREAD %lx:\n", - (unsigned long)threadid); - - for(int i=0; i<stack_max_i; i++) - { - if(i == stack_i && everything == false) - 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 "<<(unsigned long)threadid<<": "<<std::endl; - - for(int i=0; i<stack_max_i; i++) - { - if(i == stack_i && everything == false) - 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<threadid_t, DebugStack*> g_debug_stacks; -JMutex g_debug_stacks_mutex; - -void debug_stacks_init() -{ - g_debug_stacks_mutex.Init(); -} - -void debug_stacks_print_to(std::ostream &os) -{ - JMutexAutoLock lock(g_debug_stacks_mutex); - - os<<"Debug stacks:"<<std::endl; - - for(std::map<threadid_t, DebugStack*>::iterator - i = g_debug_stacks.begin(); - i != g_debug_stacks.end(); ++i) - { - i->second->print(os, false); - } -} - -void debug_stacks_print() -{ - JMutexAutoLock lock(g_debug_stacks_mutex); - - DEBUGPRINT("Debug stacks:\n"); - - for(std::map<threadid_t, DebugStack*>::iterator - i = g_debug_stacks.begin(); - i != g_debug_stacks.end(); ++i) - { - DebugStack *stack = i->second; - - for(int i=0; i<DEBUGSTREAM_COUNT; i++) - { - if(g_debugstreams[i] != NULL) - stack->print(g_debugstreams[i], true); - } - } -} - -DebugStacker::DebugStacker(const char *text) -{ - threadid_t threadid = get_current_thread_id(); - - JMutexAutoLock lock(g_debug_stacks_mutex); - - std::map<threadid_t, DebugStack*>::iterator n; - n = g_debug_stacks.find(threadid); - if(n != g_debug_stacks.end()) - { - m_stack = n->second; - } - else - { - /*DEBUGPRINT("Creating new debug stack for thread %x\n", - (unsigned int)threadid);*/ - m_stack = new DebugStack(threadid); - g_debug_stacks[threadid] = 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() -{ - JMutexAutoLock lock(g_debug_stacks_mutex); - - if(m_overflowed == true) - return; - - m_stack->stack_i--; - - if(m_stack->stack_i == 0) - { - threadid_t threadid = m_stack->threadid; - /*DEBUGPRINT("Deleting debug stack for thread %x\n", - (unsigned int)threadid);*/ - delete m_stack; - g_debug_stacks.erase(threadid); - } -} - - #ifdef _MSC_VER #if CATCH_UNHANDLED_EXCEPTIONS == 1 void se_trans_func(unsigned int u, EXCEPTION_POINTERS* pExp) @@ -257,5 +106,3 @@ void se_trans_func(unsigned int u, EXCEPTION_POINTERS* pExp) #endif #endif - - diff --git a/src/debug.h b/src/debug.h index 31855cc..1049086 100644 --- a/src/debug.h +++ b/src/debug.h @@ -148,52 +148,6 @@ __NORETURN extern void assert_fail( #define assert(expr) ASSERT(expr) /* - DebugStack -*/ - -#define DEBUG_STACK_SIZE 50 -#define DEBUG_STACK_TEXT_SIZE 300 - -struct DebugStack -{ - DebugStack(threadid_t id); - void print(FILE *file, bool everything); - void print(std::ostream &os, bool everything); - - threadid_t threadid; - 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 -}; - -extern std::map<threadid_t, DebugStack*> g_debug_stacks; -extern JMutex g_debug_stacks_mutex; - -extern void debug_stacks_init(); -extern void debug_stacks_print_to(std::ostream &os); -extern void debug_stacks_print(); - -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); - -/* Packet counter */ @@ -245,7 +199,15 @@ class PacketCounter }; /* - These should be put into every thread + These should be put into the beginning and end of every thread: + + BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER + END_DEBUG_EXCEPTION_HANDLER(errorstream) + + The debug exception handlers will print out any fall-through exception in + RELEASE builds, and will not do anything in DEBUG builds so that a debugger + can instead more helpfully provide a backtrace and other facilities. On + Windows they also catch certain kinds of OS-level failures. */ #if CATCH_UNHANDLED_EXCEPTIONS == 1 diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 326e11b..33bba94 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -61,7 +61,6 @@ void set_default_settings(Settings *settings) settings->setDefault("always_fly_fast", "true"); // Some (temporary) keys for debugging - settings->setDefault("keymap_print_debug_stacks", "KEY_KEY_P"); settings->setDefault("keymap_quicktune_prev", "KEY_HOME"); settings->setDefault("keymap_quicktune_next", "KEY_END"); settings->setDefault("keymap_quicktune_dec", "KEY_NEXT"); diff --git a/src/emerge.cpp b/src/emerge.cpp index f977637..2ad69a8 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -398,7 +398,6 @@ bool EmergeThread::getBlockOrStartGen(v3s16 p, MapBlock **b, void *EmergeThread::Thread() { ThreadStarted(); log_register_thread("EmergeThread" + itos(id)); - DSTACK(__FUNCTION_NAME); BEGIN_DEBUG_EXCEPTION_HANDLER v3s16 last_tried_pos(-32768,-32768,-32768); // For error output diff --git a/src/environment.cpp b/src/environment.cpp index 57fdfd7..2a8abb6 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -68,7 +68,6 @@ void Environment::addPlayer(Player *player) { - DSTACK(__FUNCTION_NAME); /* Check that peer_ids are unique. Also check that names are unique. @@ -85,7 +84,6 @@ void Environment::addPlayer(Player *player) void Environment::removePlayer(u16 peer_id) { - DSTACK(__FUNCTION_NAME); re_search: for(std::list<Player*>::iterator i = m_players.begin(); i != m_players.end(); ++i) @@ -1038,7 +1036,6 @@ void ServerEnvironment::clearAllObjects() void ServerEnvironment::step(float dtime) { - DSTACK(__FUNCTION_NAME); //TimeTaker timer("ServerEnv step"); @@ -2013,7 +2010,6 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete) void ClientEnvironment::addPlayer(Player *player) { - DSTACK(__FUNCTION_NAME); /* It is a failure if player is local and there already is a local player @@ -2037,8 +2033,6 @@ LocalPlayer * ClientEnvironment::getLocalPlayer() void ClientEnvironment::step(float dtime) { - DSTACK(__FUNCTION_NAME); - /* Step time of day */ stepTimeOfDay(dtime); diff --git a/src/game.cpp b/src/game.cpp index 205c345..b3c6a30 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2065,17 +2065,6 @@ void the_game( } } - // Print debug stacks - if(input->wasKeyDown(getKeySetting("keymap_print_debug_stacks"))) - { - dstream<<"-----------------------------------------" - <<std::endl; - dstream<<DTIME<<"Printing debug stacks:"<<std::endl; - dstream<<"-----------------------------------------" - <<std::endl; - debug_stacks_print(); - } - /* Mouse and camera control NOTE: Do this before client.setPlayerControl() to not cause a camera lag of one frame diff --git a/src/guiKeyChangeMenu.cpp b/src/guiKeyChangeMenu.cpp index c660ed8..5149ec9 100644 --- a/src/guiKeyChangeMenu.cpp +++ b/src/guiKeyChangeMenu.cpp @@ -413,5 +413,4 @@ void GUIKeyChangeMenu::init_keys() this->add_key(GUI_ID_KEY_FAST_BUTTON, wgettext("Toggle fast"), "keymap_fastmove"); this->add_key(GUI_ID_KEY_NOCLIP_BUTTON, wgettext("Toggle noclip"), "keymap_noclip"); this->add_key(GUI_ID_KEY_RANGE_BUTTON, wgettext("Range select"), "keymap_rangeselect"); - this->add_key(GUI_ID_KEY_DUMP_BUTTON, wgettext("Print stacks"), "keymap_print_debug_stacks"); } diff --git a/src/inventory.cpp b/src/inventory.cpp index 2ce50e0..cbaa44a 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -126,8 +126,6 @@ static std::string deSerializeJsonStringIfNeeded(std::istream &is) void ItemStack::serialize(std::ostream &os) const { - DSTACK(__FUNCTION_NAME); - if(empty()) return; @@ -151,8 +149,6 @@ void ItemStack::serialize(std::ostream &os) const void ItemStack::deSerialize(std::istream &is, IItemDefManager *itemdef) { - DSTACK(__FUNCTION_NAME); - clear(); // Read name diff --git a/src/inventorymanager.cpp b/src/inventorymanager.cpp index 6187675..b3a04fc 100644 --- a/src/inventorymanager.cpp +++ b/src/inventorymanager.cpp @@ -763,8 +763,6 @@ void ICraftAction::clientApply(InventoryManager *mgr, IGameDef *gamedef) bool getCraftingResult(Inventory *inv, ItemStack& result, bool decrementInput, IGameDef *gamedef) { - DSTACK(__FUNCTION_NAME); - result.clear(); // Get the InventoryList in which we will operate diff --git a/src/main.cpp b/src/main.cpp index b3aa9c9..686955a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -866,10 +866,6 @@ int main(int argc, char *argv[]) infostream<<"path_share = "<<porting::path_share<<std::endl; infostream<<"path_user = "<<porting::path_user<<std::endl; - // Initialize debug stacks - debug_stacks_init(); - DSTACK(__FUNCTION_NAME); - // Debug handler BEGIN_DEBUG_EXCEPTION_HANDLER @@ -1083,7 +1079,6 @@ int main(int argc, char *argv[]) g_settings->set("server_dedicated", run_dedicated_server ? "true" : "false"); if(run_dedicated_server) { - DSTACK("Dedicated server branch"); // Create time getter if built with Irrlicht #ifndef SERVER g_timegetter = new SimpleTimeGetter(); diff --git a/src/map.cpp b/src/map.cpp index 90cd498..be73aeb 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -210,7 +210,6 @@ void Map::setNode(v3s16 p, MapNode & n) <<" while trying to replace \"" <<m_gamedef->ndef()->get(block->getNodeNoCheck(relpos)).name <<"\" at "<<PP(p)<<" (block "<<PP(blockpos)<<")"<<std::endl; - debug_stacks_print_to(infostream); return; } block->setNodeNoCheck(relpos, n); @@ -1639,7 +1638,6 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks) { INodeDefManager *nodemgr = m_gamedef->ndef(); - DSTACK(__FUNCTION_NAME); //TimeTaker timer("transformLiquids()"); u32 loopcount = 0; @@ -1998,7 +1996,6 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> & modified_blocks) INodeDefManager *nodemgr = m_gamedef->ndef(); - DSTACK(__FUNCTION_NAME); //TimeTaker timer("transformLiquids()"); u32 loopcount = 0; @@ -2834,10 +2831,6 @@ MapBlock* ServerMap::finishBlockMake(BlockMakeData *data, ServerMapSector * ServerMap::createSector(v2s16 p2d) { - DSTACKF("%s: p2d=(%d,%d)", - __FUNCTION_NAME, - p2d.X, p2d.Y); - /* Check if it exists already in memory */ @@ -2900,8 +2893,6 @@ MapBlock * ServerMap::generateBlock( 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;*/ @@ -3009,9 +3000,6 @@ MapBlock * ServerMap::generateBlock( MapBlock * ServerMap::createBlock(v3s16 p) { - DSTACKF("%s: p=(%d,%d,%d)", - __FUNCTION_NAME, p.X, p.Y, p.Z); - /* Do not create over-limit */ @@ -3073,10 +3061,6 @@ MapBlock * ServerMap::createBlock(v3s16 p) 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); if(block && block->isDummy() == false) @@ -3326,7 +3310,6 @@ v3s16 ServerMap::getBlockPos(std::string sectordir, std::string blockfile) void ServerMap::save(ModifiedState save_level) { - DSTACK(__FUNCTION_NAME); if(m_map_saving_enabled == false) { infostream<<"WARNING: Not saving map, saving disabled."<<std::endl; @@ -3482,8 +3465,6 @@ void ServerMap::listAllLoadedBlocks(std::list<v3s16> &dst) void ServerMap::saveMapMeta() { - DSTACK(__FUNCTION_NAME); - /*infostream<<"ServerMap::saveMapMeta(): " <<"seed="<<m_seed <<std::endl;*/ @@ -3511,8 +3492,6 @@ void ServerMap::saveMapMeta() void ServerMap::loadMapMeta() { - DSTACK(__FUNCTION_NAME); - /*infostream<<"ServerMap::loadMapMeta(): Loading map metadata" <<std::endl;*/ @@ -3566,7 +3545,6 @@ void ServerMap::loadMapMeta() void ServerMap::saveSectorMeta(ServerMapSector *sector) { - DSTACK(__FUNCTION_NAME); // Format used for writing u8 version = SER_FMT_VER_HIGHEST_WRITE; // Get destination @@ -3586,7 +3564,6 @@ void ServerMap::saveSectorMeta(ServerMapSector *sector) MapSector* ServerMap::loadSectorMeta(std::string sectordir, bool save_after_load) { - DSTACK(__FUNCTION_NAME); // Get destination v2s16 p2d = getSectorPos(sectordir); @@ -3627,8 +3604,6 @@ MapSector* ServerMap::loadSectorMeta(std::string sectordir, bool save_after_load bool ServerMap::loadSectorMeta(v2s16 p2d) { - DSTACK(__FUNCTION_NAME); - MapSector *sector = NULL; // The directory layout we're going to load from. @@ -3671,8 +3646,6 @@ bool ServerMap::loadSectorMeta(v2s16 p2d) #if 0 bool ServerMap::loadSectorFull(v2s16 p2d) { - DSTACK(__FUNCTION_NAME); - MapSector *sector = NULL; // The directory layout we're going to load from. @@ -3754,7 +3727,6 @@ void ServerMap::endSave() { void ServerMap::saveBlock(MapBlock *block) { - DSTACK(__FUNCTION_NAME); /* Dummy blocks are not written */ @@ -3827,8 +3799,6 @@ void ServerMap::saveBlock(MapBlock *block) void ServerMap::loadBlock(std::string sectordir, std::string blockfile, MapSector *sector, bool save_after_load) { - DSTACK(__FUNCTION_NAME); - std::string fullpath = sectordir+DIR_DELIM+blockfile; try{ @@ -3903,8 +3873,6 @@ void ServerMap::loadBlock(std::string sectordir, std::string blockfile, MapSecto void ServerMap::loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool save_after_load) { - DSTACK(__FUNCTION_NAME); - try { std::istringstream is(*blob, std::ios_base::binary); @@ -3972,8 +3940,6 @@ void ServerMap::loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool MapBlock* ServerMap::loadBlock(v3s16 blockpos) { - DSTACK(__FUNCTION_NAME); - v2s16 p2d(blockpos.X, blockpos.Z); if(!loadFromFolders()) { diff --git a/src/porting.cpp b/src/porting.cpp index 84df15b..6448c82 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -69,12 +69,6 @@ void sigint_handler(int sig) { dstream<<DTIME<<"INFO: sigint_handler(): " <<"Ctrl-C pressed, shutting down."<<std::endl; - - // Comment out for less clutter when testing scripts - /*dstream<<DTIME<<"INFO: sigint_handler(): " - <<"Printing debug stacks"<<std::endl; - debug_stacks_print();*/ - g_killed = true; } else @@ -104,11 +98,6 @@ void signal_handler_init(void) { dstream<<DTIME<<"INFO: event_handler(): " <<"Ctrl+C, Close Event, Logoff Event or Shutdown Event, shutting down."<<std::endl; - // Comment out for less clutter when testing scripts - /*dstream<<DTIME<<"INFO: event_handler(): " - <<"Printing debug stacks"<<std::endl; - debug_stacks_print();*/ - g_killed = true; } else diff --git a/src/server.cpp b/src/server.cpp index 8c67846..dfc6da3 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -66,8 +66,6 @@ void * ServerThread::Thread() log_register_thread("ServerThread"); - DSTACK(__FUNCTION_NAME); - BEGIN_DEBUG_EXCEPTION_HANDLER while(getRun()) @@ -129,8 +127,6 @@ v3f ServerSoundParams::getPos(ServerEnvironment *env, bool *pos_exists) const void RemoteClient::GetNextBlocks(Server *server, float dtime, std::vector<PrioritySortedBlockTransfer> &dest) { - DSTACK(__FUNCTION_NAME); - /*u32 timer_result; TimeTaker timer("RemoteClient::GetNextBlocks", &timer_result);*/ @@ -946,7 +942,6 @@ void PlayerInfo::PrintLine(std::ostream *s) void Server::start(unsigned short port) { - DSTACK(__FUNCTION_NAME); infostream<<"Starting server on port "<<port<<"..."<<std::endl; // Stop thread if already running @@ -975,8 +970,6 @@ void Server::start(unsigned short port) void Server::stop() { - DSTACK(__FUNCTION_NAME); - infostream<<"Server: Stopping and waiting threads"<<std::endl; // Stop threads (set run=false first so both start stopping) @@ -990,7 +983,6 @@ void Server::stop() void Server::step(float dtime) { - DSTACK(__FUNCTION_NAME); // Limit a bit if(dtime > 2.0) dtime = 2.0; @@ -1007,8 +999,6 @@ void Server::step(float dtime) void Server::AsyncRunStep() { - DSTACK(__FUNCTION_NAME); - g_profiler->add("Server::AsyncRunStep (num)", 1); float dtime; @@ -1697,7 +1687,6 @@ void Server::AsyncRunStep() void Server::Receive() { - DSTACK(__FUNCTION_NAME); SharedBuffer<u8> data; u16 peer_id; u32 datasize; @@ -1738,7 +1727,6 @@ void Server::Receive() void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) { - DSTACK(__FUNCTION_NAME); // Environment is locked first. JMutexAutoLock envlock(m_env_mutex); JMutexAutoLock conlock(m_con_mutex); @@ -3231,8 +3219,7 @@ void Server::setInventoryModified(const InventoryLocation &loc) //std::list<PlayerInfo> Server::getPlayerInfo() //{ -// DSTACK(__FUNCTION_NAME); -// JMutexAutoLock envlock(m_env_mutex); +//// JMutexAutoLock envlock(m_env_mutex); // JMutexAutoLock conlock(m_con_mutex); // // std::list<PlayerInfo> list; @@ -3273,7 +3260,6 @@ void Server::setInventoryModified(const InventoryLocation &loc) void Server::peerAdded(con::Peer *peer) { - DSTACK(__FUNCTION_NAME); verbosestream<<"Server::peerAdded(): peer->id=" <<peer->id<<std::endl; @@ -3286,7 +3272,6 @@ void Server::peerAdded(con::Peer *peer) void Server::deletingPeer(con::Peer *peer, bool timeout) { - DSTACK(__FUNCTION_NAME); verbosestream<<"Server::deletingPeer(): peer->id=" <<peer->id<<", timeout="<<timeout<<std::endl; @@ -3303,7 +3288,6 @@ void Server::deletingPeer(con::Peer *peer, bool timeout) void Server::SendMovement(con::Connection &con, u16 peer_id) { - DSTACK(__FUNCTION_NAME); std::ostringstream os(std::ios_base::binary); writeU16(os, TOCLIENT_MOVEMENT); @@ -3329,7 +3313,6 @@ void Server::SendMovement(con::Connection &con, u16 peer_id) void Server::SendHP(con::Connection &con, u16 peer_id, u8 hp) { - DSTACK(__FUNCTION_NAME); std::ostringstream os(std::ios_base::binary); writeU16(os, TOCLIENT_HP); @@ -3344,7 +3327,6 @@ void Server::SendHP(con::Connection &con, u16 peer_id, u8 hp) void Server::SendBreath(con::Connection &con, u16 peer_id, u16 breath) { - DSTACK(__FUNCTION_NAME); std::ostringstream os(std::ios_base::binary); writeU16(os, TOCLIENT_BREATH); @@ -3360,7 +3342,6 @@ void Server::SendBreath(con::Connection &con, u16 peer_id, u16 breath) void Server::SendAccessDenied(con::Connection &con, u16 peer_id, const std::wstring &reason) { - DSTACK(__FUNCTION_NAME); std::ostringstream os(std::ios_base::binary); writeU16(os, TOCLIENT_ACCESS_DENIED); @@ -3376,7 +3357,6 @@ void Server::SendAccessDenied(con::Connection &con, u16 peer_id, void Server::SendDeathscreen(con::Connection &con, u16 peer_id, bool set_camera_point_target, v3f camera_point_target) { - DSTACK(__FUNCTION_NAME); std::ostringstream os(std::ios_base::binary); writeU16(os, TOCLIENT_DEATHSCREEN); @@ -3393,7 +3373,6 @@ void Server::SendDeathscreen(con::Connection &con, u16 peer_id, void Server::SendItemDef(con::Connection &con, u16 peer_id, IItemDefManager *itemdef, u16 protocol_version) { - DSTACK(__FUNCTION_NAME); std::ostringstream os(std::ios_base::binary); /* @@ -3420,7 +3399,6 @@ void Server::SendItemDef(con::Connection &con, u16 peer_id, void Server::SendNodeDef(con::Connection &con, u16 peer_id, INodeDefManager *nodedef, u16 protocol_version) { - DSTACK(__FUNCTION_NAME); std::ostringstream os(std::ios_base::binary); /* @@ -3450,8 +3428,6 @@ void Server::SendNodeDef(con::Connection &con, u16 peer_id, void Server::SendInventory(u16 peer_id) { - DSTACK(__FUNCTION_NAME); - PlayerSAO *playersao = getPlayerSAO(peer_id); assert(playersao); @@ -3476,8 +3452,6 @@ void Server::SendInventory(u16 peer_id) void Server::SendChatMessage(u16 peer_id, const std::wstring &message) { - DSTACK(__FUNCTION_NAME); - std::ostringstream os(std::ios_base::binary); u8 buf[12]; @@ -3507,8 +3481,6 @@ void Server::SendChatMessage(u16 peer_id, const std::wstring &message) void Server::SendShowFormspecMessage(u16 peer_id, const std::string formspec, const std::string formname) { - DSTACK(__FUNCTION_NAME); - std::ostringstream os(std::ios_base::binary); u8 buf[12]; @@ -3530,8 +3502,6 @@ void Server::SendSpawnParticle(u16 peer_id, v3f pos, v3f velocity, v3f accelerat float expirationtime, float size, bool collisiondetection, std::string texture) { - DSTACK(__FUNCTION_NAME); - std::ostringstream os(std::ios_base::binary); writeU16(os, TOCLIENT_SPAWN_PARTICLE); writeV3F1000(os, pos); @@ -3574,8 +3544,6 @@ void Server::SendAddParticleSpawner(u16 peer_id, u16 amount, float spawntime, v3 v3f minvel, v3f maxvel, v3f minacc, v3f maxacc, float minexptime, float maxexptime, float minsize, float maxsize, bool collisiondetection, std::string texture, u32 id) { - DSTACK(__FUNCTION_NAME); - std::ostringstream os(std::ios_base::binary); writeU16(os, TOCLIENT_ADD_PARTICLESPAWNER); @@ -3625,8 +3593,6 @@ void Server::SendAddParticleSpawnerAll(u16 amount, float spawntime, v3f minpos, void Server::SendDeleteParticleSpawner(u16 peer_id, u32 id) { - DSTACK(__FUNCTION_NAME); - std::ostringstream os(std::ios_base::binary); writeU16(os, TOCLIENT_DELETE_PARTICLESPAWNER); @@ -3779,7 +3745,6 @@ void Server::BroadcastChatMessage(const std::wstring &message) void Server::SendPlayerHP(u16 peer_id) { - DSTACK(__FUNCTION_NAME); PlayerSAO *playersao = getPlayerSAO(peer_id); assert(playersao); playersao->m_hp_not_sent = false; @@ -3788,7 +3753,6 @@ void Server::SendPlayerHP(u16 peer_id) void Server::SendPlayerBreath(u16 peer_id) { - DSTACK(__FUNCTION_NAME); PlayerSAO *playersao = getPlayerSAO(peer_id); assert(playersao); playersao->m_breath_not_sent = false; @@ -3797,7 +3761,6 @@ void Server::SendPlayerBreath(u16 peer_id) void Server::SendMovePlayer(u16 peer_id) { - DSTACK(__FUNCTION_NAME); Player *player = m_env->getPlayer(peer_id); assert(player); @@ -4081,8 +4044,6 @@ void Server::setBlockNotSent(v3s16 p) void Server::SendBlockNoLock(u16 peer_id, MapBlock *block, u8 ver, u16 net_proto_version) { - DSTACK(__FUNCTION_NAME); - v3s16 p = block->getPos(); #if 0 @@ -4135,8 +4096,6 @@ void Server::SendBlockNoLock(u16 peer_id, MapBlock *block, u8 ver, u16 net_proto void Server::SendBlocks(float dtime) { - DSTACK(__FUNCTION_NAME); - JMutexAutoLock envlock(m_env_mutex); JMutexAutoLock conlock(m_con_mutex); @@ -4206,8 +4165,6 @@ void Server::SendBlocks(float dtime) void Server::fillMediaCache() { - DSTACK(__FUNCTION_NAME); - infostream<<"Server: Calculating media file checksums"<<std::endl; // Collect all media file paths @@ -4315,8 +4272,6 @@ struct SendableMediaAnnouncement void Server::sendMediaAnnouncement(u16 peer_id) { - DSTACK(__FUNCTION_NAME); - verbosestream<<"Server: Announcing files to id("<<peer_id<<")" <<std::endl; @@ -4379,8 +4334,6 @@ struct SendableMedia void Server::sendRequestedMedia(u16 peer_id, const std::list<MediaRequest> &tosend) { - DSTACK(__FUNCTION_NAME); - verbosestream<<"Server::sendRequestedMedia(): " <<"Sending files to client"<<std::endl; @@ -4513,8 +4466,6 @@ void Server::sendDetachedInventory(const std::string &name, u16 peer_id) void Server::sendDetachedInventoryToAll(const std::string &name) { - DSTACK(__FUNCTION_NAME); - for(std::map<u16, RemoteClient*>::iterator i = m_clients.begin(); i != m_clients.end(); ++i){ @@ -4525,8 +4476,6 @@ void Server::sendDetachedInventoryToAll(const std::string &name) void Server::sendDetachedInventories(u16 peer_id) { - DSTACK(__FUNCTION_NAME); - for(std::map<std::string, Inventory*>::iterator i = m_detached_inventories.begin(); i != m_detached_inventories.end(); i++){ @@ -4542,8 +4491,6 @@ void Server::sendDetachedInventories(u16 peer_id) void Server::DiePlayer(u16 peer_id) { - DSTACK(__FUNCTION_NAME); - PlayerSAO *playersao = getPlayerSAO(peer_id); assert(playersao); @@ -4562,8 +4509,6 @@ void Server::DiePlayer(u16 peer_id) void Server::RespawnPlayer(u16 peer_id) { - DSTACK(__FUNCTION_NAME); - PlayerSAO *playersao = getPlayerSAO(peer_id); assert(playersao); @@ -4582,8 +4527,6 @@ void Server::RespawnPlayer(u16 peer_id) void Server::UpdateCrafting(u16 peer_id) { - DSTACK(__FUNCTION_NAME); - Player* player = m_env->getPlayer(peer_id); assert(player); @@ -4600,7 +4543,6 @@ void Server::UpdateCrafting(u16 peer_id) RemoteClient* Server::getClient(u16 peer_id) { - DSTACK(__FUNCTION_NAME); //JMutexAutoLock lock(m_con_mutex); std::map<u16, RemoteClient*>::iterator n; n = m_clients.find(peer_id); @@ -5340,8 +5282,6 @@ void Server::handlePeerChanges() void dedicated_server_loop(Server &server, bool &kill) { - DSTACK(__FUNCTION_NAME); - verbosestream<<"dedicated_server_loop()"<<std::endl; IntervalLimiter m_profiler_interval; diff --git a/src/test.cpp b/src/test.cpp index fa7a824..5daae50 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -1633,8 +1633,6 @@ struct TestConnection: public TestBase void Run() { - DSTACK("TestConnection::Run"); - TestHelpers(); /* @@ -1980,8 +1978,6 @@ struct TestConnection: public TestBase void run_tests() { - DSTACK(__FUNCTION_NAME); - int tests_run = 0; int tests_failed = 0; -- 1.7.12 |