Pages:<< prev 1 next >>
#1 Apr 1, 2018 8:11 am
Last edited Apr 1, 2018 8:12 am by Vladaar
Apprentice
GroupMembers
Posts57
JoinedNov 24, 2016
Anyone have any luck with getting copyover not to crash with the snippet using his copyoverget copyoverset functions?
I am saving mudclient to playerfile now, I suppose I could take out the ability for MSDP with copyover. Using old copyover code doesn't crash, but I am at least getting a core it so worth giving it a go, to do it as he intended.
For some reason, it seems the d->pProtocol optimizes out.
If anyone wants to help with debugging I'd appreciate it. Thanks!
I am saving mudclient to playerfile now, I suppose I could take out the ability for MSDP with copyover. Using old copyover code doesn't crash, but I am at least getting a core it so worth giving it a go, to do it as he intended.
#0 0x00000000004a22c9 in write_to_buffer (d=d@entry=0x3b44e20, txt=0x8ec720"\033[0;34m",
length=length@entry=0) at comm.c:1979
1979 if ( d->pProtocol->WriteOOB > 0 )
(gdb) bt
#0 0x00000000004a22c9 in write_to_buffer (d=d@entry=0x3b44e20, txt=0x8ec720"\033[0;34m",
length=length@entry=0) at comm.c:1979
#1 0x0000000000498da0 in send_to_desc (txt=, d=0x3b44e20) at color.c:1577
#2 0x0000000000498dd7 in send_to_char (txt=, ch=ch@entry=0x3b42920) at color.c:1593
#3 0x0000000000498e12 in set_char_color (AType=AType@entry=44, ch=ch@entry=0x3b42920) at color.c:1490
#4 0x00000000004a3fb5 in act (AType=AType@entry=44, format=format@entry=0x63ff00 "A puff of ethereal smoke dissipates around you!",
ch=0x3b42920, arg1=arg1@entry=0x0, arg2=arg2@entry=0x0, type=type@entry=3) at comm.c:2884
#5 0x00000000004a95ab in copyover_recover () at copyover.c:385
#6 0x00000000004a7e27 in main (argc=, argv= ) at comm.c:812
(gdb) frame 0
#0 0x00000000004a22c9 in write_to_buffer (d=d@entry=0x3b44e20, txt=0x8ec720"\033[0;34m",
length=length@entry=0) at comm.c:1979
1979 if ( d->pProtocol->WriteOOB > 0 )
(gdb) list
1974 return;
1975
1976
1977 txt = ProtocolOutput( d, txt, &length );
1978
1979 if ( d->pProtocol->WriteOOB > 0 )
1980 --d->pProtocol->WriteOOB;
1981
1982
1983 /*
(gdb)
(gdb) print txt
$1 = 0x8ec720"\033[0;34m"
(gdb) print &length
$2 = (size_t *) 0x7ffe16ef0ce8
(gdb) print d->pProtocol
$3 = (protocol_t *) 0x0
(gdb) print d
$4 = (DESCRIPTOR_DATA *) 0x3b44e20
(gdb) print d->pProtocol->WriteOOB
Cannot access memory at address 0x0
(gdb)
For some reason, it seems the d->pProtocol optimizes out.
If anyone wants to help with debugging I'd appreciate it. Thanks!
#2 Apr 1, 2018 9:53 am
Last edited Apr 1, 2018 9:53 am by joeyfogas
Apprentice
GroupMembers
Posts78
JoinedAug 28, 2016
never been good with gdb
#3 Apr 1, 2018 2:32 pm
Last edited Apr 1, 2018 2:40 pm by Vladaar
Apprentice
GroupMembers
Posts57
JoinedNov 24, 2016
hrm, maybe it's because d->character is not const but pProtocol->apDescriptor is const?
There is definitely a issue in write_to_buffer or ProtocolOutput maybe more likely as it totally looses d at
txt = ProtocolOutput( d, txt, &length );
if ( d->pProtocol->WriteOOB > 0 )
--d->pProtocol->WriteOOB;
Which my write_to_buffer looks like
ProtocolOutput looks like
There is definitely a issue in write_to_buffer or ProtocolOutput maybe more likely as it totally looses d at
txt = ProtocolOutput( d, txt, &length );
if ( d->pProtocol->WriteOOB > 0 )
--d->pProtocol->WriteOOB;
Which my write_to_buffer looks like
void write_to_buffer( DESCRIPTOR_DATA * d, const char *txt, size_t length ) { if( !d ) { bug( "Write_to_buffer: NULL descriptor" ); return; } /* * Normally a bug... but can happen if loadup is used. */ if( !d->outbuf ) return; txt = ProtocolOutput( d, txt, &length ); if ( d->pProtocol->WriteOOB > 0 ) --d->pProtocol->WriteOOB; /* * Find length in case caller didn't. */ if( length <= 0 ) length = strlen( txt );
ProtocolOutput looks like
const char *ProtocolOutput( descriptor_t *apDescriptor, const char *apData, size_t *apLength ) { static char Result[MAX_OUTPUT_BUFFER+1]; const char Tab[] = "\t"; const char MSP[] = "!!"; const char MXPStart[] = "\033[1z<"; const char MXPStop[] = ">\033[7z"; const char LinkStart[] = "\033[1z<send>\033[7z"; const char LinkStop[] = "\033[1z</send>\033[7z"; bool_t bTerminate = false, bUseMXP = false, bUseMSP = false; #ifdef COLOUR_CHAR bool_t bColourOn = COLOUR_ON_BY_DEFAULT; #endif /* COLOUR_CHAR */ int i = 0; /* Index values */ size_t j = 0; protocol_t *pProtocol = apDescriptor ? apDescriptor->pProtocol : NULL; if ( pProtocol == NULL || apData == NULL ) return apData; /* Strip !!SOUND() triggers if they support MSP or are using sound */ /* if ( pProtocol->bMSP || pProtocol->pVariables[eMSDP_SOUND]->ValueInt ) bUseMSP = true; */ for ( ; i < MAX_OUTPUT_BUFFER && apData[j] != '\0' && !bTerminate && (*apLength <= 0 || j < *apLength); ++j ) { if ( apData[j] == '\t' ) { const char *pCopyFrom = NULL; switch ( apData[++j] ) { case '\t': /* Two tabs in a row will display an actual tab */ pCopyFrom = Tab; break;
#4 Apr 2, 2018 7:18 am
Apprentice
GroupMembers
Posts57
JoinedNov 24, 2016
It's definitely protocoloutput it's loosing descriptor in.
#5 Apr 2, 2018 4:33 pm
Apprentice
GroupMembers
Posts57
JoinedNov 24, 2016
Leia gave me answer I was looking for.
Needed to add d->pProtocol = ProtocolCreate( ); to copyover_recover so that the descriptor would persist.
Needed to add d->pProtocol = ProtocolCreate( ); to copyover_recover so that the descriptor would persist.
#7 Apr 3, 2018 10:14 pm
Geomancer
GroupAdministrators
Posts1,992
JoinedJul 26, 2005
glad you got it working man
Pages:<< prev 1 next >>