This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bug in dwarf1.c


Hi Colin,

: In bfd/dwarf1.c, dwarf1_unit_find_nearest_line is defined as taking
: an address that is of type unsigned long.  However, the address is
: passed as an bfd_vma, which is not necessarily unsigned long (eg on
: our platform is is unsigned long long).
: 
: Should addr be redefined as bfd_vma, or should addr be cast before
: calling this function?

Actually I think that the proper thing to do is to change the type of
the 'addr' variable in _bfd_dwarf1_find_nearest_line().  This is
because 'addr' is compared against 'low_pc' and 'high_pc' in the
dwarf1_debug structure, and these are both unsigned longs.

ie I think that we should apply the patch below.

Cheers
	Nick


2001-05-09  Nick Clifton  <nickc@redhat.com>

	* dwarf1.c (_bfd_dwarf1_find_nearest_line): Change type of
	'addr' to be unsigned long, in order to match its use.

*** devo/bfd/dwarf1.c	Mon Dec 11 03:02:45 2000
--- sourceware/bfd/dwarf1.c	Wed May  9 17:03:54 2001
*************** _bfd_dwarf1_find_nearest_line (abfd, sec
*** 458,464 ****
    struct dwarf1_unit* eachUnit;
  
    /* What address are we looking for? */
!   bfd_vma addr = offset + section->vma;
  
    *filename_ptr = NULL;
    *functionname_ptr = NULL;
--- 458,464 ----
    struct dwarf1_unit* eachUnit;
  
    /* What address are we looking for? */
!   unsigned long addr = (unsigned long) (offset + section->vma);
  
    *filename_ptr = NULL;
    *functionname_ptr = NULL;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]