我想创建一个脚本或者实际上是一个快捷方式来安静地浏览
#!/bin/bash
konsole -e firefox --debug
(gdb) handle SIGPIPE noprint nostop pass
(gdb) handle SIGSEGV noprint nostop pass
(gdb) run
这不起作用。我希望有人能帮助我。解决后,我可以告诉你这个故事。我可能会帮助很多人。
到目前为止我可以做到这一点:
使用以下方式创建 bash 脚本
#!/bin/bash
konsole -e firefox --debug
将其标记为可执行文件。双击以在终端中打开,等待我输入运行并输入
创建~/.gdbinit
以下内容
handle SIGPIPE noprint nostop pass
handle SIGSEGV noprint nostop pass
答案1
bash
您可以使用( )的此处文档<<
将交互式命令传递给gdb
:
#!/bin/bash
firefox --debug <<'EOF'
handle SIGPIPE noprint nostop pass
handle SIGSEGV noprint nostop pass
run
EOF
检查Here Documents
部分man bash
以获得更多想法。
例子:
$ cat scr.sh
#!/bin/bash
firefox --debug <<'EOF'
help
quit
EOF
$ bash scr.sh
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/lib/firefox/firefox...(no debugging symbols found)...done.
(gdb) (gdb) (gdb) (gdb) (gdb) (gdb) (gdb) List of classes of commands:
aliases -- Aliases of other commands
breakpoints -- Making program stop at certain points
data -- Examining data
files -- Specifying and examining files
internals -- Maintenance commands
obscure -- Obscure features
running -- Running the program
stack -- Examining the stack
status -- Status inquiries
support -- Support facilities
tracepoints -- Tracing of program execution without stopping the program
user-defined -- User-defined commands
Type "help" followed by a class name for a list of commands in that class.
Type "help all" for the list of all commands.
Type "help" followed by command name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
(gdb)
$ ##Back to prompt
答案2
好的,它起作用了。现在我知道如何在这里创建一个新行。它是 shift + enter。仅适用于编辑模式。也许 4 个空格可用....只有 600 个字符,这是怎么回事?
this is the code:
#!/bin/bash
firefox --debug <<'EOF'
handle SIGPIPE noprint nostop pass
handle SIGSEGV noprint nostop pass
run
EOF
不需要“konsole -e”......然后只需双击脚本,然后就可以删除gdbinit
谢谢你 heemayl。你拯救了许多沮丧的 Linux 用户的生命,他们的 Firefox 崩溃率太高了!很抱歉添加了上面的文字,但 konsole -e 不是必需的,这是我的错。我现在真的很好奇 EOF 是什么意思。