testsuite/2033: sigbpt.exp fails on Solaris10 and Solaris9 (possibly others)

Steve Williams steve.williams@utstar.com
Wed Jan 4 01:28:00 GMT 2006


The following reply was made to PR testsuite/2033; it has been noted by GNATS.

From: "Steve Williams" <steve.williams@utstar.com>
To: <gdb-gnats@sources.redhat.com>
Cc:  
Subject: Re: testsuite/2033: sigbpt.exp fails on Solaris10 and Solaris9 (possibly others)
Date: Tue, 3 Jan 2006 17:27:04 -0800

 This is a multi-part message in MIME format.
 
 ------=_NextPart_000_0024_01C6108A.F7706F70
 Content-Type: text/plain;
 	charset="us-ascii"
 Content-Transfer-Encoding: 7bit
 
 
 
 Patch to detect the complete Solaris signal trampoline.
 
 The patch uses the procfs to retrieve any old user contexts, if one is
 present, i.e. pr_oldcontext is not zero, the stack is searched for a
 matching ucontext structure. If one is found and all called functions are in
 libc, then the current frame is in the signal trampoline.
 
 The old mechanism for detecting signal trampolines has also been retained
 for corefiles and any executables that are linked against the static libc.
 
 This patch, combined with the previous patches fixes the following tests:
 
 Running ../.././gdb/testsuite/gdb.base/maint.exp ...
 FAIL: gdb.base/maint.exp: maint print psymbols
 FAIL: gdb.base/maint.exp: maint print msymbols
 FAIL: gdb.base/maint.exp: maint print symbols
 
 Running ../.././gdb/testsuite/gdb.base/sigbpt.exp ...
 FAIL: gdb.base/sigbpt.exp: stepi; stepi out of handler
 FAIL: gdb.base/sigbpt.exp: stepi bp before segv; stepi out of handler
 FAIL: gdb.base/sigbpt.exp: stepi bp at segv; stepi out of handler
 FAIL: gdb.base/sigbpt.exp: stepi bp before and at segv; stepi out of handler
 
 Running ../.././gdb/testsuite/gdb.base/siginfo.exp ...
 FAIL: gdb.base/siginfo.exp: step out of handler
 
 Running ../.././gdb/testsuite/gdb.base/sigstep.exp ...
 FAIL: gdb.base/sigstep.exp: step from handler; leave handler
 FAIL: gdb.base/sigstep.exp: stepi from handleri; leave signal trampoline
 FAIL: gdb.base/sigstep.exp: next from handler; leave handler
 FAIL: gdb.base/sigstep.exp: nexti from handleri; leave signal trampoline
 FAIL: gdb.base/sigstep.exp: step to handler; performing step (timeout)
 FAIL: gdb.base/sigstep.exp: step to handler; clear handler (timeout)
 FAIL: gdb.base/sigstep.exp: next to handler; resync (timeout)
 FAIL: gdb.base/sigstep.exp: next to handler; advance to infinite loop
 (timeout)
 FAIL: gdb.base/sigstep.exp: next to handler; break handler (timeout)
 FAIL: gdb.base/sigstep.exp: next to handler; performing next (timeout)
 FAIL: gdb.base/sigstep.exp: next to handler; clear handler (timeout)
 FAIL: gdb.base/sigstep.exp: continue to handler; resync (timeout)
 FAIL: gdb.base/sigstep.exp: continue to handler; advance to infinite loop
 (timeo
 ut)
 FAIL: gdb.base/sigstep.exp: continue to handler; break handler (timeout)
 FAIL: gdb.base/sigstep.exp: continue to handler; performing continue
 (timeout)
 FAIL: gdb.base/sigstep.exp: continue to handler; clear handler (timeout)
 FAIL: gdb.base/sigstep.exp: step to handler entry; resync (timeout)
 FAIL: gdb.base/sigstep.exp: step to handler entry; advance to infinite loop
 (tim
 eout)
 FAIL: gdb.base/sigstep.exp: step to handler entry; break handler (timeout)
 FAIL: gdb.base/sigstep.exp: step to handler entry; performing step (timeout)
 FAIL: gdb.base/sigstep.exp: step to handler entry; clear handler (timeout)
 FAIL: gdb.base/sigstep.exp: next to handler entry; resync (timeout)
 FAIL: gdb.base/sigstep.exp: next to handler entry; advance to infinite loop
 (tim
 eout)
 FAIL: gdb.base/sigstep.exp: next to handler entry; break handler (timeout)
 FAIL: gdb.base/sigstep.exp: next to handler entry; performing next (timeout)
 FAIL: gdb.base/sigstep.exp: next to handler entry; clear handler (timeout)
 FAIL: gdb.base/sigstep.exp: continue to handler entry; resync (timeout)
 FAIL: gdb.base/sigstep.exp: continue to handler entry; advance to infinite
 loop
 (timeout)
 FAIL: gdb.base/sigstep.exp: continue to handler entry; break handler
 (timeout)
 FAIL: gdb.base/sigstep.exp: continue to handler entry; performing continue
 (time
 out)
 FAIL: gdb.base/sigstep.exp: continue to handler entry; clear handler
 (timeout)
 FAIL: gdb.base/sigstep.exp: step over handler; resync (timeout)
 FAIL: gdb.base/sigstep.exp: step over handler; advance to infinite loop
 (timeout
 )
 FAIL: gdb.base/sigstep.exp: step over handler; performing step (timeout)
 FAIL: gdb.base/sigstep.exp: next over handler; resync (timeout)
 FAIL: gdb.base/sigstep.exp: next over handler; advance to infinite loop
 (timeout
 )
 FAIL: gdb.base/sigstep.exp: next over handler; performing next (timeout)
 FAIL: gdb.base/sigstep.exp: continue over handler; resync (timeout)
 FAIL: gdb.base/sigstep.exp: continue over handler; advance to infinite loop
 (tim
 eout)
 FAIL: gdb.base/sigstep.exp: continue over handler; performing continue
 (timeout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, to handler; resync (timeout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, to handler; break infinite
 loop
 (timeout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, to handler; break handler
 (timeo
 ut)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, to handler; continue to
 infinite
  loop (timeout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, to handler; performing step
 (tim
 eout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, to handler; clear infinite
 loop
 (timeout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, to handler; clear handler
 (timeo
 ut)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, to handler; resync (timeout)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, to handler; break infinite
 loop
 (timeout)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, to handler; break handler
 (timeo
 ut)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, to handler; continue to
 infinite
  loop (timeout)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, to handler; performing next
 (tim
 eout)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, to handler; clear infinite
 loop
 (timeout)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, to handler; clear handler
 (timeo
 ut)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, to handler; resync
 (timeout)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, to handler; break
 infinite l
 oop (timeout)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, to handler; break
 handler (t
 imeout)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, to handler; continue to
 infi
 nite loop (timeout)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, to handler; performing
 conti
 nue (timeout)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, to handler; clear
 infinite l
 oop (timeout)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, to handler; clear
 handler (t
 imeout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, to handler entry; resync
 (timeou
 t)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, to handler entry; break
 infinite
  loop (timeout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, to handler entry; break
 handler
 (timeout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, to handler entry; continue
 to in
 finite loop (timeout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, to handler entry; performing
 ste
 p (timeout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, to handler entry; clear
 infinite
  loop (timeout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, to handler entry; clear
 handler
 (timeout)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, to handler entry; resync
 (timeou
 t)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, to handler entry; break
 infinite
  loop (timeout)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, to handler entry; break
 handler
 (timeout)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, to handler entry; continue
 to in
 finite loop (timeout)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, to handler entry; performing
 nex
 t (timeout)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, to handler entry; clear
 infinite
  loop (timeout)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, to handler entry; clear
 handler
 (timeout)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, to handler entry; resync
 (ti
 meout)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, to handler entry; break
 infi
 nite loop (timeout)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, to handler entry; break
 hand
 ler (timeout)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, to handler entry;
 continue t
 o infinite loop (timeout)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, to handler entry;
 performing
  continue (timeout)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, to handler entry; clear
 infi
 nite loop (timeout)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, to handler entry; clear
 hand
 ler (timeout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, skip handler; resync
 (timeout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, skip handler; break infinite
 loo
 p (timeout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, skip handler; continue to
 infini
 te loop (timeout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, skip handler; performing
 step (t
 imeout)
 FAIL: gdb.base/sigstep.exp: step on breakpoint, skip handler; clear infinite
 loo
 p (timeout)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, skip handler; resync
 (timeout)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, skip handler; break infinite
 loo
 p (timeout)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, skip handler; continue to
 infini
 te loop (timeout)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, skip handler; performing
 next (t
 imeout)
 FAIL: gdb.base/sigstep.exp: next on breakpoint, skip handler; clear infinite
 loo
 p (timeout)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, skip handler; resync
 (timeou
 t)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, skip handler; break
 infinite
  loop (timeout)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, skip handler; continue
 to in
 finite loop (timeout)
 FAIL: gdb.base/sigstep.exp: continue on breakpoint, skip handler; performing
 con
 tinue (timeout)
 
 Summary before patches:
 
                 === gdb Summary ===
 
 # of expected passes            10199
 # of unexpected failures        290
 # of expected failures          47
 # of known failures             34
 # of unresolved testcases       2
 # of untested testcases         7
 # of unsupported tests          19
 
 Summary after patches:
 
                 === gdb Summary ===
 
 # of expected passes            10319
 # of unexpected failures        179
 # of expected failures          47
 # of known failures             34
 # of unresolved testcases       2
 # of untested testcases         7
 # of unsupported tests          19
 
 
 
 ------=_NextPart_000_0024_01C6108A.F7706F70
 Content-Type: application/octet-stream;
 	name="gdb64-sparc-sol2-tdep-sigtramp-detect.patch"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment;
 	filename="gdb64-sparc-sol2-tdep-sigtramp-detect.patch"
 
 diff -ru gdb-6.4/gdb/sparc-sol2-tdep.c gdb-6.4pppp/gdb/sparc-sol2-tdep.c=0A=
 --- gdb-6.4/gdb/sparc-sol2-tdep.c	2005-08-13 15:09:06.000000000 -0700=0A=
 +++ gdb-6.4pppp/gdb/sparc-sol2-tdep.c	2006-01-03 13:44:49.909791000 -0800=0A=
 @@ -50,6 +50,169 @@=0A=
  };=0A=
  =0C=0A=
  =0A=
 +#include <procfs.h>=0A=
 +extern lwpstatus_t * procfs_get_inf_lwp_status (void);=0A=
 +=0A=
 +/* get data model of inferior process */=0A=
 +static int=0A=
 +sparc_get_dmodel(CORE_ADDR sp)=0A=
 +{=0A=
 +  if(sp & 1)=0A=
 +    return 64;=0A=
 +  else=0A=
 +    return 32;=0A=
 +}=0A=
 +=0A=
 +/* get address of old user context for current=0A=
 +   thread, if any.=0A=
 +=0A=
 +   pr_oldcontext will be non null if the process=0A=
 +   is currently handling a signal */=0A=
 +=0A=
 +static CORE_ADDR=0A=
 +sparc_get_old_context(void)=0A=
 +{=0A=
 +  lwpstatus_t *p =3D procfs_get_inf_lwp_status();=0A=
 +  if(p)=0A=
 +    /* there is a process, use procfs to determine data model */=0A=
 +    return p->pr_oldcontext;=0A=
 +  else=0A=
 +    /* there is a no process, return -1 */=0A=
 +    return -1;=0A=
 +}=0A=
 +=0A=
 +/* list of current user contexts */=0A=
 +static CORE_ADDR *uclist =3D NULL;=0A=
 +static int uclist_len =3D 0;=0A=
 +=0A=
 +/* read in the current list of user contexts.=0A=
 +   If uc is zero, then there is no signal handler currently active=0A=
 +   If there is more than one signal handler active (nested) then=0A=
 +   uc points to a chain of user contexts=0A=
 +=0A=
 +   This function is optimised for a single user context. If a nested=0A=
 +   interrupt is handled, the uclist is grown to accommadate for user=0A=
 +   context pointers. The uclist is never freed and it never shrinks.=0A=
 +=0A=
 +   uclist is always null terminated */=0A=
 +=0A=
 +static void=0A=
 +read_ucontext(CORE_ADDR uc, int dmodel)=0A=
 +{=0A=
 +  int i;=0A=
 +=0A=
 +  if(!uclist)=0A=
 +  {=0A=
 +    uclist =3D xmalloc(sizeof(CORE_ADDR)*2);=0A=
 +    uclist_len =3D 2;=0A=
 +  }=0A=
 +  uclist[0] =3D uc;=0A=
 +  i =3D 1;=0A=
 +=0A=
 +  while(uc)=0A=
 +    {=0A=
 +      /* Read uc->uc_link, pointer to next user context if there=0A=
 +	 are nested signal handlers=0A=
 +	 uc_link is located at the second word in ucontext_t structure */=0A=
 +      if(dmodel =3D=3D 32)=0A=
 +	uc =3D read_memory_unsigned_integer (uc + 4, 4) & 0xffffffffUL;=0A=
 +      else=0A=
 +	uc =3D read_memory_unsigned_integer (uc + 8, 8);=0A=
 +=0A=
 +      /* null pointer terminates list, also there is an abnormal(?) =
 condition=0A=
 +	 when the uc_link can point to itself. Treat this as=0A=
 +	 termination also */=0A=
 +      if(!uc || uclist[i-1] =3D=3D uc)=0A=
 +	break;=0A=
 +=0A=
 +      /* make sure list has room for this link plus the terminating =
 zero */=0A=
 +      if(uclist_len =3D=3D i+1)=0A=
 +	{=0A=
 +	  uclist_len++;=0A=
 +	  uclist =3D xrealloc(uclist, sizeof(CORE_ADDR)*uclist_len);=0A=
 +	}=0A=
 +=0A=
 +      uclist[i] =3D uc;=0A=
 +      i++;=0A=
 +    }=0A=
 +  uclist[i] =3D 0;=0A=
 +}=0A=
 +=0A=
 +/* Check for a ucontext structure in the frame pointed to=0A=
 +   by the base pointer fp. If found, return ucontext address,=0A=
 +   if not found, return zero */=0A=
 +static CORE_ADDR=0A=
 +get_ucontext(CORE_ADDR fp, int dmodel)=0A=
 +{=0A=
 +  CORE_ADDR *uc =3D uclist;=0A=
 +=0A=
 +  /* The ucontext structure is passed by the kernel to the=0A=
 +     libc signal handler as the second structure on the stack=0A=
 +     at address (the offset is sizeof(struct frame)):=0A=
 +       %fp + 0x60 for sparc v1->v8+ (32bit)=0A=
 +       %fp + 0xbc for sparc v9 (64bit) */=0A=
 +=0A=
 +  while(*uc)=0A=
 +    {=0A=
 +      if(dmodel =3D=3D 32)=0A=
 +        {=0A=
 +	  if(*uc =3D=3D fp + 0x60)=0A=
 +            break;=0A=
 +        }=0A=
 +      else=0A=
 +        {=0A=
 +	  if(*uc =3D=3D fp + 0xbc)=0A=
 +            break;=0A=
 +        }=0A=
 +      uc++;=0A=
 +    }=0A=
 +  return *uc;=0A=
 +}=0A=
 +=0A=
 +/* Get the frame pointer from stack register save area=0A=
 +   Note: This relies on all register windows being flushed=0A=
 +   when the inferior stops. This is not always true, the=0A=
 +   /proc/<pid>/gwindows file should be checked for register=0A=
 +   windows that could not be flushed in the case that the stack=0A=
 +   read fails */=0A=
 +=0A=
 +static CORE_ADDR=0A=
 +sparc_frame_get_fp(CORE_ADDR sp, int dmodel)=0A=
 +{=0A=
 +  CORE_ADDR fp =3D 0;=0A=
 +=0A=
 +  if(dmodel =3D=3D 32)=0A=
 +    /* Read 32 bit register %i6 from stack */=0A=
 +    fp =3D read_memory_unsigned_integer (sp + 56, 4) & 0xffffffffUL;=0A=
 +  else=0A=
 +    /* Read 64 bit register %i6 from stack */=0A=
 +    fp =3D read_memory_unsigned_integer (sp + 112, 8);=0A=
 +=0A=
 +  return fp;=0A=
 +}=0A=
 +=0A=
 +/* Get the calling PC from stack register save area=0A=
 +   Note: This relies on all register windows being flushed=0A=
 +   when the inferior stops. This is not always true, the=0A=
 +   /proc/<pid>/gwindows file should be checked for register=0A=
 +   windows that could not be flushed in the case that the stack=0A=
 +   read fails */=0A=
 +=0A=
 +static CORE_ADDR=0A=
 +sparc_frame_get_calling_pc(CORE_ADDR sp, int dmodel)=0A=
 +{=0A=
 +  CORE_ADDR pc =3D 0;=0A=
 +=0A=
 +  if(dmodel =3D=3D 32)=0A=
 +    /* Read 32 bit register %i7 from stack */=0A=
 +    pc =3D read_memory_unsigned_integer (sp + 60, 4) & 0xffffffffUL;=0A=
 +  else=0A=
 +    /* Read 64 bit register %i7 from stack */=0A=
 +    pc =3D read_memory_unsigned_integer (sp + 120, 8);=0A=
 +=0A=
 +  return pc;=0A=
 +}=0A=
 +=0A=
  /* The Solaris signal trampolines reside in libc.  For normal signals,=0A=
     the function `sigacthandler' is used.  This signal trampoline will=0A=
     call the signal handler using the System V calling convention,=0A=
 @@ -64,14 +227,89 @@=0A=
     `struct sigcontext'.  It is the `ucbsigvechandler' function that=0A=
     converts the `ucontext_t' to a `sigcontext', and back.  Unless the=0A=
     signal handler modifies the `struct sigcontext' we can safely=0A=
 -   ignore this.  */=0A=
 +   ignore this.=0A=
 +=0A=
 +   In Solaris10, the sigacthandler passes control to call_user_handler,=0A=
 +   and then restores its stack frame, becoming invisible.=0A=
 +   call_user_handler then calls __sighndlr, which calls the user =
 provided=0A=
 +   signal handler function. The function call_user_handler does not=0A=
 +   return. After the user handler returns, it calls setcontext to return=0A=
 +   to the interrupted instruction.=0A=
 +=0A=
 +   The procfs is used to detect when the inferior process is in an=0A=
 +   interrupted state by querying for the ucontext structure address on=0A=
 +   the process stack.  The Solaris signal trampolines can now be =
 reliably=0A=
 +   detected by looking for the ucontext structure on the process stack=0A=
 +   while the PC is in the libc.so library.=0A=
 +=0A=
 +   For versions of Solaris prior to 10, the libc.a archive was still=0A=
 +   available. For programs that choose to link the static version of =
 libc,=0A=
 +   the original gdb detection method for signal trampolines is used. =
 This=0A=
 +   method detects the presence of a trampoline, but cannot detect the=0A=
 +   start and finish addresses of the trampoline.=0A=
 +   */=0A=
  =0A=
  int=0A=
 -sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, char *name)=0A=
 +sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, CORE_ADDR sp)=0A=
  {=0A=
 -  return (name && (strcmp (name, "sigacthandler") =3D=3D 0=0A=
 -		   || strcmp (name, "ucbsigvechandler") =3D=3D 0=0A=
 -		   || strcmp (name, "__sighndlr") =3D=3D 0));=0A=
 +  CORE_ADDR fp, rewpc;=0A=
 +  CORE_ADDR old_ucontext;=0A=
 +  char *name;=0A=
 +  int dmodel =3D sparc_get_dmodel(sp);=0A=
 +=0A=
 +  old_ucontext =3D sparc_get_old_context();=0A=
 +=0A=
 +  /* If there is no old context then we are not in a signal trampoline=0A=
 +     no further check required */=0A=
 +=0A=
 +  if(old_ucontext)=0A=
 +    {=0A=
 +      /* the signal trampoline is located in libc, most Solaris=0A=
 +         applications use a shared libc. As of Solaris10, the static=0A=
 +         version of libc is no longer available. */=0A=
 +	=0A=
 +      name =3D solib_address(pc);=0A=
 +      if((old_ucontext !=3D -1) && name && strstr(name, "libc.so."))=0A=
 +	{=0A=
 +	  /* read in ucontext plus any others in the chain */=0A=
 +	  read_ucontext(old_ucontext, dmodel);=0A=
 +=0A=
 +	  fp =3D 0;=0A=
 +	  while(name && strstr(name, "libc.so."))=0A=
 +	    {=0A=
 +	      /* If this is a signal handler frame, a ucontext structure=0A=
 +		 should be present on the stack */=0A=
 +	      if(get_ucontext(sp, dmodel))=0A=
 +		{=0A=
 +		  return 1;=0A=
 +		}=0A=
 +	      /* Unwind next frame */=0A=
 +	      fp =3D sparc_frame_get_fp(sp, dmodel);=0A=
 +	      rewpc =3D sparc_frame_get_calling_pc(sp, dmodel);=0A=
 +	      name =3D solib_address(rewpc);=0A=
 +	      sp =3D fp;=0A=
 +	    }=0A=
 +	  /* check final frame in libc for ucontext */=0A=
 +	  if(get_ucontext(fp, dmodel))=0A=
 +	    {=0A=
 +	      return 1;=0A=
 +	    }=0A=
 +        }=0A=
 +      else=0A=
 +	{=0A=
 +	  /* Old behaviour, just detect the function name. This is=0A=
 +	     required for apps that link against a static libc or=0A=
 +	     for examining corefiles.=0A=
 +	     NOTE: This does not provide full detection of signal=0A=
 +	     trampoline */=0A=
 +	  find_pc_partial_function (pc, &name, NULL, NULL);=0A=
 +	  return (name && (strcmp (name, "sigacthandler") =3D=3D 0=0A=
 +		       || strcmp (name, "ucbsigvechandler") =3D=3D 0=0A=
 +		       || strcmp (name, "__sighndlr") =3D=3D 0));=0A=
 +	}=0A=
 +    }=0A=
 +=0A=
 +  return 0;=0A=
  }=0A=
  =0A=
  static struct sparc_frame_cache *=0A=
 @@ -79,8 +317,9 @@=0A=
  				   void **this_cache)=0A=
  {=0A=
    struct sparc_frame_cache *cache;=0A=
 -  CORE_ADDR mcontext_addr, addr;=0A=
 +  CORE_ADDR sp, mcontext_addr, addr;=0A=
    int regnum;=0A=
 +  int dmodel;=0A=
  =0A=
    if (*this_cache)=0A=
      return *this_cache;=0A=
 @@ -90,11 +329,16 @@=0A=
  =0A=
    cache->saved_regs =3D trad_frame_alloc_saved_regs (next_frame);=0A=
  =0A=
 -  /* The third argument is a pointer to an instance of `ucontext_t',=0A=
 -     which has a member `uc_mcontext' that contains the saved=0A=
 -     registers.  */=0A=
 -  regnum =3D (cache->frameless_p ? SPARC_O2_REGNUM : SPARC_I2_REGNUM);=0A=
 -  mcontext_addr =3D frame_unwind_register_unsigned (next_frame, regnum) =
 + 40;=0A=
 +  sp =3D frame_sp_unwind (next_frame);=0A=
 +  dmodel =3D sparc_get_dmodel(sp);=0A=
 +  while(sp) {=0A=
 +      mcontext_addr =3D get_ucontext(sp, dmodel);=0A=
 +      if(mcontext_addr)=0A=
 +	break;=0A=
 +      sp =3D sparc_frame_get_fp(sp, dmodel);=0A=
 +  }=0A=
 +=0A=
 +  mcontext_addr +=3D 40;=0A=
  =0A=
    cache->saved_regs[SPARC32_PSR_REGNUM].addr =3D mcontext_addr + 0 * 4;=0A=
    cache->saved_regs[SPARC32_PC_REGNUM].addr =3D mcontext_addr + 1 * 4;=0A=
 @@ -160,11 +404,8 @@=0A=
  static const struct frame_unwind *=0A=
  sparc32_sol2_sigtramp_frame_sniffer (struct frame_info *next_frame)=0A=
  {=0A=
 -  CORE_ADDR pc =3D frame_pc_unwind (next_frame);=0A=
 -  char *name;=0A=
 -=0A=
 -  find_pc_partial_function (pc, &name, NULL, NULL);=0A=
 -  if (sparc_sol2_pc_in_sigtramp (pc, name))=0A=
 +  if (sparc_sol2_pc_in_sigtramp (frame_pc_unwind (next_frame),=0A=
 +				 frame_sp_unwind (next_frame)))=0A=
      return &sparc32_sol2_sigtramp_frame_unwind;=0A=
  =0A=
    return NULL;=0A=
 diff -ru gdb-6.4/gdb/sparc-tdep.h gdb-6.4pppp/gdb/sparc-tdep.h=0A=
 --- gdb-6.4/gdb/sparc-tdep.h	2004-11-29 07:20:27.000000000 -0800=0A=
 +++ gdb-6.4pppp/gdb/sparc-tdep.h	2005-12-15 18:16:54.445153000 -0800=0A=
 @@ -188,7 +188,7 @@=0A=
  /* Register offsets for Solaris 2.  */=0A=
  extern const struct sparc_gregset sparc32_sol2_gregset;=0A=
  =0A=
 -extern int sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, char *name);=0A=
 +extern int sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, CORE_ADDR sp);=0A=
  =0A=
  extern void sparc32_sol2_init_abi (struct gdbarch_info info,=0A=
  				   struct gdbarch *gdbarch);=0A=
 diff -ru gdb-6.4/gdb/sparc64-sol2-tdep.c =
 gdb-6.4pppp/gdb/sparc64-sol2-tdep.c=0A=
 --- gdb-6.4/gdb/sparc64-sol2-tdep.c	2005-06-12 04:10:56.000000000 -0700=0A=
 +++ gdb-6.4pppp/gdb/sparc64-sol2-tdep.c	2005-12-15 18:16:54.445763000 =
 -0800=0A=
 @@ -138,11 +138,8 @@=0A=
  static const struct frame_unwind *=0A=
  sparc64_sol2_sigtramp_frame_sniffer (struct frame_info *next_frame)=0A=
  {=0A=
 -  CORE_ADDR pc =3D frame_pc_unwind (next_frame);=0A=
 -  char *name;=0A=
 -=0A=
 -  find_pc_partial_function (pc, &name, NULL, NULL);=0A=
 -  if (sparc_sol2_pc_in_sigtramp (pc, name))=0A=
 +  if (sparc_sol2_pc_in_sigtramp (frame_sp_unwind (next_frame),=0A=
 +				 frame_pc_unwind (next_frame)))=0A=
      return &sparc64_sol2_sigtramp_frame_unwind;=0A=
  =0A=
    return NULL;=0A=
 
 ------=_NextPart_000_0024_01C6108A.F7706F70--
 



More information about the Gdb-prs mailing list