From 16bb467cd7d343dd3a16782b151b56cf15509594 Mon Sep 17 00:00:00 2001 From: Andrey Ponomarenko Date: Mon, 13 Sep 2021 22:00:02 +0300 Subject: Initial support for Fedora 34 --- INSTALL | 6 ++--- README.md | 2 +- abi-dumper.pl | 84 +++++++++++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 69 insertions(+), 23 deletions(-) mode change 100644 => 100755 abi-dumper.pl diff --git a/INSTALL b/INSTALL index 6a0bf08..b044c15 100644 --- a/INSTALL +++ b/INSTALL @@ -1,13 +1,13 @@ -Copyright (C) 2013-2017 Andrey Ponomarenko's ABI Laboratory +Copyright (C) 2013-2021 Andrey Ponomarenko's ABI Laboratory All rights reserved. RELEASE INFORMATION Project: ABI Dumper -Version: 1.1 -Date: August 30, 2017 +Version: 1.3 +Date: September 13, 2021 This file explains how to install and setup environment diff --git a/README.md b/README.md index 20b1485..995a3e0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -ABI Dumper 1.2 +ABI Dumper 1.3 ============== ABI Dumper — a tool to dump ABI of an ELF object containing DWARF debug info. diff --git a/abi-dumper.pl b/abi-dumper.pl old mode 100644 new mode 100755 index 502ecde..545308f --- a/abi-dumper.pl +++ b/abi-dumper.pl @@ -1,9 +1,9 @@ #!/usr/bin/perl ########################################################################### -# ABI Dumper 1.2 +# ABI Dumper 1.3 # Dump ABI of an ELF object containing DWARF debug info # -# Copyright (C) 2013-2020 Andrey Ponomarenko's ABI Laboratory +# Copyright (C) 2013-2021 Andrey Ponomarenko's ABI Laboratory # # Written by Andrey Ponomarenko # @@ -47,7 +47,7 @@ use Cwd qw(abs_path cwd realpath); use Storable qw(dclone); use Data::Dumper; -my $TOOL_VERSION = "1.2"; +my $TOOL_VERSION = "1.3"; my $ABI_DUMP_VERSION = "3.5"; my $ORIG_DIR = cwd(); my $TMP_DIR = tempdir(CLEANUP=>1); @@ -93,7 +93,7 @@ my %ERROR_CODE = ( my $ShortUsage = "ABI Dumper $TOOL_VERSION Dump ABI of an ELF object containing DWARF debug info -Copyright (C) 2019 Andrey Ponomarenko's ABI Laboratory +Copyright (C) 2021 Andrey Ponomarenko's ABI Laboratory License: GNU LGPL 2.1 Usage: $CmdName [options] [object] @@ -409,6 +409,7 @@ my %TypeType = ( "subroutine_type"=>"Func", "array_type"=>"Array", "base_type"=>"Intrinsic", + "atomic_type"=>"Intrinsic", "unspecified_type"=>"Unspecified", "const_type"=>"Const", "pointer_type"=>"Pointer", @@ -944,12 +945,25 @@ sub readAltInfo($) if(/\A\s*(.+?)\Z/) { $DirTable{keys(%DirTable)+1} = $1; } + elsif(/\A\s*(\d+)\s+(.+?)\s+\(\d+\)\Z/) + { # F34 + $DirTable{$1} = $2; + } } } - if(/(\d+)\s+(\d+)\s+\d+\s+\d+\s+([^ ]+)/) + my ($Num, $Dir, $File) = (); + + if(/(\d+)\s+(\d+)\s+\d+\s+\d+\s+([^ ]+)/) { + ($Num, $Dir, $File) = ($1, $2, $3) + } + elsif(/(\d+)\s+([^ ]+)\s+\(\d+\)\,\s+(\d+)/) + { # F34 + ($Num, $File, $Dir) = ($1, $2, $3); + } + + if($File) { - my ($Num, $Dir, $File) = ($1, $2, $3); chomp($File); if(defined $AddDirs) @@ -1181,9 +1195,13 @@ sub readDWARFInfo($) if(defined $DirTable_Def) { - if(/\A\s*(.+?)\Z/) { + if(/\A\s*([^\[\]\(\)]+?)\Z/) { $DirTable{keys(%DirTable)+1} = $1; } + elsif(/\A\s*(\d+)\s+(.+?)\s+\(\d+\)\Z/) + { # F34 + $DirTable{$1} = $2; + } } } @@ -1191,21 +1209,32 @@ sub readDWARFInfo($) and /Table at offset (\w+)/) { $Offset = $1; } - elsif(defined $Offset - and /(\d+)\s+(\d+)\s+\d+\s+\d+\s+([^ ]+)/) + elsif(defined $Offset) { - my ($Num, $Dir, $File) = ($1, $2, $3); - chomp($File); + my ($Num, $Dir, $File) = (); - if(defined $AddDirs) + if(/(\d+)\s+(\d+)\s+\d+\s+\d+\s+([^ ]+)/) { + ($Num, $Dir, $File) = ($1, $2, $3); + } + elsif(/(\d+)\s+([^ ]+)\s+\(\d+\)\,\s+(\d+)/) + { # F34 + ($Num, $File, $Dir) = ($1, $2, $3); + } + + if($File) { - if(my $DName = $DirTable{$Dir}) + chomp($File); + + if(defined $AddDirs) { - $File = $DName."/".$File; + if(my $DName = $DirTable{$Dir}) + { + $File = $DName."/".$File; + } } + + $SourceFile{$Offset}{$Num} = $File; } - - $SourceFile{$Offset}{$Num} = $File; } } close(SRC); @@ -1226,6 +1255,8 @@ sub readDWARFInfo($) open(LOC, $EU_READELF_L." $AddOpt --debug-dump=loc \"$Path\" 2>\"$TMP_DIR/error\" |"); } + my $Offset = undef; + while() { if(/\A \[\s*(\w+)\].*\[\s*\w+\]\s*(.+)\Z/) { @@ -1234,6 +1265,14 @@ sub readDWARFInfo($) elsif(/\A \[\s*(\w+)\]/) { $DebugLoc{$1} = ""; } + elsif(/Offset:\s+(.+?),/) + { # F34 + $Offset = $1; + } + elsif($Offset and /\A\s+\[\s*\w+\]\s*(.+)\Z/) + { # F34 + $DebugLoc{$Offset} = $1; + } } close(LOC); @@ -1613,7 +1652,7 @@ sub readDWARFDump($$) $Val=~s/\A\"//; $Val=~s/\"\Z//; - if($Val=~/GNU\s+(C\d*|C\+\+|GIMPLE)\s+(.+)\Z/) + if($Val=~/GNU\s+(C\d*|C\+\+\d*|GIMPLE)\s+(.+)\Z/) { $SYS_GCCV = $2; if($SYS_GCCV=~/\A(\d+\.\d+)(\.\d+|)/) @@ -4280,9 +4319,12 @@ sub setSource(@) if(defined $File) { + my $InfoName = undef; if(index($File, "(")!=-1) { # Support for new elfutils (Fedora 30) - $File=~s/.+ \((\d+)\)/$1/; + if($File=~s/\A(.+?)\s+\((\d+)\)/$1/) { + $InfoName = $1; + } } my $Name = undef; @@ -4294,6 +4336,10 @@ sub setSource(@) { # imported $Name = $SourceFile_Alt{0}{$File}; } + + if(not $Name) { + $Name = $InfoName; + } if($Name=~/\.($HEADER_EXT)\Z/i or index($Name, ".")==-1) @@ -6513,7 +6559,7 @@ sub scenario() if($ShowVersion) { printMsg("INFO", "ABI Dumper $TOOL_VERSION"); - printMsg("INFO", "Copyright (C) 2019 Andrey Ponomarenko's ABI Laboratory"); + printMsg("INFO", "Copyright (C) 2021 Andrey Ponomarenko's ABI Laboratory"); printMsg("INFO", "License: GNU LGPL 2.1 "); printMsg("INFO", "This program is free software: you can redistribute it and/or modify it.\n"); printMsg("INFO", "Written by Andrey Ponomarenko."); -- cgit v1.2.3