From owner-svn-src-all@FreeBSD.ORG Wed Feb 25 21:43:10 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B809139C; Wed, 25 Feb 2015 21:43:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A2D0CD3A; Wed, 25 Feb 2015 21:43:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1PLhA3F048431; Wed, 25 Feb 2015 21:43:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1PLhABa048430; Wed, 25 Feb 2015 21:43:10 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201502252143.t1PLhABa048430@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 25 Feb 2015 21:43:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279298 - head/contrib/elftoolchain/nm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Feb 2015 21:43:10 -0000 Author: emaste Date: Wed Feb 25 21:43:09 2015 New Revision: 279298 URL: https://svnweb.freebsd.org/changeset/base/279298 Log: nm: avoid crash in print_lineno if func->name is NULL This can occur when DW_AT_specification is used to refer to another DIE that provides the actual DW_AT_name string. For example: < 3><0x00000086> DW_TAG_subprogram DW_AT_name PrettyStackTraceEntry ... < 1><0x00002cf4> DW_TAG_subprogram DW_AT_specification <0x00000086> We will need to add support for DW_AT_specification, but in the interim we should not segfault. Obtained from: Elftoolchain (r3170) Sponsored by: The FreeBSD Foundation Modified: head/contrib/elftoolchain/nm/nm.c Modified: head/contrib/elftoolchain/nm/nm.c ============================================================================== --- head/contrib/elftoolchain/nm/nm.c Wed Feb 25 21:10:03 2015 (r279297) +++ head/contrib/elftoolchain/nm/nm.c Wed Feb 25 21:43:09 2015 (r279298) @@ -1525,7 +1525,8 @@ print_lineno(struct sym_entry *ep, struc /* For function symbol, search the function line information list. */ if ((ep->sym->st_info & 0xf) == STT_FUNC && func_info != NULL) { SLIST_FOREACH(func, func_info, entries) { - if (!strcmp(ep->name, func->name) && + if (func->name != NULL && + !strcmp(ep->name, func->name) && ep->sym->st_value >= func->lowpc && ep->sym->st_value < func->highpc) { printf("\t%s:%" PRIu64, func->file, func->line);