From 22c9f8f5c5bf6957e5a95bfbae8cbac7036f7953 Mon Sep 17 00:00:00 2001 From: sewer56 Date: Thu, 7 Dec 2023 15:38:45 +0000 Subject: [PATCH] Added: Support for Array Ordering --- src/util/dwarf.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/util/dwarf.rs b/src/util/dwarf.rs index 1359e6d..083f64b 100644 --- a/src/util/dwarf.rs +++ b/src/util/dwarf.rs @@ -568,6 +568,13 @@ pub struct ArrayDimension { pub size: Option, } +#[derive(Debug, Eq, PartialEq, Copy, Clone, IntoPrimitive, TryFromPrimitive)] +#[repr(u16)] +pub enum ArrayOrdering { + RowMajor = 0, // ORD_row_major + ColMajor = 1, // ORD_col_major +} + #[derive(Debug, Clone)] pub struct ArrayType { pub element_type: Box, @@ -1648,6 +1655,17 @@ fn process_array_tag(tags: &TagMap, tag: &Tag) -> Result { format!("Failed to process SubscrData for tag: {:?}", tag) })?) } + (AttributeKind::Ordering, val) => { + match val { + AttributeValue::Data2(d2) => { + let order = ArrayOrdering::try_from_primitive(*d2)?; + if order == ArrayOrdering::ColMajor { + log::warn!("Column Major Ordering in Tag {}, Cannot guarantee array will be correct if original source is in different programming language.", tag.key); + } + } + _ => bail!("Unhandled ArrayType attribute {:?}", attr) + } + } _ => { bail!("Unhandled ArrayType attribute {:?}", attr) }