From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6107 invoked by alias); 21 Apr 2011 17:49:46 -0000 Received: (qmail 6098 invoked by uid 22791); 21 Apr 2011 17:49:45 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Apr 2011 17:49:31 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3LHnV7i024174 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 21 Apr 2011 13:49:31 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p3LHnUqo014066; Thu, 21 Apr 2011 13:49:31 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p3LHnUZx015171; Thu, 21 Apr 2011 13:49:30 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 057D237808F; Thu, 21 Apr 2011 11:49:29 -0600 (MDT) From: Tom Tromey To: Binutils Development Subject: RFA: readelf -n -vs- stapsdt notes Date: Thu, 21 Apr 2011 17:49:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-04/txt/msg00312.txt.bz2 This patch changes `readelf -n' to recognize stapsdt notes. These are created by programs using . With this patch the output looks like: Notes at offset 0x0001b748 with length 0x00000044: Owner Data size Description stapsdt 0x0000002e NT_STAPSDT (SystemTap probe descriptors) Ok? I'd like to write a follow-on patch that pretty-prints the contents of the note, since this is useful information, but I noticed that most other notes don't have this... is there a particular reason for that? Tom 2011-04-21 Tom Tromey * readelf.c (get_stapsdt_note_type): New function. (process_note): Recognize "stapsdt" notes. Index: readelf.c =================================================================== RCS file: /cvs/src/src/binutils/readelf.c,v retrieving revision 1.540 diff -u -r1.540 readelf.c --- readelf.c 7 Apr 2011 11:40:12 -0000 1.540 +++ readelf.c 21 Apr 2011 17:37:22 -0000 @@ -12294,6 +12294,24 @@ } static const char * +get_stapsdt_note_type (unsigned e_type) +{ + static char buff[64]; + + switch (e_type) + { + case NT_STAPSDT: + return _("NT_STAPSDT (SystemTap probe descriptors)"); + + default: + break; + } + + snprintf (buff, sizeof (buff), _("Unknown note type: (0x%08x)"), e_type); + return buff; +} + +static const char * get_ia64_vms_note_type (unsigned e_type) { static char buff[64]; @@ -12439,6 +12457,9 @@ /* VMS/ia64-specific file notes. */ nt = get_ia64_vms_note_type (pnote->type); + else if (const_strneq (pnote->namedata, "stapsdt")) + nt = get_stapsdt_note_type (pnote->type); + else /* Don't recognize this note name; just use the default set of note type strings. */