On Wed, 3 Feb 1999, Alejandro Aguilar Sierra wrote:
> On Wed, 3 Feb 1999, Bob McElrath wrote:
>
> > Hmmm...likely an alpha-specific problem then. I'm using egcs 1.1.1 on an
> > alpha LX164, 533MHz (compiled lyx myself...not from RPM or deb). Know of
> > anywhere in your math code <off the top of your head> that you assume
> > sizeof(long) == sizeof(int) == sizeof(void*)? Because it isn't on
> > alpha...longs and pointers are 64 bit.
>
> The problem is after retriving an inset from the array:
>
> MathedInset* px = GetInset();
>
> In GetInset we do:
>
> MathedInset* p;
> memcpy(&p, &array->bf[pos+1], sizeof(p));
>
> and in the function to insert insets we do (same type of p) :
>
> memcpy(&array->bf[pos+1], &p, sizeof(p));
>
> so it's consistent, hmm.. have you used LyX in your platform without these
> problems before?
Yes. 0.12 works fine. All of the pre-releases after that have problems,
but I've never investigated...waiting for 1.0. :)
I've played with gdb and lyx for a while, and have narrowed it down to the
"MathedXIter *cursor" member variable of the MathedCursor class. This
pointer isn't initialized properly. The reason it crashes is that
cursor->Next() gets called when this=0x2 (cursor=0x2, that is). cursor is
non-NULL, but still invalid, causing a seg fault when the Width() method
attempts to access data at that address.
I inserted initialization (to null) in the MathedCursor::MathedCursor
constructor, and created a default constructor for MathedCursor (that never
got called...but you guys probably know that) just in case. Neither of
these fixed the problem. I can't find who is clobbering or improperly
initializing the cursor pointer since *so* many functions use it...
I think it just happens to work on Intel, probably due to a fortuitous
memory alignment where "cursor" starts out as NULL.
It's interesting to note that I can type (including using bold) normally in
math mode. But any attempt to insert a new piece of math kills it. I can
type '\', but the first character that follows crashes it. HOWEVER, when I
break on calls to MathedXIter::Next, I see the following behaviour:
>>>>>>>>> I type 'a'
Breakpoint 2, MathedXIter::Next (this=0x2) at math_iter.C:575
575 {
Current language: auto; currently c++
(gdb) c
Continuing.
>>>>>>>>> I type 'b'
Breakpoint 2, MathedXIter::Next (this=0x3) at math_iter.C:575
575 {
(gdb) c
Continuing.
Breakpoint 2, MathedXIter::Next (this=0x3) at math_iter.C:575
575 {
(gdb)
Continuing.
>>>>>>>>> I type 'c'
Breakpoint 2, MathedXIter::Next (this=0x4) at math_iter.C:575
575 {
(gdb)
Continuing.
Breakpoint 2, MathedXIter::Next (this=0x4) at math_iter.C:575
575 {
(gdb)
Continuing.
Breakpoint 2, MathedXIter::Next (this=0x4) at math_iter.C:575
575 {
(gdb)
Continuing.
>>>>>>>>> I type 'd'
Breakpoint 2, MathedXIter::Next (this=0x5) at math_iter.C:575
575 {
(gdb)
Continuing.
Breakpoint 2, MathedXIter::Next (this=0x5) at math_iter.C:575
575 {
(gdb)
Continuing.
Breakpoint 2, MathedXIter::Next (this=0x5) at math_iter.C:575
575 {
(gdb)
Continuing.
Breakpoint 2, MathedXIter::Next (this=0x5) at math_iter.C:575
575 {
(gdb)
Continuing.
etc...
[[All these "this" pointers are obviously wrong, and gdb will not let me
dereference them...]]
-- Bob
Bob McElrath ([EMAIL PROTECTED]) Univ. of Wisconsin at Madison