Welcome to the Builder Academy

Question May i ask a question concerning circlemud 3.1 and dg script patch?

More
22 Oct 2021 13:01 #9960 by Errigour
First of all i hope this isn't a out of line question on this forum but i don't know where else to ask. Please feel free to delete this topic if so. Ok the question is, I just installed dg scripts on a fresh circlemud 3.1 and have been programming it some here and there and i came across a problem with adding a char *string; to the room_data structure. after i add that when i reboot the mud valgrind says this code is crashing the program. I was hoping someone could point me in the right direction concerning how to add to room_data stucture without the mud crashing maybe tell me where to look for the problem if anyone knows. also if you guys have any pointers about how to trouble shoot these problems with ubuntu linux better please i am all ears on learning.
Code:
[/i] if (!SCRIPT_CHECK(ch, MTRIG_GREET | MTRIG_GREET_ALL) ||         !AWAKE(ch) || FIGHTING(ch) || (ch == actor) ||         AFF_FLAGGED(ch, AFF_CHARM))       continue;
Here's some valgrind output
Code:
==9054== Invalid read of size 8 ==9054==    at 0x1ABA90: greet_mtrigger (dg_triggers.c:241) ==9054==    by 0x129DAC: do_simple_move (act.movement.c:194) ==9054==    by 0x165812: mobile_activity (mobact.c:96) ==9054==    by 0x146CED: heartbeat (comm.c:897) ==9054==    by 0x14A681: game_loop (comm.c:857) ==9054==    by 0x14A9AA: init_game (comm.c:427) ==9054==    by 0x115F31: main (comm.c:362) ==9054==  Address 0x4d23680 is 32 bytes before a block of size 144 in arena "client" ==9054== ==9054== Invalid read of size 1 ==9054==    at 0x1ABA9C: greet_mtrigger (dg_triggers.c:241) ==9054==    by 0x129DAC: do_simple_move (act.movement.c:194) ==9054==    by 0x165812: mobile_activity (mobact.c:96) ==9054==    by 0x146CED: heartbeat (comm.c:897) ==9054==    by 0x14A681: game_loop (comm.c:857) ==9054==    by 0x14A9AA: init_game (comm.c:427) ==9054==    by 0x115F31: main (comm.c:362) ==9054==  Address 0xd0 is not stack'd, malloc'd or (recently) free'd ==9054== ==9054== ==9054== Process terminating with default action of signal 11 (SIGSEGV) ==9054==  Access not within mapped region at address 0xD0 ==9054==    at 0x1ABA9C: greet_mtrigger (dg_triggers.c:241) ==9054==    by 0x129DAC: do_simple_move (act.movement.c:194) ==9054==    by 0x165812: mobile_activity (mobact.c:96) ==9054==    by 0x146CED: heartbeat (comm.c:897) ==9054==    by 0x14A681: game_loop (comm.c:857) ==9054==    by 0x14A9AA: init_game (comm.c:427) ==9054==    by 0x115F31: main (comm.c:362) ==9054==  If you believe this happened as a result of a stack ==9054==  overflow in your program's main thread (unlikely but ==9054==  possible), you can try to increase the size of the ==9054==  main thread stack using the --main-stacksize= flag. ==9054==  The main thread stack size used in this run was 8388608. ==9054== ==9054== HEAP SUMMARY: ==9054==     in use at exit: 3,037,791 bytes in 30,507 blocks ==9054==   total heap usage: 33,315 allocs, 2,808 frees, 4,458,974 bytes allocated ==9054== ==9054== 4 bytes in 1 blocks are definitely lost in loss record 3 of 128 ==9054==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==9054==    by 0x493850E: strdup (strdup.c:42) ==9054==    by 0x14C844: load_help (db.c:1977) ==9054==    by 0x152EA8: index_boot (db.c:933) ==9054==    by 0x153BE4: boot_db (db.c:530) ==9054==    by 0x14A976: init_game (comm.c:415) ==9054==    by 0x115F31: main (comm.c:362) ==9054== ==9054== LEAK SUMMARY: ==9054==    definitely lost: 4 bytes in 1 blocks ==9054==    indirectly lost: 0 bytes in 0 blocks ==9054==      possibly lost: 0 bytes in 0 blocks ==9054==    still reachable: 3,037,787 bytes in 30,506 blocks ==9054==         suppressed: 0 bytes in 0 blocks ==9054== Reachable blocks (those to which a pointer was found) are not shown. ==9054== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==9054== ==9054== For lists of detected and suppressed errors, rerun with: -s ==9054== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0) Segmentation fault (core dumped)

Please Log in or Create an account to join the conversation.

More
23 Oct 2021 01:47 #9962 by Shaoden
Rumble or Fizban, yall C programmers, got a clue?

Please Log in or Create an account to join the conversation.

