This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] fix solib-svr4.c with 64-bit bfd


Hello,

I had encountered a bug in GDB 5.1 compiled for sparc-sun-solaris2.8,
that GDB cannot resolve symbols in shared libraries in 32-bit environment.
(I found this problem had been reported as PR gdb/266).

I found that this seems to be because LM_ADDR() in solib-svr4.c
sign-extends 32-bit address value into 64-bit CORE_ADDR type.
I have no access to SVR4 spec, but under SunOS 5.7 and 5.8,
<sys/link.h> says that `l_addr' is unsigned, and it seems that
l_addr should be zero-extended.

This is a patch to fix it.

2002-01-18  TAKAI Kousuke <takai@vlsi.kuee.kyoto-u.ac.jp>

	* solib-svr4.c (LM_ADDR): Use `extract_address' instead of
	`extract_signed_integer'.
	Fix PR gdb/266.

*** gdb-5.1.orig/gdb/solib-svr4.c	Tue Jul  3 04:37:59 2001
--- gdb-5.1/gdb/solib-svr4.c	Fri Jan 18 03:58:10 2002
*************** LM_ADDR (struct so_list *so)
*** 185,192 ****
  {
    struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
  
!   return (CORE_ADDR) extract_signed_integer (so->lm_info->lm + lmo->l_addr_offset, 
! 					     lmo->l_addr_size);
  }
  
  static CORE_ADDR
--- 185,191 ----
  {
    struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
  
!   return extract_address (so->lm_info->lm + lmo->l_addr_offset, lmo->l_addr_size);
  }
  
  static CORE_ADDR
[end of patch]

I am not subscribing gdb-patches, so I will appreciate it
if you would send Cc to me.
Sorry for my poor English.

-- 
 TAKAI Kousuke <takai@vlsi.kuee.kyoto-u.ac.jp>
  Dept. of Communications and Computer Engineering,
  Graduate School of Infomatics, Kyoto University, Japan


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