3

I want to create a script or actually a shortcut to surf in peace

#!/bin/bash
konsole -e firefox --debug
(gdb) handle SIGPIPE noprint nostop pass
(gdb) handle SIGSEGV noprint nostop pass
(gdb) run

this doesn't work. i hope someone will help me. after the solution, i can tell you story. it's possible that i will help a lot of people with that.

so far i can do this:

creating a bash-script with

#!/bin/bash
konsole -e firefox --debug

marking it as executable. double click ends with opening up in terminal waiting for me to type run and enter

creating the ~/.gdbinit with following content

handle SIGPIPE noprint nostop pass
handle SIGSEGV noprint nostop pass

2 Answers 2

3

You can use Here Documents of bash (<<) to pass the interactive commands to gdb:

#!/bin/bash
firefox --debug  <<'EOF'
handle SIGPIPE noprint nostop pass
handle SIGSEGV noprint nostop pass
run
EOF 

Check the Here Documents section of man bash to get more idea.

Example:

$ 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
6
  • i've to still write run and press enter. i'm not sure if gdb recognizes the "handle"-lines
    – user371780
    Nov 8, 2015 at 3:30
  • @user371780 I don't know about the handle lines but this is the generic approach and should work..
    – heemayl
    Nov 8, 2015 at 3:32
  • 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: <gnu.org/software/gdb/bugs>. Find the GDB manual and other documentation resources online at: <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)
    – user371780
    Nov 8, 2015 at 3:34
  • terminal stops after (gdb) like it does everytime and waits for me to type run and press enter. i need some lines in a script that does it for me.
    – user371780
    Nov 8, 2015 at 3:35
  • @user371780 check my example..perhaps you should add a quit line at the end..
    – heemayl
    Nov 8, 2015 at 3:38
0

alright it works. now i know how to create a new line here. it's shift + enter. only for edit mode. maybe 4 spaces work.... just 600 characters wtf?

this is the code:
#!/bin/bash
firefox --debug <<'EOF'
handle SIGPIPE noprint nostop pass
handle SIGSEGV noprint nostop pass
run
EOF

no need of "konsole -e"......then just double click the script, then gdbinit can be deleted

thank you heemayl. you saved the life of many, many frustrated linux users who's firefox crash are too damn high! i'm sorry for adding the text above, but konsole -e is not neccessary, which was mine fault. i am now really curious what EOF means.

6
  • This is what i have stated in my answer..isn' t it? so you should probably remove this answer as you have already commented below my answer containg this..
    – heemayl
    Nov 8, 2015 at 4:28
  • Now the backstory is that long time ago many many year, I couldn't use firefox as I did on Windows. I didn't know what to do so I accepted this problem. Now I want a solution. First I read about segmentation fault, the GDB. I tried to memtest my RAM but everything is ok. I marked the bad RAM in BadRAM of grub2 but still no help. Then I started Firefox in gdb (I did earlier too to detect the bad RAM nodes) but this time I added some block commands. If SIGSEGV or SIGPIPE occurs, just go on. Now after so many years, I can live in pease and surf in peace and freedom! Thank you!
    – user371780
    Nov 8, 2015 at 4:28
  • quit and console -e are unneccesary
    – user371780
    Nov 8, 2015 at 4:29
  • while running from shell, if you want to run the script in a new terminal window than konsole is needed..and i added quit later to be sure of the operation after your initial comment..
    – heemayl
    Nov 8, 2015 at 4:31
  • btw my badram grub2: GRUB_BADRAM="0x00007ffff18ee587,0x00007ffff7bcb95b,0x00007fffdfbb3a24,0x00007ffff7bcc20b,0x00007ffff7bc1c45,0x7ffff2b6c726,0x7fffe60fe700,0x7fffa71f2000,0x0000555555564f00,0x7fffcf261700,0x7fffb42b4000,0x7fffb3f37000,0x7fffcb488000,0x7fffba61e000,0x7fffa62df000,0x7fffa73c2000,0x7fffc3526000,0x7fffcc7b1700,0x7fffe5cfe700,0x7fffbb7ea000,0x7fffc659f000,0x7fffc53ac000,0x7fffbb8c7000,0x7fff9869e000,0x7fffbcf75000,0x7fff98d48000,0x7fffbc182000,0x7fff9a342000,0x7fffbe36c000,0x00007ffff1325ae2,0x7fffb0b4f000,0x00007ffff18d5b0b,0x7fffd6d80700,0x00007ffff20cb689,0x7fffcaafd700"
    – user371780
    Nov 8, 2015 at 4:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .