version 1.1, 2004/06/13 17:04:29
|
version 1.5, 2007/12/31 18:40:24
|
Line 6
|
Line 6
|
|
|
\ Gforth is free software; you can redistribute it and/or |
\ Gforth is free software; you can redistribute it and/or |
\ modify it under the terms of the GNU General Public License |
\ modify it under the terms of the GNU General Public License |
\ as published by the Free Software Foundation; either version 2 |
\ as published by the Free Software Foundation, either version 3 |
\ of the License, or (at your option) any later version. |
\ of the License, or (at your option) any later version. |
|
|
\ This program is distributed in the hope that it will be useful, |
\ This program is distributed in the hope that it will be useful, |
Line 15
|
Line 15
|
\ GNU General Public License for more details. |
\ GNU General Public License for more details. |
|
|
\ You should have received a copy of the GNU General Public License |
\ You should have received a copy of the GNU General Public License |
\ along with this program; if not, write to the Free Software |
\ along with this program. If not, see http://www.gnu.org/licenses/. |
\ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. |
|
|
|
: append-extend-string ( addr1 u1 addr2 u2 -- addr2 u1+u2 ) |
: append-extend-string ( addr1 u1 addr2 u2 -- addr3 u1+u2 ) |
\ concatenate string1 and string2 with dynamic memory allocation |
\ append string2 to string1 with dynamic memory reallocation. |
swap >r dup >r extend-mem ( to addr2 u1+u2 r: addr2 u2 ) |
swap >r dup >r extend-mem ( to addr3 u1+u2 r: addr2 u2 ) |
rot r> r> rot rot chars move ; |
rot r> r> rot rot chars move ; |
|
|
: disasm-gdb { addr u -- } |
: disasm-gdb { addr u -- } |
base @ >r hex |
base @ >r hex |
s\" file=`mktemp -t gforthdis.XXXXXXXXXX`\nfile2=`mktemp -t gforthdis.XXXXXXXXXX`\necho \"set verbose off\nset logging file $file\nset logging on\ndisas " save-mem ( addr u addr1 u1 ) |
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 ) |
addr 0 <<# bl hold # #s 'x hold # #> append-extend-string #>> |
addr 0 <<# bl hold # #s 'x hold # #> append-extend-string #>> |
addr u + 0 <<# # #s 'x hold # #> append-extend-string #>> |
addr u + 0 <<# # #s 'x hold # #> append-extend-string #>> |
r> base ! cr |
r> base ! cr |
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 |
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 |
2dup (system) 2swap drop free throw throw if |
2dup (system) 2swap drop free throw throw if |
addr u dump |
addr u dump |
endif ; |
endif ; |