Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Mar 2012 17:44:36 +0000 (UTC)
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r233317 - head/usr.sbin/pmcstat
Message-ID:  <201203221744.q2MHia1i034664@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gonzo
Date: Thu Mar 22 17:44:36 2012
New Revision: 233317
URL: http://svn.freebsd.org/changeset/base/233317

Log:
  Fix base vaddr detection for ELF binaries. PT_LOAD with offset 0 is not
  mandatory for ELF binaries so we'll use the segment with offset less then
  alignment and align it appropriately (which covers pt_offset == 0 case)

Modified:
  head/usr.sbin/pmcstat/pmcstat_log.c

Modified: head/usr.sbin/pmcstat/pmcstat_log.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcstat_log.c	Thu Mar 22 17:36:53 2012	(r233316)
+++ head/usr.sbin/pmcstat/pmcstat_log.c	Thu Mar 22 17:44:36 2012	(r233317)
@@ -697,8 +697,8 @@ pmcstat_image_get_elf_params(struct pmcs
 				        ph.p_offset);
 				break;
 			case PT_LOAD:
-				if (ph.p_offset == 0)
-					image->pi_vaddr = ph.p_vaddr;
+				if ((ph.p_offset & (-ph.p_align)) == 0)
+					image->pi_vaddr = ph.p_vaddr & (-ph.p_align);
 				break;
 			}
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203221744.q2MHia1i034664>