On Thu, Aug 22, 2002 at 01:03:08PM -0400, Josh Harris wrote: >is what I get when I do frame 2 then list > > 0x0807bd23 in fread_string (fl=0x80e74c8, error=0x80da360 "room #0") at >db.c:2271 >2271 CREATE(rslt, char, length + 2); >(gdb) l >2266 } >2267 } while (!done); >2268 >2269 /* allocate space for the new string and copy it */ >2270 if (strlen(buf) > 0) { >2271 CREATE(rslt, char, length + 2); >2272 strcpy(rslt, buf); >2273 } else >2274 rslt = NULL; >2275 > >no it's not stock code. I've changed db.c, and others a lot. I was >running the mud on my home computer (Win98 system w/ cygwin) and it >compiled and ran. Then I got a webserver(Linux) and uploaded it there. > Well, let's see. <gdb lesson> after you did "frame 2", I'd say to try: p rslt p length </gdb lesson> Make sure those are both initialized and sane values. rslt is defined as "char *result = NULL;" right? length is calculated properly somewhere above this (iow, it's not holding some random bit of garbage with a value of like 103949324 or whatever) >Thanks for your help np, but you really should read some of the docs on gdb. It's your best friend. Most installations you can use "info gdb" from a shell and get lots of detail about it. Also, gdb has lots of built-in help. BTW, why bother with CREATE() then strcpy rather than just rslt=buf?strdup(buf):NULL; (assuming you have buf declared as char *buf=NULL) or if you're using the stock "char buf[MSL];" rslt=strlen(buf)?strdup(buf):NULL; (unless you're doing something you specifically need the 2 extra chars for) -me -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT