* [Bug tools/24509] New: eu-readelf does not know how to dissect DW_AT_discr_list
@ 2019-05-01 20:47 tromey at sourceware dot org
2019-05-01 22:36 ` [Bug tools/24509] " mark at klomp dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2019-05-01 20:47 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=24509
Bug ID: 24509
Summary: eu-readelf does not know how to dissect
DW_AT_discr_list
Product: elfutils
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: tools
Assignee: unassigned at sourceware dot org
Reporter: tromey at sourceware dot org
CC: elfutils-devel at sourceware dot org
Target Milestone: ---
Consider the Ada test case in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83935#c2.
Compiling to a .o and then using eu-readelf will yield something
like:
...
[ 6b] variant abbrev: 5
discr_list (block1) 7 byte block: 01 01 ff ff ff ff
07
discr_list has a specified structure, and it would be nice
if eu-readelf could dump it more verbosely.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tools/24509] eu-readelf does not know how to dissect DW_AT_discr_list
2019-05-01 20:47 [Bug tools/24509] New: eu-readelf does not know how to dissect DW_AT_discr_list tromey at sourceware dot org
@ 2019-05-01 22:36 ` mark at klomp dot org
2019-05-02 15:51 ` tromey at sourceware dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mark at klomp dot org @ 2019-05-01 22:36 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=24509
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mark at klomp dot org
--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
Created attachment 11760
--> https://sourceware.org/bugzilla/attachment.cgi?id=11760&action=edit
quick DW_AT_discr_list prototype
Here is a quick hack to show something more intelligent. It doesn't yet handle
signed values.
Could you provide a few different examples that we could use as testcases?
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tools/24509] eu-readelf does not know how to dissect DW_AT_discr_list
2019-05-01 20:47 [Bug tools/24509] New: eu-readelf does not know how to dissect DW_AT_discr_list tromey at sourceware dot org
2019-05-01 22:36 ` [Bug tools/24509] " mark at klomp dot org
@ 2019-05-02 15:51 ` tromey at sourceware dot org
2019-05-02 16:07 ` tromey at sourceware dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2019-05-02 15:51 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=24509
--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Here's one that uses both ranges and discrete elements:
package Rng is
type Rec (I : Integer) is record
case I is
when Positive =>
C : Character;
case I is
when 1..15 | 17 | 23 =>
null;
when others =>
N : Natural;
end case;
when others =>
S : String (1 .. 10);
end case;
end record;
R : Rec (1);
end Rng;
And here's one that uses unsigned types:
package Urng is
type Unsigned is mod 65536;
type Rec (I : Unsigned) is record
case I is
when 17 | 23 | 32768..65535 =>
null;
when others =>
S : String (1 .. 10);
end case;
end record;
R : Rec (1);
end Urng;
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tools/24509] eu-readelf does not know how to dissect DW_AT_discr_list
2019-05-01 20:47 [Bug tools/24509] New: eu-readelf does not know how to dissect DW_AT_discr_list tromey at sourceware dot org
2019-05-01 22:36 ` [Bug tools/24509] " mark at klomp dot org
2019-05-02 15:51 ` tromey at sourceware dot org
@ 2019-05-02 16:07 ` tromey at sourceware dot org
2019-05-02 21:48 ` mark at klomp dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2019-05-02 16:07 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=24509
--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
To check for negative values, I think you can add another
clause, here's what I did:
package Rng is
type Rec (I : Integer) is record
case I is
when Positive =>
C : Character;
case I is
when 1..15 | 17 | 23 =>
null;
when others =>
N : Natural;
end case;
when -52..-1 =>
Q: Natural;
when others =>
S : String (1 .. 10);
end case;
end record;
R : Rec (1);
end Rng;
The proposed patch does not handle this properly:
[ 9f] variant abbrev: 5
discr_list (block1) range: 76-127
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tools/24509] eu-readelf does not know how to dissect DW_AT_discr_list
2019-05-01 20:47 [Bug tools/24509] New: eu-readelf does not know how to dissect DW_AT_discr_list tromey at sourceware dot org
` (2 preceding siblings ...)
2019-05-02 16:07 ` tromey at sourceware dot org
@ 2019-05-02 21:48 ` mark at klomp dot org
2019-05-09 14:01 ` tromey at sourceware dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mark at klomp dot org @ 2019-05-02 21:48 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=24509
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #11760|0 |1
is obsolete| |
--- Comment #4 from Mark Wielaard <mark at klomp dot org> ---
Created attachment 11762
--> https://sourceware.org/bugzilla/attachment.cgi?id=11762&action=edit
discr_list patch that handles signed/unsigned variant_part types
Updated patch that handles signed/unsigned discriminators.
So this is what I used as testcase to have a signed (Integer) and unsigned
(Character) discr.
package Rng is
type Rec (I : Integer) is record
case I is
when Positive =>
C : Character;
case I is
when 1..15 | 17 | 23..255 =>
null;
when others =>
N : Natural;
end case;
when -52..-1 =>
Q: Natural;
when -53 =>
R: Character;
when others =>
S : String (1 .. 10);
end case;
end record;
Subtype Uppercase is Character Range 'A'..'Z';
Subtype Lowercase is Character Range 'a'..'z';
Subtype Numbers is Character Range '0'..'9';
type RecC (C : Character) is record
case C is
when '@' =>
B : Boolean;
when Lowercase | Uppercase | Numbers =>
D : Character;
when others =>
null;
end case;
end record;
R : Rec (1);
RC : RecC ('$');
end Rng;
Does the output look like what you would expect?
BTW. The byte_size expressions are impressive!
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tools/24509] eu-readelf does not know how to dissect DW_AT_discr_list
2019-05-01 20:47 [Bug tools/24509] New: eu-readelf does not know how to dissect DW_AT_discr_list tromey at sourceware dot org
` (3 preceding siblings ...)
2019-05-02 21:48 ` mark at klomp dot org
@ 2019-05-09 14:01 ` tromey at sourceware dot org
2019-05-10 17:44 ` mark at klomp dot org
2019-05-16 15:28 ` mark at klomp dot org
6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2019-05-09 14:01 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=24509
--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
FWIW the output looks reasonable to me now. Thanks for doing this!
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tools/24509] eu-readelf does not know how to dissect DW_AT_discr_list
2019-05-01 20:47 [Bug tools/24509] New: eu-readelf does not know how to dissect DW_AT_discr_list tromey at sourceware dot org
` (4 preceding siblings ...)
2019-05-09 14:01 ` tromey at sourceware dot org
@ 2019-05-10 17:44 ` mark at klomp dot org
2019-05-16 15:28 ` mark at klomp dot org
6 siblings, 0 replies; 8+ messages in thread
From: mark at klomp dot org @ 2019-05-10 17:44 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=24509
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
--- Comment #6 from Mark Wielaard <mark at klomp dot org> ---
Proposed patch, added default/empty block handling, data bounds checks and
testcases: https://sourceware.org/ml/elfutils-devel/2019-q2/msg00072.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tools/24509] eu-readelf does not know how to dissect DW_AT_discr_list
2019-05-01 20:47 [Bug tools/24509] New: eu-readelf does not know how to dissect DW_AT_discr_list tromey at sourceware dot org
` (5 preceding siblings ...)
2019-05-10 17:44 ` mark at klomp dot org
@ 2019-05-16 15:28 ` mark at klomp dot org
6 siblings, 0 replies; 8+ messages in thread
From: mark at klomp dot org @ 2019-05-16 15:28 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=24509
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Mark Wielaard <mark at klomp dot org> ---
commit 643cbb275d65533472c0f53391f9fc1d5d9a2efc
Author: Mark Wielaard <mark@klomp.org>
Date: Sun May 5 23:18:36 2019 +0200
readelf: Decode DW_AT_discr_list block attributes.
Decode DW_AT_descr_list blocks using the DW_DSC values.
This requires knowing the signedness of the discriminant.
Which means the attr_callback function needs access to the
parent DIE. Pass the whole DIE path, plus the current level.
That way the type of the discriminant can be looked up in
the variant_part (parent) DIE of the variant DIE (which has
the discr_list attribute).
Add a testcase using both signed and unsigned discriminants.
https://sourceware.org/bugzilla/show_bug.cgi?id=24509
Signed-off-by: Mark Wielaard <mark@klomp.org>
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-05-16 15:28 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-01 20:47 [Bug tools/24509] New: eu-readelf does not know how to dissect DW_AT_discr_list tromey at sourceware dot org
2019-05-01 22:36 ` [Bug tools/24509] " mark at klomp dot org
2019-05-02 15:51 ` tromey at sourceware dot org
2019-05-02 16:07 ` tromey at sourceware dot org
2019-05-02 21:48 ` mark at klomp dot org
2019-05-09 14:01 ` tromey at sourceware dot org
2019-05-10 17:44 ` mark at klomp dot org
2019-05-16 15:28 ` mark at klomp dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).