lynx-dev
[Top][All Lists]
Advanced

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

Re: lynx-dev 2.8.1dev.12 with slang seg faults


From: Bela Lubkin
Subject: Re: lynx-dev 2.8.1dev.12 with slang seg faults
Date: Tue, 2 Jun 1998 22:26:43 -0700

Michael Warner wrote:

> Program received signal SIGSEGV, Segmentation fault.
> warning: Hit beginning of text section without finding
> warning: enclosing function for address 0x200dda30
> This warning occurs if you are debugging a function without
> any symbols
> (for example, in a stripped executable).  In that case, you
> may wish to
> increase the size of the search with the `set
> heuristic-fence-post' command.
> 
> Otherwise, you told GDB there was a function where there
> isn't one, or
> (more likely) you have encountered a bug in GDB.
> 0x200dda30 in ?? ()
> 
> (gdb) bt
> #0  0x200dda30 in ?? ()
> #1  0x1200de65c in SLang_do_key (kml=0x1400b0688, getkey=0x200dda30)
>     at /tmp/warner/slang/src/slkeymap.c:352
> #2  0x1200de65c in SLang_do_key (kml=Error accessing
>     memory address 0x18: Invalid argument.
>     ) at /tmp/warner/slang/src/slkeymap.c:352
>     Error accessing memory address 0x40: Invalid argument.

The instruction addresses of stack frames #1 and #2 are 1200xxxxx, while
the fault address is 200xxxxx.  The faulting instruction was:

> That section of slkeymap.c is:
> 
> 
> SLang_Key_Type *SLang_do_key(SLKeyMap_List_Type *kml, int (*getkey)(void))
> {
>    register SLang_Key_Type *key, *next, *kmax;
>    unsigned int len;
>    unsigned char input_ch;
>    register unsigned char chup, chlow;
>    unsigned char key_ch = 0;
> 
>    SLang_Last_Key_Char = (*getkey)();   /*** LINE 352 ***/

getkey is a passed-in function pointer.  I'm not sure who's passing it
in (another part of SLang, or directly from Lynx).  In any case, the
code addresses in your binary are larger than will fit in 32 bits, while
the fault address is exactly like one of those addresses stripped of its
higher bits.  It looks like the caller of SLang_do_key() is passing in a
32-bit int.

Ah -- in fact, I think I see the problem.  In LYStrings.c, find the code
that reads:

  #ifdef USE_SLANG
  #ifdef VMS
  #define GetChar() ttgetc()
  #else
  #ifdef __DJGPP__
  #define GetChar SLkp_getkey
  #else
  #define GetChar (int)SLang_getkey             <--------------
  #endif /* __DJGPP__ */
  #endif /* VMS */
  #endif /* USE_SLANG */

Get rid of "(int)".  You're on an Alpha processor, where "int" is 32
bits, but pointers are 64.  That GetChar macro is used later in the
SLang version of LYgetch():

  int LYgetch (void)
  {
     SLang_Key_Type *key;
     int keysym;

     key = SLang_do_key (Keymap_List, (int (*)(void)) GetChar);
                                                      ^^^^^^^
Here you're passing the low 32 bits of the address of SLang_getkey.
When SLang_do_key() tries to call it, it follows the bad pointer and
crashes.

>Bela<

reply via email to

[Prev in Thread] Current Thread [Next in Thread]