More
23 Oct 2021 06:14 #9963 by Errigour
Valgrind output after wait function used.
Code:
Oct 23 02:01:18 :: New connection. Waking up. Oct 23 02:01:22 :: Errigour [localhost] has connected. Oct 23 02:01:23 :: Errigour retrieving crash-saved items and entering game. Oct 23 02:01:23 :: Errigour (level 104) has 2 objects (max 100). Oct 23 02:01:23 :: Errigour had no variable file ==15902== Syscall param wait4(status) points to unaddressable byte(s) ==15902== at 0x497BDBA: wait4 (wait4.c:27) ==15902== by 0x1ABA3B: greet_mtrigger (dg_triggers.c:241) ==15902== by 0x1602C0: nanny (interpreter.c:1617) ==15902== by 0x14A74A: game_loop (comm.c:800) ==15902== by 0x14A9DA: init_game (comm.c:427) ==15902== by 0x115F51: main (comm.c:362) ==15902== Address 0x1 is not stack'd, malloc'd or (recently) free'd ==15902== ==15902== Syscall param wait4(status) points to unaddressable byte(s) ==15902== at 0x497BDBA: wait4 (wait4.c:27) ==15902== by 0x1ABA3B: greet_mtrigger (dg_triggers.c:241) ==15902== by 0x129DCC: do_simple_move (act.movement.c:194) ==15902== by 0x1657A2: mobile_activity (mobact.c:96) ==15902== by 0x146D1D: heartbeat (comm.c:897) ==15902== by 0x14A6B1: game_loop (comm.c:857) ==15902== by 0x14A9DA: init_game (comm.c:427) ==15902== by 0x115F51: main (comm.c:362) ==15902== Address 0x1 is not stack'd, malloc'd or (recently) free'd ==15902== ==15902== Invalid read of size 1 ==15902== at 0x1A0A06: script_trigger_check (dg_scripts.c:662) ==15902== by 0x146D2C: heartbeat (comm.c:888) ==15902== by 0x14A6B1: game_loop (comm.c:857) ==15902== by 0x14A9DA: init_game (comm.c:427) ==15902== by 0x115F51: main (comm.c:362) ==15902== Address 0x208 is not stack'd, malloc'd or (recently) free'd ==15902== ==15902== ==15902== Process terminating with default action of signal 11 (SIGSEGV) ==15902== Access not within mapped region at address 0x208 ==15902== at 0x1A0A06: script_trigger_check (dg_scripts.c:662) ==15902== by 0x146D2C: heartbeat (comm.c:888) ==15902== by 0x14A6B1: game_loop (comm.c:857) ==15902== by 0x14A9DA: init_game (comm.c:427) ==15902== by 0x115F51: main (comm.c:362) ==15902== If you believe this happened as a result of a stack ==15902== overflow in your program's main thread (unlikely but ==15902== possible), you can try to increase the size of the ==15902== main thread stack using the --main-stacksize= flag. ==15902== The main thread stack size used in this run was 8388608. ==15902== Syscall param write(buf) points to uninitialised byte(s) ==15902== at 0x49A71E7: write (write.c:26) ==15902== by 0x492800C: _IO_file_write@@GLIBC_2.2.5 (fileops.c:1181) ==15902== by 0x4929AD0: new_do_write (fileops.c:449) ==15902== by 0x4929AD0: _IO_new_do_write (fileops.c:426) ==15902== by 0x4929AD0: _IO_do_write@@GLIBC_2.2.5 (fileops.c:423) ==15902== by 0x492BCB1: _IO_flush_all_lockp (genops.c:706) ==15902== by 0x492BF08: _IO_cleanup (genops.c:866) ==15902== by 0x4A31A8B: __libc_freeres (in /usr/lib/x86_64-linux-gnu/libc-2.31.so) ==15902== by 0x48311C6: _vgnU_freeres (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_core-amd64-linux.so) ==15902== by 0x81: ??? ==15902== by 0xFFFFFFFE: ??? ==15902== by 0x1FFEFFFB3F: ??? ==15902== by 0x146D2C: heartbeat (comm.c:888) ==15902== by 0x14A6B1: game_loop (comm.c:857) ==15902== Address 0x4f27ff9 is 9 bytes inside a block of size 4,096 alloc'd ==15902== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==15902== by 0x491AE83: _IO_file_doallocate (filedoalloc.c:101) ==15902== by 0x492B04F: _IO_doallocbuf (genops.c:347) ==15902== by 0x4927B14: _IO_file_seekoff@@GLIBC_2.2.5 (fileops.c:938) ==15902== by 0x49244FC: fseek (fseek.c:36) ==15902== by 0x14AFF5: build_player_index (db.c:704) ==15902== by 0x153B9A: boot_db (db.c:536) ==15902== by 0x14A9A6: init_game (comm.c:415) ==15902== by 0x115F51: main (comm.c:362)

Please Log in or Create an account to join the conversation.

More
23 Oct 2021 07:14 #9964 by Errigour
I posted the source here if anyone wants to see what im talking about. it compiles and doesnt segmentation fault if you remove the offending line char *map; from the structure room_data in structs.h.

ufile.io/uze9oo9a

Please Log in or Create an account to join the conversation.

More
23 Oct 2021 23:50 #9965 by Errigour
Ok oddly i put printf in the function script_trigger_check and compiled ran it and then deleted printf from that function and compiled and ran it and now its not segmentation faulting anymore. idk what happened.

Please Log in or Create an account to join the conversation.

Time to create page: 0.941 seconds