lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Jul 28, 2004 at 08:01:03AM -0700, Stoil Todorov wrote:
> --- Jamie Webb <j@jmawebb.cjb.net> wrote:
> > On Wed, Jul 28, 2004 at 04:54:35AM -0700, Stoil
> > Todorov wrote:
> > > Hallo, guys!
> > > I have problem and I don't know why my program
> > crash
> > > in luaS_newlstr. It appears when I read Lua
> > variables
> > > from C.
> > > o = G(L)->strt.hash[lmod(h, G(L)->strt.size)]
> > > o is not valid pointer...
> > > Have anybody idea where can be the problem?
> > 
> > That's a very strange place for a crash. It suggests
> > that the string
> > table has been currupted somehow. You're sure the
> > crash didn't happen
> > on the line before? You're probably going to have to
> > post a minimal
> > program which reproduces it.
> yes, in this moment
> h = 153
> G(L)->strt.size = 512
> G(L)->strt.nuse = 315

Then I suppose the next step it to have a look at what's at that
table index, specifically:

- Does L->l_G->strt.hash point somewhere sensible?

- What is the contents of L->l_G->strt.hash[153].ts.tsv ?

- What is the associated string,
  (char*)(L->l_G->strt.hash[153])+sizeof(TString) ?

- Is it the variable name you are after? If not, does following the
  next pointers lead you to this string?

Doing all this stuff though can at best tell you what's happened, not
how it happened. You'll probably find that trying to track the
progress of the VM before the crash is virtually impossible. Making a
minimal example is likely to be more helpful, and the process of doing
so could well lead you to the bug.

-- Jamie Webb