public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* Re: testsuite/2033: sigbpt.exp fails on Solaris10 and Solaris9 (possibly others)
@ 2006-01-04  0:38 Steve Williams
  0 siblings, 0 replies; 7+ messages in thread
From: Steve Williams @ 2006-01-04  0:38 UTC (permalink / raw)
  To: unasigned; +Cc: gdb-prs

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 16:30:38 -0800

 This is a multi-part message in MIME format.
 
 ------=_NextPart_000_0015_01C61083.15EFE000
 Content-Type: text/plain;
 	charset="us-ascii"
 Content-Transfer-Encoding: 7bit
 
 
 
 Patch to allow single stepping to complete when a signal handler interrupts
 a single step operation. The change involves looking back through the frame
 stack for a signal trampoline, if one is present, gdb keeps single stepping.
 
 
 
 ------=_NextPart_000_0015_01C61083.15EFE000
 Content-Type: application/octet-stream;
 	name="gdb64-infrun-sigtramp-step.patch"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment;
 	filename="gdb64-infrun-sigtramp-step.patch"
 
 --- gdb-6.4/gdb/infrun.c	2005-11-14 07:35:16.000000000 -0800=0A=
 +++ gdb-6.4ppp/gdb/infrun.c	2005-12-15 18:19:25.799795000 -0800=0A=
 @@ -2361,6 +2361,40 @@=0A=
        return;=0A=
      }=0A=
  =0A=
 +  if (step_range_end && step_range_end !=3D 1)=0A=
 +    {=0A=
 +      /* If stepping (step or next) check for signal handler and skip=0A=
 +	 Current tests expect any signal handler to be skipped=0A=
 +	 over if performing any step operation. Maybe, this behaviour=0A=
 +	 should be changed to behave like subroutine calls.=0A=
 +	 =0A=
 +	 i.e. If performing a step, stop in the signal handler as if=0A=
 +	 a function call were performed. If performing a next, then=0A=
 +	 skip over the signal handler. */=0A=
 +=0A=
 +      struct frame_info *frame=3Dget_current_frame ();=0A=
 +      while(frame !=3D NULL)=0A=
 +	{=0A=
 +	  struct frame_id fid =3D get_frame_id (frame);=0A=
 +	  /* stop searching at step frame */=0A=
 +	  if(frame_id_eq (step_frame_id, fid))=0A=
 +	    break;=0A=
 +	  /* stop searching at sentinel frame */=0A=
 +	  if (frame_id_eq(fid, get_frame_id(get_next_frame(frame))))=0A=
 +	    break;=0A=
 +=0A=
 +	  if(get_frame_type (frame) =3D=3D SIGTRAMP_FRAME)=0A=
 +	    {=0A=
 +	      if (debug_infrun)=0A=
 +		 fprintf_unfiltered (gdb_stdlog,=0A=
 +		     "infrun: stepped to a signal handler function\n");=0A=
 +	      keep_going (ecs);=0A=
 +	      return;=0A=
 +	    }=0A=
 +	  frame=3Dget_prev_frame(frame);=0A=
 +	}=0A=
 +    }=0A=
 +=0A=
    if (frame_id_eq (frame_unwind_id (get_current_frame ()), =
 step_frame_id))=0A=
      {=0A=
        /* It's a subroutine call.  */=0A=
 
 ------=_NextPart_000_0015_01C61083.15EFE000--
 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: testsuite/2033: sigbpt.exp fails on Solaris10 and Solaris9 (possibly others)
@ 2006-01-04  1:38 Steve Williams
  0 siblings, 0 replies; 7+ messages in thread
From: Steve Williams @ 2006-01-04  1:38 UTC (permalink / raw)
  To: unasigned; +Cc: gdb-prs

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:29:46 -0800

 With the application of the 4 code patches, the patch to sigbpt.exp is no
 longer required.
 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: testsuite/2033: sigbpt.exp fails on Solaris10 and Solaris9 (possibly others)
@ 2006-01-04  1:28 Steve Williams
  0 siblings, 0 replies; 7+ messages in thread
From: Steve Williams @ 2006-01-04  1:28 UTC (permalink / raw)
  To: unasigned; +Cc: gdb-prs

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--
 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: testsuite/2033: sigbpt.exp fails on Solaris10 and Solaris9 (possibly others)
@ 2006-01-04  0:48 Steve Williams
  0 siblings, 0 replies; 7+ messages in thread
From: Steve Williams @ 2006-01-04  0:48 UTC (permalink / raw)
  To: unasigned; +Cc: gdb-prs

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 16:38:40 -0800

 This is a multi-part message in MIME format.
 
 ------=_NextPart_000_001E_01C61084.34C48660
 Content-Type: text/plain;
 	charset="us-ascii"
 Content-Transfer-Encoding: 7bit
 
 
 
 Patch to allow sparc-sol2-tdep.c to get the pr_oldcontext from the lwp
 status structure that is held in procfs.c.
 
 This is a quick hack, it would be tidier to add an ioctl style query
 interface to the target. The hack should be OK though, as only the sparc
 solaris target would use it.
 
 This patch is required to allow the new signal trampoline detection patch to
 work.
 
 ------=_NextPart_000_001E_01C61084.34C48660
 Content-Type: application/octet-stream;
 	name="gdb64-procfs-status-api.patch"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment;
 	filename="gdb64-procfs-status-api.patch"
 
 --- gdb-6.4/gdb/procfs.c	2006-01-03 14:39:12.098567000 -0800=0A=
 +++ gdb-6.4pppp/gdb/procfs.c	2006-01-03 13:45:41.666273000 -0800=0A=
 @@ -5363,6 +5363,27 @@=0A=
    return 0;=0A=
  }=0A=
  =0A=
 +lwpstatus_t *=0A=
 +procfs_get_inf_lwp_status (void)=0A=
 +{=0A=
 +  procinfo *pi;=0A=
 +  int pid =3D PIDGET (inferior_ptid);=0A=
 +  int tid =3D TIDGET (inferior_ptid);=0A=
 +=0A=
 +  /* First look up procinfo for the main process.  */=0A=
 +  pi =3D find_procinfo (pid, 0);=0A=
 +  if(pi =3D=3D NULL)=0A=
 +    return NULL;=0A=
 +=0A=
 +  /* If the event thread is not the same as GDB's requested thread=0A=
 +     (ie. inferior_ptid), then look up procinfo for the requested=0A=
 +     thread.  */=0A=
 +  if (tid !=3D 0 && tid !=3D proc_get_current_thread (pi))=0A=
 +    pi =3D find_procinfo_or_die (pid, tid);=0A=
 +=0A=
 +  return &pi->prstatus.pr_lwp;=0A=
 +}=0A=
 +=0A=
  #ifdef TM_I386SOL2_H=0A=
  /*=0A=
   * Function: procfs_find_LDT_entry=0A=
 
 ------=_NextPart_000_001E_01C61084.34C48660--
 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: testsuite/2033: sigbpt.exp fails on Solaris10 and Solaris9 (possibly others)
@ 2006-01-04  0:18 Steve Williams
  0 siblings, 0 replies; 7+ messages in thread
From: Steve Williams @ 2006-01-04  0:18 UTC (permalink / raw)
  To: unasigned; +Cc: gdb-prs

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 16:12:49 -0800

 This is a multi-part message in MIME format.
 
 ------=_NextPart_000_000F_01C61080.98313DA0
 Content-Type: text/plain;
 	charset="us-ascii"
 Content-Transfer-Encoding: 7bit
 
 
 
 Patch to allow signals to be delivered while using the procfs single step.
 
 The patch works by changing the process state from PR_FAULTED to the
 PR_REQUESTED state, before performing the single step.
 
 
 ------=_NextPart_000_000F_01C61080.98313DA0
 Content-Type: application/octet-stream;
 	name="gdb64-procfs-stepping.patch"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment;
 	filename="gdb64-procfs-stepping.patch"
 
 --- gdb-6.4/gdb/procfs.c	2005-02-15 07:49:14.000000000 -0800=0A=
 +++ gdb-6.4p/gdb/procfs.c	2005-12-04 20:01:55.992047000 -0800=0A=
 @@ -351,6 +351,7 @@=0A=
    /* process state */=0A=
    int was_stopped;=0A=
    int ignore_next_sigstop;=0A=
 +  int stepping;=0A=
  =0A=
    /* The following four fd fields may be identical, or may contain=0A=
       several different fd's, depending on the version of /proc=0A=
 @@ -1736,6 +1737,7 @@=0A=
  {=0A=
    int win;=0A=
    int runflags;=0A=
 +  int i;=0A=
  =0A=
    /*=0A=
     * We will probably have to apply this operation to individual =
 threads,=0A=
 @@ -1750,7 +1752,45 @@=0A=
  =0A=
    runflags    =3D PRCFAULT;	/* always clear current fault  */=0A=
    if (step)=0A=
 -    runflags |=3D PRSTEP;=0A=
 +    {=0A=
 +      runflags |=3D PRSTEP;=0A=
 +	 =0A=
 +      if(!pi->stepping)=0A=
 +	{=0A=
 +	  /* This is to address a problem on Solaris, I am not sure=0A=
 +	  if it is the same on other /proc based OS's.=0A=
 +=0A=
 +	  If the process has pending signals, they will not be=0A=
 +	  delivered to the representative lwp if we step while in=0A=
 +	  the PR_FAULTED state. The fix implemented here first=0A=
 +	  transistions the inferior to a PR_REQUESTED state=0A=
 +	  using a flag of PCSTOP.=0A=
 +=0A=
 +	  In procfs_wait, the stepping flag is detected in=0A=
 +	  state PR_REQUESTED and a subsequent call to=0A=
 +	  proc_run_process is made which will now perform=0A=
 +	  a PCRUN with option PRSTEP. The signal is now=0A=
 +	  delivered while stepping in this state.=0A=
 +	 =0A=
 +	  The proc man page states that a PCRUN with flag=0A=
 +	  PRSTOP will not execute any user code.  */=0A=
 +=0A=
 +	  for(i=3D0; i<NSIG; i++)=0A=
 +	    {=0A=
 +	      /* Can't use proc_get_pending_signals, as this will look=0A=
 +		 in the representative lwp status and the pending signals=0A=
 +		 for the process are in the process status. */=0A=
 +	      if(sigismember(&pi->prstatus.pr_sigpend, i) =3D=3D 1)=0A=
 +		{=0A=
 +		  runflags &=3D ~(PRSTEP);=0A=
 +		  runflags |=3D PRSTOP;=0A=
 +		  pi->stepping =3D 1;=0A=
 +		  break;=0A=
 +		}=0A=
 +	    }=0A=
 +	}=0A=
 +    }=0A=
 +=0A=
    if (signo =3D=3D 0)=0A=
      runflags |=3D PRCSIG;=0A=
    else if (signo !=3D -1)		/* -1 means do nothing W.R.T. signals */=0A=
 @@ -2037,6 +2077,9 @@=0A=
        return NULL;=0A=
  =0A=
  #ifdef NEW_PROC_API=0A=
 +  /* Is this right? certainly under solaris, pending signals=0A=
 +     for the process are in the process status not the lwp=0A=
 +     status, maybe the fields need to be OR'd */=0A=
    ret =3D &pi->prstatus.pr_lwp.pr_lwppend;=0A=
  #else=0A=
    ret =3D &pi->prstatus.pr_sigpend;=0A=
 @@ -4150,6 +4193,12 @@=0A=
  		wstat =3D (SIGSTOP << 8) | 0177;=0A=
  		break;=0A=
  #else=0A=
 +		if(pi->stepping)=0A=
 +		  {=0A=
 +		    proc_run_process (pi, 1, -1);=0A=
 +		    pi->stepping =3D 0;=0A=
 +		    goto wait_again;=0A=
 +		  }=0A=
  		if (retry < 5)=0A=
  		  {=0A=
  		    printf_filtered (_("Retry #%d:\n"), retry);=0A=
 
 ------=_NextPart_000_000F_01C61080.98313DA0--
 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: testsuite/2033: sigbpt.exp fails on Solaris10 and Solaris9 (possibly others)
@ 2006-01-03 22:28 Steve Williams
  0 siblings, 0 replies; 7+ messages in thread
From: Steve Williams @ 2006-01-03 22:28 UTC (permalink / raw)
  To: unasigned; +Cc: gdb-prs

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 14:24:24 -0800

 A related issue:
 
 Configuration:
 
 sparc-sun-solaris10
 gdb-6.4
 gcc-3.4.3
 
 R500.ramses.267> ./gdb --nx
 GNU gdb 6.4
 Copyright 2005 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and you are
 welcome to change it and/or distribute copies of it under certain
 conditions.
 Type "show copying" to see the conditions.
 There is absolutely no warranty for GDB.  Type "show warranty" for details.
 This GDB was configured as "sparc-sun-solaris2.10".
 (gdb)
 
 Problem:
 
 The sigstep.exp tests test the interaction of various forms of single
 stepping and signal handling. For the tests to run completely successfully
 the following two conditions must be true:
 
 1. A signal can be delivered to a process during a single step operation.
 2. The signal trampoline frame detection code can accurately detect the
 entry to a trampoline and the exit from the trampoline.
 
 Both the above conditions fail on Solaris. Leading to multiple failures in
 sigstep.exp (and other tests, for example sigbpt.exp).
 
 The first issue is:
 
 The Solaris single stepping function is implemented using the /proc
 filesystem and the PCRUN command with a PRSTEP flag.
 
 All gdb tests that try to deliver a signal while single stepping hang
 indefinitely. The reason is that signals pending against the process are
 not delivered when single stepping. Investigation shows that if a non
 single step based command such as "continue" is used, the signal is
 delivered as expected. Use the following gdb command to see the problem:
 
 ./gdb --nx --command=gdb.cmd testsuite/gdb.base/sigstep
 
 Where gdb.cmd contains:
 br main
 r
 set done = 1
 set itimer = itimer_real
 break 66
 continue
 advance 65
 break handler
 step
 
 Further investigation identified the specific scenario. If a PCRUN command
 is issued with a flag of PRSTEP when the process is in the PR_FAULTED state,
 any signals pending against the process are not delivered. If the process is
 first transitioned to the PR_REQUESTED state, and a PCRUN command with
 PRSTEP flag is now issued, the pending signals are delivered as expected.
 
 I have a patch to implement the above fix.
 
 The second issue is:
 
 The Solaris Signal Trampoline detection code in sparc-sol2-tdep.c detects
 the signal trampoline by looking for the functions sigacthandler,
 ucbsigvechandler or __sighndlr in the next frame.
 
 This is fine for detecting when you are in a stack frame reached via a
 signal trampoline, but it does not work to provide accurate detection of the
 beginning and end of the trampoline.
 
 The Solaris10 signal trampoline looks something like this:
 
   sigacthandler
     call_user_handler
       unsleep_self
         setup_schedctl
           __schedctl
       set_parking_flag
       lmutex_lock
       lmutex_unlock
       sigaddset
         sigvalid
           __sigfillset
       __lwp_sigmask
         __systemcall6
       __sighndlr
         <user handler code called>
       setcontext
         __setcontext_syscall
           _syscall6
 
 This only represents one path through the trampoline, based on signal number
 and critical sections, the control flow can change or be deferred. As such
 it is very difficult to track whether the current PC is inside a signal
 trampoline using the function names of the implementation.
 
 To make matters worse:
 
 1. In the last two patch cluster updates, the signal trampoline mechanism
 has changed, functions have been added then removed.
 
 2. The call to call_user_handler reuses the frame of sigacthandler,
 therefore sigacthandler cannot be detected on the stack.
 
 Because of issue 2 above the handle_inferior_event incorrectly identifies a
 call to call_user_handler in a signal trampoline at infrun.c:2364 as a
 subroutine call, i.e. the sigacthandler frame is trashed and replaced with
 call_user_handler frame, which is identified as a subroutine call of the
 current frame.
 
 Using the same test above(for issue 1), but turning on "set debug infrun 1"
 will show that a call to call_user_handler is incorrectly identified as a
 subroutine call.
 
 This actually enables the stepping mechanism to step over signal handlers as
 if they are subroutines, it works, but not as intended.
 
 If the signal trampoline detection code is corrected, so that it can fully
 detect a signal trampoline from beginning to end, it again fails, but now at
 infrun.c:2557. It is detected that single stepping has stepped to a
 different line, therefore stepping is stopped. It is correct that stepping
 is on a different line, but according to the test the expected outcome
 is that stepping is continued through the user handler and out through the
 signal trampoline until we return to the faulting instruction.
 
 The problems I see are:
 
 1. A mechanism based on function names to identify the complete signal
 trampoline
 is prone to break when the C library implementation changes.
 
 2. The logic in handle_inferior_event seems to be wrong for user signal
 handling functions. If it is detected we are at a different line, then it
 should be determined if this point was reached due to signal handling, if it
 was, then continue stepping though the signal handler and any subsequently
 called functions. I think this would require unwinding the frame stack
 looking for a SIGTRAMP frame. The test at infrun.c:2348 could be modified to
 not only look for a SIGTRAMP_FRAME in the current frame, but in any previous
 frame too.
 
 An alternative sigtramp detection mechanism could be to use the proc
 filesystem. The
 lwpstatus_t for the current lwp, or the representative lwp for the process
 contains a member "pr_oldcontext". If the process or lwp is currently
 handling a signal, this member will be non-null and will be the address of
 the first ucontext_t on the inferior process stack. (If the process is
 handling multiple nested signals the member uc_link in the ucontext_t will
 be the address of the next context structure).
 
 A signal trampoline could be reliably detected by just checking for the
 presence of a pr_oldcontext in the lwpstatus. The correct ucontext could be
 selected by comparing the frame stack pointer passed to the signal
 trampoline detection code with the stack pointers saved in the ucontext.
 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* testsuite/2033: sigbpt.exp fails on Solaris10 and Solaris9 (possibly others)
@ 2005-11-16  2:08 steve
  0 siblings, 0 replies; 7+ messages in thread
From: steve @ 2005-11-16  2:08 UTC (permalink / raw)
  To: gdb-gnats


>Number:         2033
>Category:       testsuite
>Synopsis:       sigbpt.exp fails on Solaris10 and Solaris9 (possibly others)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unasigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 16 02:08:01 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Steve Williams
>Release:        gdb-6.3
>Organization:
>Environment:
sparc64-sun-solaris2.10
>Description:
The sigbpt.exp test fails because when stepping out of a signal trampoline, Solaris does not return directly to the faulting instruction. It passes thru various procedures in the C library, various PROCEDURE_LINKAGE_TABLE routines and finally into setcontext before context is set back to the faulting user procedure.

The current test does not allow for any of this.
>How-To-Repeat:
cd .../gdb-6.3/gdb/testsuite
runtest --tool=gdb GDB=../gdb gdb.base/sigbpt.exp
WARNING: Couldn't find the global config file.
Test Run By src_dev on Tue Nov 15 18:08:04 2005
Native configuration is sparc-sun-solaris2.10

                === gdb tests ===

Schedule of variations:
    unix

Running target unix
Using /opt/utsi/test/R500/opt/utsi/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /opt/utsi/test/R500/opt/utsi/share/dejagnu/config/unix.exp as generic interface file for target.
Using ./config/unix.exp as tool-and-target-specific interface file.
Running ./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

                === gdb Summary ===

# of expected passes            60
# of unexpected failures        4
../gdb version  6.3 -nx
>Fix:
Add catch all case to sigbpt.exp. In the case it does not recognise the next instruction, then just keep stepping:

--- gdb-6.3/gdb/testsuite/gdb.base/sigbpt.exp   2005-11-15 17:53:45.875684000 -0
800
+++ gdb-6.3p/gdb/testsuite/gdb.base/sigbpt.exp  2005-11-15 17:53:00.731963000 -0
800
@@ -187,6 +187,13 @@
        -re "pc *0x\[a-z0-9\]* .*bowler.*$gdb_prompt $" {
            kfail gdb/1702 "$test (corrupt pc)"
        }
+       -re "pc *0x\[a-z0-9\]*.*$gdb_prompt $" {
+           # This allows for targets that step off
+           # through the C library before returning
+           # to the faulting instruction
+           send_gdb "stepi\n"
+           exp_continue
+       }
     }

     # Clear any breakpoints
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-01-04  1:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-04  0:38 testsuite/2033: sigbpt.exp fails on Solaris10 and Solaris9 (possibly others) Steve Williams
  -- strict thread matches above, loose matches on Subject: below --
2006-01-04  1:38 Steve Williams
2006-01-04  1:28 Steve Williams
2006-01-04  0:48 Steve Williams
2006-01-04  0:18 Steve Williams
2006-01-03 22:28 Steve Williams
2005-11-16  2:08 steve

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).