Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Sep 2012 18:18:14 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r240418 - stable/7/lib/libdwarf
Message-ID:  <201209121818.q8CIIElA023300@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed Sep 12 18:18:14 2012
New Revision: 240418
URL: http://svn.freebsd.org/changeset/base/240418

Log:
  MFC r239872:
  
  Teach libdwarf about the DW_FORM_flag_present dwarf attribute, so
  programs using libdwarf (such as ctfconvert) don't error out on files
  containing the attribute.

Modified:
  stable/7/lib/libdwarf/dwarf.h
  stable/7/lib/libdwarf/dwarf_attrval.c
  stable/7/lib/libdwarf/dwarf_dump.c
  stable/7/lib/libdwarf/dwarf_init.c
Directory Properties:
  stable/7/lib/libdwarf/   (props changed)

Modified: stable/7/lib/libdwarf/dwarf.h
==============================================================================
--- stable/7/lib/libdwarf/dwarf.h	Wed Sep 12 18:16:40 2012	(r240417)
+++ stable/7/lib/libdwarf/dwarf.h	Wed Sep 12 18:18:14 2012	(r240418)
@@ -184,6 +184,7 @@
 #define DW_FORM_ref8			0x14
 #define DW_FORM_ref_udata		0x15
 #define DW_FORM_indirect		0x16
+#define DW_FORM_flag_present		0x19
 
 #define DW_OP_addr			0x03
 #define DW_OP_deref			0x06

Modified: stable/7/lib/libdwarf/dwarf_attrval.c
==============================================================================
--- stable/7/lib/libdwarf/dwarf_attrval.c	Wed Sep 12 18:16:40 2012	(r240417)
+++ stable/7/lib/libdwarf/dwarf_attrval.c	Wed Sep 12 18:18:14 2012	(r240418)
@@ -101,6 +101,7 @@ dwarf_attrval_flag(Dwarf_Die die, uint64
 	} else {
 		switch (av->av_form) {
 		case DW_FORM_flag:
+		case DW_FORM_flag_present:
 			*valp = (Dwarf_Bool) av->u[0].u64;
 			break;
 		default:

Modified: stable/7/lib/libdwarf/dwarf_dump.c
==============================================================================
--- stable/7/lib/libdwarf/dwarf_dump.c	Wed Sep 12 18:16:40 2012	(r240417)
+++ stable/7/lib/libdwarf/dwarf_dump.c	Wed Sep 12 18:18:14 2012	(r240418)
@@ -240,6 +240,8 @@ get_form_desc(uint32_t form)
 		return "DW_FORM_data8";
 	case DW_FORM_flag:
 		return "DW_FORM_flag";
+	case DW_FORM_flag_present:
+		return "DW_FORM_flag_present";
 	case DW_FORM_indirect:
 		return "DW_FORM_indirect";
 	case DW_FORM_ref1:
@@ -648,6 +650,7 @@ dwarf_dump_av(Dwarf_Die die, Dwarf_AttrV
 	case DW_FORM_data4:
 	case DW_FORM_data8:
 	case DW_FORM_flag:
+	case DW_FORM_flag_present:
 		printf("%llu", (unsigned long long) av->u[0].u64);
 		break;
 	case DW_FORM_ref1:

Modified: stable/7/lib/libdwarf/dwarf_init.c
==============================================================================
--- stable/7/lib/libdwarf/dwarf_init.c	Wed Sep 12 18:16:40 2012	(r240417)
+++ stable/7/lib/libdwarf/dwarf_init.c	Wed Sep 12 18:18:14 2012	(r240418)
@@ -396,6 +396,10 @@ dwarf_init_attr(Dwarf_Debug dbg, Elf_Dat
 		avref.u[1].s = elf_strptr(dbg->dbg_elf,
 		    dbg->dbg_s[DWARF_debug_str].s_shnum, avref.u[0].u64);
 		break;
+	case DW_FORM_flag_present:
+		/* This form has no value encoded in the DIE. */
+		avref.u[0].u64 = 1;
+		break;
 	default:
 		DWARF_SET_ERROR(error, DWARF_E_NOT_IMPLEMENTED);
 		ret = DWARF_E_NOT_IMPLEMENTED;



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