103333823c75a1c1887e923828113a1b0fd12020cElliott Hughes/* Return a given parameter of a macro. 203333823c75a1c1887e923828113a1b0fd12020cElliott Hughes Copyright (C) 2014 Red Hat, Inc. 303333823c75a1c1887e923828113a1b0fd12020cElliott Hughes This file is part of elfutils. 403333823c75a1c1887e923828113a1b0fd12020cElliott Hughes 503333823c75a1c1887e923828113a1b0fd12020cElliott Hughes This file is free software; you can redistribute it and/or modify 603333823c75a1c1887e923828113a1b0fd12020cElliott Hughes it under the terms of either 703333823c75a1c1887e923828113a1b0fd12020cElliott Hughes 803333823c75a1c1887e923828113a1b0fd12020cElliott Hughes * the GNU Lesser General Public License as published by the Free 903333823c75a1c1887e923828113a1b0fd12020cElliott Hughes Software Foundation; either version 3 of the License, or (at 1003333823c75a1c1887e923828113a1b0fd12020cElliott Hughes your option) any later version 1103333823c75a1c1887e923828113a1b0fd12020cElliott Hughes 1203333823c75a1c1887e923828113a1b0fd12020cElliott Hughes or 1303333823c75a1c1887e923828113a1b0fd12020cElliott Hughes 1403333823c75a1c1887e923828113a1b0fd12020cElliott Hughes * the GNU General Public License as published by the Free 1503333823c75a1c1887e923828113a1b0fd12020cElliott Hughes Software Foundation; either version 2 of the License, or (at 1603333823c75a1c1887e923828113a1b0fd12020cElliott Hughes your option) any later version 1703333823c75a1c1887e923828113a1b0fd12020cElliott Hughes 1803333823c75a1c1887e923828113a1b0fd12020cElliott Hughes or both in parallel, as here. 1903333823c75a1c1887e923828113a1b0fd12020cElliott Hughes 2003333823c75a1c1887e923828113a1b0fd12020cElliott Hughes elfutils is distributed in the hope that it will be useful, but 2103333823c75a1c1887e923828113a1b0fd12020cElliott Hughes WITHOUT ANY WARRANTY; without even the implied warranty of 2203333823c75a1c1887e923828113a1b0fd12020cElliott Hughes MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 2303333823c75a1c1887e923828113a1b0fd12020cElliott Hughes General Public License for more details. 2403333823c75a1c1887e923828113a1b0fd12020cElliott Hughes 2503333823c75a1c1887e923828113a1b0fd12020cElliott Hughes You should have received copies of the GNU General Public License and 2603333823c75a1c1887e923828113a1b0fd12020cElliott Hughes the GNU Lesser General Public License along with this program. If 2703333823c75a1c1887e923828113a1b0fd12020cElliott Hughes not, see <http://www.gnu.org/licenses/>. */ 2803333823c75a1c1887e923828113a1b0fd12020cElliott Hughes 2903333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#ifdef HAVE_CONFIG_H 3003333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# include <config.h> 3103333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#endif 3203333823c75a1c1887e923828113a1b0fd12020cElliott Hughes 3303333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#include "libdwP.h" 3403333823c75a1c1887e923828113a1b0fd12020cElliott Hughes 3503333823c75a1c1887e923828113a1b0fd12020cElliott Hughesint 3603333823c75a1c1887e923828113a1b0fd12020cElliott Hughesdwarf_macro_param (Dwarf_Macro *macro, size_t idx, Dwarf_Attribute *ret) 3703333823c75a1c1887e923828113a1b0fd12020cElliott Hughes{ 3803333823c75a1c1887e923828113a1b0fd12020cElliott Hughes if (macro == NULL) 3903333823c75a1c1887e923828113a1b0fd12020cElliott Hughes return -1; 4003333823c75a1c1887e923828113a1b0fd12020cElliott Hughes 4103333823c75a1c1887e923828113a1b0fd12020cElliott Hughes if (idx >= libdw_macro_nforms (macro)) 4203333823c75a1c1887e923828113a1b0fd12020cElliott Hughes return -1; 4303333823c75a1c1887e923828113a1b0fd12020cElliott Hughes 4403333823c75a1c1887e923828113a1b0fd12020cElliott Hughes *ret = macro->attributes[idx]; 4503333823c75a1c1887e923828113a1b0fd12020cElliott Hughes return 0; 4603333823c75a1c1887e923828113a1b0fd12020cElliott Hughes} 47