| 1 : |
anton
|
1.1
|
\ dis-gdb.fs disassembler using gdb |
| 2 : |
|
|
\ |
| 3 : |
anton
|
1.6
|
\ Copyright (C) 2004,2007 Free Software Foundation, Inc. |
| 4 : |
anton
|
1.1
|
|
| 5 : |
|
|
\ This file is part of Gforth. |
| 6 : |
|
|
|
| 7 : |
|
|
\ Gforth is free software; you can redistribute it and/or |
| 8 : |
|
|
\ modify it under the terms of the GNU General Public License |
| 9 : |
anton
|
1.5
|
\ as published by the Free Software Foundation, either version 3 |
| 10 : |
anton
|
1.1
|
\ of the License, or (at your option) any later version. |
| 11 : |
|
|
|
| 12 : |
|
|
\ This program is distributed in the hope that it will be useful, |
| 13 : |
|
|
\ but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 : |
|
|
\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 : |
|
|
\ GNU General Public License for more details. |
| 16 : |
|
|
|
| 17 : |
|
|
\ You should have received a copy of the GNU General Public License |
| 18 : |
anton
|
1.5
|
\ along with this program. If not, see http://www.gnu.org/licenses/. |
| 19 : |
anton
|
1.1
|
|
| 20 : |
anton
|
1.4
|
: append-extend-string ( addr1 u1 addr2 u2 -- addr3 u1+u2 ) |
| 21 : |
|
|
\ append string2 to string1 with dynamic memory reallocation. |
| 22 : |
|
|
swap >r dup >r extend-mem ( to addr3 u1+u2 r: addr2 u2 ) |
| 23 : |
anton
|
1.1
|
rot r> r> rot rot chars move ; |
| 24 : |
|
|
|
| 25 : |
|
|
: disasm-gdb { addr u -- } |
| 26 : |
|
|
base @ >r hex |
| 27 : |
anton
|
1.3
|
s\" type mktemp >/dev/null && type gdb >/dev/null && file=`mktemp -t gforthdis.XXXXXXXXXX` && file2=`mktemp -t gforthdis.XXXXXXXXXX` && echo \"set verbose off\nset logging file $file\nset logging on\ndisas " save-mem ( addr u addr1 u1 ) |
| 28 : |
anton
|
1.1
|
addr 0 <<# bl hold # #s 'x hold # #> append-extend-string #>> |
| 29 : |
|
|
addr u + 0 <<# # #s 'x hold # #> append-extend-string #>> |
| 30 : |
|
|
r> base ! cr |
| 31 : |
anton
|
1.2
|
s\" \nset logging off\nquit\n\" >$file2 && gdb -nx -q -p $PPID -x $file2 2>/dev/null >/dev/null && rm $file2 && grep -v \"of assembler\" $file && rm $file" append-extend-string |
| 32 : |
anton
|
1.1
|
2dup (system) 2swap drop free throw throw if |
| 33 : |
|
|
addr u dump |
| 34 : |
|
|
endif ; |
| 35 : |
|
|
|
| 36 : |
|
|
' disasm-gdb is discode |