log in | register | forums
Show:
Go:
Forums
Username:

Password:

User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- Elsear brings super-fast Networking to Risc PC/A7000/A7000+ (News:)
- Latest hardware upgrade from RISCOSbits (News:)
- Accessing old floppy disks (Gen:3)
- November developer 'fireside' chat on saturday night (News:)
- RISCOSbits releases a new laptop solution (News:4)
- Announcing the TIB 2024 Advent Calendar (News:2)
- RISC OS London Show Report 2024 (News:1)
- Code GCC produces that makes you cry #12684 (Prog:39)
- Rougol November 2024 meeting on monday (News:)
- Drag'n'Drop 14i1 edition reviewed (News:)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
 
View on Mastodon
@www.iconbar.com@rss-parrot.net
Site Search
 
Article archives
Acorn Arcade forums: Programming: Segfaults for dummies
 
  Segfaults for dummies
  Phlamethrower (22:37 2/6/2005)
  monkeyson2 (23:05 2/6/2005)
    Phlamethrower (23:14 2/6/2005)
      monkeyson2 (23:50 2/6/2005)
        Phlamethrower (23:57 2/6/2005)
          jmb (00:48 3/6/2005)
            Phlamethrower (01:10 3/6/2005)
              Phlamethrower (13:11 3/6/2005)
 
Jeffrey Lee Message #66313, posted by Phlamethrower at 22:37, 2/6/2005
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
If I've compiled a program for *nix using GCC and it's segfaulting, is there any easy command line switch I can use when compiling to make the error report give me some useful information? (e.g. the name of the function that's going wrong)

Or will I have to mess around with a seperate debugger?
  ^[ Log in to reply ]
 
Phil Mellor Message #66315, posted by monkeyson2 at 23:05, 2/6/2005, in reply to message #66313
monkeyson2Please don't let them make me be a monkey butler

Posts: 12380
-mpoke-function-name ?
  ^[ Log in to reply ]
 
Jeffrey Lee Message #66316, posted by Phlamethrower at 23:14, 2/6/2005, in reply to message #66315
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
cc1: error: invalid option `poke-function-name'
  ^[ Log in to reply ]
 
Phil Mellor Message #66317, posted by monkeyson2 at 23:50, 2/6/2005, in reply to message #66316
monkeyson2Please don't let them make me be a monkey butler

Posts: 12380
I guess that's a RISC OS only thing. You want it for Unix? According to the posting guidelines, you should bugger off and ask somewhere more appropriate :P

I'm afraid I can only suggest -g or significant amounts of printf now. :(
  ^[ Log in to reply ]
 
Jeffrey Lee Message #66318, posted by Phlamethrower at 23:57, 2/6/2005, in reply to message #66317
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
Baaaah! :(

Would be OK if it crashed when compiled for RISC OS :(
  ^[ Log in to reply ]
 
JMB Message #66319, posted by jmb at 00:48, 3/6/2005, in reply to message #66318
Member
Posts: 467
The correct answer is:

$ gcc -g foo.c -o foo

$ gdb ./foo

(gdb) run

***SEGV***

(gdb) bt

The other tool you'll want to investigate is valgrind, which is the best debugging tool EVAR!
  ^[ Log in to reply ]
 
Jeffrey Lee Message #66320, posted by Phlamethrower at 01:10, 3/6/2005, in reply to message #66319
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
ok, thanks :)

*sits around waiting for cygwin to update*
  ^[ Log in to reply ]
 
Jeffrey Lee Message #66393, posted by Phlamethrower at 13:11, 3/6/2005, in reply to message #66320
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
Tsk, pesky strings getting placed in read only segments!
  ^[ Log in to reply ]
 

Acorn Arcade forums: Programming: Segfaults for dummies