File: pmat-cat-svpv

package info (click to toggle)
libdevel-mat-perl 0.53-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 908 kB
  • sloc: perl: 6,224; makefile: 3
file content (17 lines) | stat: -rwxr-xr-x 416 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl

use v5.14;
use warnings;

use Devel::MAT;

my $df = Devel::MAT->load( $ARGV[0] // die "Need dumpfile\n" )->dumpfile;

my $addr = $ARGV[1] // die "Need addr\n";
$addr = hex $addr if $addr =~ m/^0x/;

my $sv = $df->sv_at( $addr );
$sv or die sprintf "No SV at %#x\n", $addr;
$sv->type eq "SCALAR" or die "SV is not a SCALAR\n";
defined( my $pv = $sv->pv ) or die "SV does not have a PV\n";
print $pv;