Mercurial > illumos > illumos-gate
changeset 13744:18167dc65232
1973 ctfconvert VLA support is broken (again) for DWARF objects
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Gordon Ross <gwr@nexenta.com>
author | Jason King <jason.brian.king@gmail.com> |
---|---|
date | Thu, 28 Jun 2012 19:37:15 +0100 |
parents | 95aba6e49b9f |
children | 6b3106b4250f |
files | usr/src/tools/ctf/cvt/dwarf.c |
diffstat | 1 files changed, 47 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/tools/ctf/cvt/dwarf.c Sat Jun 30 13:00:47 2012 -0700 +++ b/usr/src/tools/ctf/cvt/dwarf.c Thu Jun 28 19:37:15 2012 +0100 @@ -22,6 +22,10 @@ * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright 2012 Jason King. All rights reserved. + * Use is subject to license terms. + */ /* * DWARF to tdata conversion @@ -360,6 +364,37 @@ return (0); } +/* + * the following functions lookup the value of an attribute in a DIE: + * + * die_signed + * die_unsigned + * die_bool + * die_string + * + * They all take the same parameters (with the exception of valp which is + * a pointer to the type of the attribute we are looking up): + * + * dw - the dwarf object to look in + * die - the DIE we're interested in + * name - the name of the attribute to lookup + * valp - pointer to where the value of the attribute is placed + * req - if the value is required (0 / non-zero) + * + * If the attribute is not found, one of the following happens: + * - program terminates (req is non-zero) + * - function returns 0 + * + * If the value is found, and in a form (class) we can handle, the function + * returns 1. + * + * Currently, we can only handle attribute values that are stored as + * constants (immediate value). If an attribute has a form we cannot + * handle (for example VLAs may store the dimensions of the array + * as a DWARF expression that can compute it at runtime by reading + * values off the stack or other locations in memory), it is treated + * the same as if the attribute does not exist. + */ static int die_signed(dwarf_t *dw, Dwarf_Die die, Dwarf_Half name, Dwarf_Signed *valp, int req) @@ -371,6 +406,9 @@ return (0); /* die_attr will terminate for us if necessary */ if (dwarf_formsdata(attr, &val, &dw->dw_err) != DW_DLV_OK) { + if (req == 0) + return (0); + terminate("die %llu: failed to get signed (form 0x%x)\n", die_off(dw, die), die_attr_form(dw, attr)); } @@ -392,6 +430,9 @@ return (0); /* die_attr will terminate for us if necessary */ if (dwarf_formudata(attr, &val, &dw->dw_err) != DW_DLV_OK) { + if (req == 0) + return (0); + terminate("die %llu: failed to get unsigned (form 0x%x)\n", die_off(dw, die), die_attr_form(dw, attr)); } @@ -412,6 +453,9 @@ return (0); /* die_attr will terminate for us if necessary */ if (dwarf_formflag(attr, &val, &dw->dw_err) != DW_DLV_OK) { + if (req == 0) + return (0); + terminate("die %llu: failed to get bool (form 0x%x)\n", die_off(dw, die), die_attr_form(dw, attr)); } @@ -432,6 +476,9 @@ return (0); /* die_attr will terminate for us if necessary */ if (dwarf_formstring(attr, &str, &dw->dw_err) != DW_DLV_OK) { + if (req == 0) + return (0); + terminate("die %llu: failed to get string (form 0x%x)\n", die_off(dw, die), die_attr_form(dw, attr)); }