findaddr

来自「geekos 0.3.0简单的操作系统」· 代码 · 共 27 行

TXT
27
字号
#! /usr/bin/perl# Find the address of a symbol in the storage map.use strict qw(refs vars);use FileHandle;if ( scalar(@ARGV) != 2 ) {    print "Usage: findaddr <storage map> <symbol name>\n";    exit 1;}my $storage = shift @ARGV;my $symbol = shift @ARGV;my $fh = new FileHandle("<$storage");(defined $fh) || die "Couldn't open storage map: $!\n";while ( <$fh> ) {    if ( /^\s*(0x([0-9]|[a-f]|[A-F])+)\s+\Q$symbol\E\s*$/ ) {	print $1, "\n";	last;    }}$fh->close();

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?