Subject: port-pc532/7711: gdb does not do tracebacks for pc532
To: None <gnats-bugs@gnats.netbsd.org>
From: Ian Dall <Ian.Dall@dsto.defence.gov.au>
List: netbsd-bugs
Date: 06/05/1999 06:51:21
>Number:         7711
>Category:       port-pc532
>Synopsis:       gdb does not do tracebacks for pc532
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-pc532-maintainer (NetBSD/pc532 Portmaster)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun  5 06:50:00 1999
>Last-Modified:
>Originator:     Ian Dall
>Organization:
	
>Release:        <NetBSD-current source date>1.4C
>Environment:
	
System: NetBSD sibyl.chez-dall.org.au 1.4C NetBSD 1.4C (SIBYL) #1: Tue Jun 1 15:34:02 CST 1999 ian@sibyl.chez-dall.org.au:/usr3/netbsd-1.2/lsrc/sys/arch/pc532/compile/SIBYL pc532


>Description:
	
gdb does not do tracebacks for pc532
>How-To-Repeat:
	
Run gdb, attach to a process, type bt. Note that only the current frame is shown.
>Fix:
	

The problem arises due to doing a signed comparison of frame addresses when unsigned
comparisons should be used. A patch follows.


*** /usr3/netbsd-1.2/src/gnu/dist/gdb/config/ns32k/tm-nbsd.h    Thu Feb 11 22:43:13 1999
--- tm-nbsd.h   Sat Jun  5 00:01:52 1999
***************
*** 41,47 ****
  #define FRAME_SAVED_PC(FRAME) \
    (((FRAME)->signal_handler_caller \
      ? sigtramp_saved_pc (FRAME) \
!     : read_memory_integer ((FRAME)->frame + 4, 4)) \
     )
  
  #undef FRAME_NUM_ARGS
--- 41,47 ----
  #define FRAME_SAVED_PC(FRAME) \
    (((FRAME)->signal_handler_caller \
      ? sigtramp_saved_pc (FRAME) \
!     : read_memory_unsigned_integer ((FRAME)->frame + 4, 4)) \
     )
  
  #undef FRAME_NUM_ARGS
***************
*** 49,56 ****
  
  #undef FRAME_CHAIN
  #define FRAME_CHAIN(thisframe)  \
!   (read_memory_integer ((thisframe)->frame, 4) > (thisframe)->frame ? \
!    read_memory_integer ((thisframe)->frame, 4) : 0)
  
  #define FRAME_CHAIN_VALID(chain, thisframe)\
       ((chain) != 0\
--- 49,56 ----
  
  #undef FRAME_CHAIN
  #define FRAME_CHAIN(thisframe)  \
!   (read_memory_unsigned_integer ((thisframe)->frame, 4) > (thisframe)->frame ? \
!    read_memory_unsigned_integer ((thisframe)->frame, 4) : 0)
  
  #define FRAME_CHAIN_VALID(chain, thisframe)\
       ((chain) != 0\
***************
*** 98,105 ****
  
  #undef FRAME_CHAIN
  #define FRAME_CHAIN(thisframe)  \
!   (read_memory_integer ((thisframe)->frame, 4) > (thisframe)->frame ? \
!    read_memory_integer ((thisframe)->frame, 4) : 0)
  
  #undef FRAME_CHAIN_VALID
  #define FRAME_CHAIN_VALID(chain, thisframe)   \
--- 98,105 ----
  
  #undef FRAME_CHAIN
  #define FRAME_CHAIN(thisframe)  \
!   (read_memory_unsigned_integer ((thisframe)->frame, 4) > (thisframe)->frame ? \
!    read_memory_unsigned_integer ((thisframe)->frame, 4) : 0)
  
  #undef FRAME_CHAIN_VALID
  #define FRAME_CHAIN_VALID(chain, thisframe)   \
>Audit-Trail:
>Unformatted: