From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17979 invoked by alias); 24 Oct 2003 17:57:27 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 17972 invoked from network); 24 Oct 2003 17:57:26 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 24 Oct 2003 17:57:26 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h9OHvQM06623 for ; Fri, 24 Oct 2003 13:57:26 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h9OHvPr11674; Fri, 24 Oct 2003 13:57:25 -0400 Received: from localhost.localdomain (vpn50-2.rdu.redhat.com [172.16.50.2]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id h9OHvOcY017746; Fri, 24 Oct 2003 13:57:24 -0400 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id h9OHvIx03476; Fri, 24 Oct 2003 10:57:18 -0700 Date: Fri, 24 Oct 2003 17:57:00 -0000 From: Kevin Buettner Message-Id: <1031024175718.ZM3475@localhost.localdomain> In-Reply-To: "J. Johnston" "RFA: ia64 portion of libunwind patch" (Oct 23, 8:11pm) References: <3F986E31.8050201@redhat.com> To: "J. Johnston" , gdb-patches@sources.redhat.com Subject: Re: RFA: ia64 portion of libunwind patch Cc: ac131313@redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-10/txt/msg00744.txt.bz2 On Oct 23, 8:11pm, J. Johnston wrote: > Ok to commit? Questions regarding this in conjunction with the generic > libunwind frame code? > +#ifdef HAVE_LIBUNWIND_IA64_H > + > +# ifndef __NR_getunwind > +# define __NR_getunwind 1215 > +# endif Is this part still needed? ........... > +static void * > +map_segment (bfd *bfd, Elf_Internal_Phdr *p_text, struct map_info *mi) > + { > + size_t page_mask = getpagesize () - 1, nbytes; > + char *buf, *cp; > + ssize_t nread; > + int fd; > + > + if (bfd->iostream) > + fd = fileno (bfd->iostream); > + else > + fd = open (bfd_get_filename (bfd), O_RDONLY); > + > + if (fd < 0) > + return NULL; > + > + buf = mmap (0, p_text->p_filesz, PROT_READ, MAP_PRIVATE, fd, > + p_text->p_offset & ~page_mask); > + if (buf != (char *) -1) > + { > + mi->buf = buf; > + mi->length = p_text->p_filesz; > + mi->mapped = 1; > + buf += p_text->p_offset & page_mask; > + } > + else > + { > + /* mmap () failed, try reading the file: */ > + mi->mapped = 0; > + > + if (lseek (fd, p_text->p_offset, SEEK_SET) < 0) > + { > + if (!bfd->iostream) > + close (fd); > + return NULL; > + } > + > + nbytes = p_text->p_filesz; > + cp = buf = xmalloc (nbytes); > + while ((nbytes > 0) && (nread = read (fd, cp, nbytes)) > 0) > + { > + cp += nread; > + nbytes -= nread; > + } > + if (nbytes > 0) > + { > + /* premature end-of-file or some error */ > + xfree (buf); > + buf = 0; > + } > + mi->buf = buf; > + } > + if (!bfd->iostream) > + close (fd); > + > + return buf; > +} For the above, why isn't bfd being employed to read the segment? Kevin