comparison scripts/list2crc.pl @ 2955:a0b770fab355

Add scripts/os9.gdb and list2crc.pl for gdb debugging Some gdb commands to facilitate debugging with gdb (on XRoar). Uses GVIM as external code viewer. Example: mkdir lst make PORTS=coco1 LISTDIR=$PWD/lst cd lst for f in *.lst; do ../scripts/list2crc.pl $f; done m6809-gdb (gdb) source ../scripts/os9.gdb (gdb) tar rem :65520 (gdb) os9_mwhere (print current module, update source viewer) (gdb) os9_mdir (list all registered modules and their entry points) (gdb) hbreak *0xa243 (set breakpoint on entry of SHELL) (gdb) cont (gdb) b9 0x56 (set a breakpoint at offset 0x56 in SHELL) (gdb) cont
author Tormod Volden <debian.tormod@gmail.com>
date Sun, 09 Feb 2014 21:44:25 +0100
parents
children
comparison
equal deleted inserted replaced
2954:43588191b624 2955:a0b770fab355
1 #!/usr/bin/perl
2
3 # Copyright 2014 Tormod Volden
4 #
5 # Digests assembly listings generated by lwasm, and stores the
6 # module body listing in a file named by the module CRC.
7 # Example: for f in *.lst; do ../scripts/list2crc.pl $f; done
8
9 open(CRCFILE, ">", "crc.tmp") or die "cannot create crc.tmp: $!";
10
11 while (<>) {
12 ($hoffset, $opbytes, $filepath, $lineno, $label, $opcode, $operand, $comment) =
13 ( $_ =~ /^(\w+) (\w+)\s+\((.*)\):(\d+) (\S+)?\s+(\w+)\s*(\S+)?\s*(.*)?/ );
14
15 # print $hoffset, "\t", $opcode, "\t", $comment, "\n";
16 if (lc($opcode) eq "mod") {
17 $in_module = 1;
18 }
19
20 if (lc($opcode) eq "emod") {
21 die "double emod" if $found_emod;
22 $found_emod = 1;
23 $crc = $opbytes;
24 $in_module = 0;
25 }
26
27 # if ($in_module && $hoffset) {
28 # $offset = hex($hoffset);
29 # print CRCFILE "$offset\t$filepath\t$lineno\n";
30 # }
31 if ($in_module) {
32 print CRCFILE $_
33 }
34 }
35 close(CRCFILE);
36 if ($crc) {
37 print "writing $crc.crc\n";
38 rename "crc.tmp", $crc . ".crc";
39 }