Results 1 to 7 of 7

Thread: Compiler Writing in C++...core dump :S

  1. #1
    HEXUS.social member finlay666's Avatar
    Join Date
    Aug 2006
    Location
    Newcastle
    Posts
    8,546
    Thanks
    297
    Thanked
    894 times in 535 posts
    • finlay666's system
      • CPU:
      • 3570k
      • Memory:
      • 16gb
      • Graphics card(s):
      • 6950 2gb
      • Case:
      • Fractal R3
      • Operating System:
      • Windows 8
      • Monitor(s):
      • U2713HM and V222H
      • Internet:
      • cable

    Compiler Writing in C++...core dump :S

    Lowdown so far:
    Writing a compiler in C++ to parse C-- (cut down C code) and later SCL via hopefully some minor modification
    Outputs the code in 68k (suitable to use with a linux based 68k emulator (name escapes me right now))
    Using Red Hat for the main writing and compiling using my own makefile etc.

    I have got to the syning point now, where the main analysis of the code takes place.....unfortunately I appear to be getting a fair few 'core dumps', this WAS caused before by badly written code with pointers set to null.... those problems were fixed now it still throws up 10 or 11 on a 62 item test

    I can supply the main area giving the problems if it is of any help, really want to get this working well as I would like to include it in my portfolio if possible (currently a uni project, I want to add bells and whistles over christmas though)
    H3XU5 Social FAQ
    Quote Originally Posted by tiggerai View Post
    I do like a bit of hot crumpet

  2. #2
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts

    Re: Compiler Writing in C++...core dump :S

    Your question is a little specialised I don't know what help you expect to receive from this forum. Also I don't recall ever asking for help on forums re anything academic on the internet. Give it a shot - IMHO.
    To err is human. To really foul things up ... you need a computer.

  3. #3
    Comfortably Numb directhex's Avatar
    Join Date
    Jul 2003
    Location
    /dev/urandom
    Posts
    17,074
    Thanks
    228
    Thanked
    1,027 times in 678 posts
    • directhex's system
      • Motherboard:
      • Asus ROG Strix B550-I Gaming
      • CPU:
      • Ryzen 5900x
      • Memory:
      • 64GB G.Skill Trident Z RGB
      • Storage:
      • 2TB Seagate Firecuda 520
      • Graphics card(s):
      • EVGA GeForce RTX 3080 XC3 Ultra
      • PSU:
      • EVGA SuperNOVA 850W G3
      • Case:
      • NZXT H210i
      • Operating System:
      • Ubuntu 20.04, Windows 10
      • Monitor(s):
      • LG 34GN850
      • Internet:
      • FIOS

    Re: Compiler Writing in C++...core dump :S

    enable core dumping, and analyse the core files to see where exactly your memory is leaking

  4. Received thanks from:

    finlay666 (13-12-2007)

  5. #4
    Agent of the System ikonia's Avatar
    Join Date
    May 2004
    Location
    South West UK (Bath)
    Posts
    3,736
    Thanks
    39
    Thanked
    75 times in 56 posts

    Re: Compiler Writing in C++...core dump :S

    gdb is your friend, however be VERY aware that redhat and fedora's gcc is patched with quite a few propritary patches which also effects redhat's glibc and binutils builds and thus will effect anything you build with them.

    My advice would be to either

    a.) build your own tool chain and gcc (assuming your using gcc) build
    b.) have a second distro ubuntu/debian for example to validate your errors, I use ubuntu/debian as an example as a much more vanilla gcc build is used now.
    It is Inevitable.....


  6. Received thanks from:

    finlay666 (13-12-2007)

  7. #5
    HEXUS.social member finlay666's Avatar
    Join Date
    Aug 2006
    Location
    Newcastle
    Posts
    8,546
    Thanks
    297
    Thanked
    894 times in 535 posts
    • finlay666's system
      • CPU:
      • 3570k
      • Memory:
      • 16gb
      • Graphics card(s):
      • 6950 2gb
      • Case:
      • Fractal R3
      • Operating System:
      • Windows 8
      • Monitor(s):
      • U2713HM and V222H
      • Internet:
      • cable

    Re: Compiler Writing in C++...core dump :S

    Quote Originally Posted by ikonia View Post
    gdb is your friend, however be VERY aware that redhat and fedora's gcc is patched with quite a few propritary patches which also effects redhat's glibc and binutils builds and thus will effect anything you build with them.

    My advice would be to either

    a.) build your own tool chain and gcc (assuming your using gcc) build
    b.) have a second distro ubuntu/debian for example to validate your errors, I use ubuntu/debian as an example as a much more vanilla gcc build is used now.
    My uni isn't exactly full of common sense...GDB is DISABLED on all their computers, so I used Ubuntu via virtual machine to allow me to debug it

    Found out the problem now, was a rogue null pointer (was in the template code which is why I missed it, I never wrote it in so never checked it

    Just onto writing the compile to read in SCL (weird language...kindof like Haskell) instead of C--, PITA to sort as the C-- syntax in order of declarations etc is very different...doesn't help that the lecturer is 'old school' and keeps using crappy C functions when a C++ one is better suited and easier for us to use.

    Now all I have to do right now is figure out how to read in a float (potentially with a power sign) from a stream using
    Code:
    scanf(infile, '%e', tempfloat);
    function, tried a load of different methods (infile is a pointer to the file being read in for each test

    Really annoying as the lecturer thinks "RTFHF" (HF being header file) for a file we are not allowed to view is acceptable commenting (our files utilise it in the building via a makefile) .......luckily the course rep is going to bring it up later, hopefully as we are the first year to actually build the compiler (last year it was just an exam based on it) things will change for future years
    H3XU5 Social FAQ
    Quote Originally Posted by tiggerai View Post
    I do like a bit of hot crumpet

  8. #6
    The King of Vague Steve B's Avatar
    Join Date
    Oct 2005
    Location
    Glasgow
    Posts
    5,051
    Thanks
    116
    Thanked
    67 times in 63 posts

    Re: Compiler Writing in C++...core dump :S

    Quote Originally Posted by finlay666 View Post
    Really annoying as the lecturer thinks "RTFHF" (HF being header file) for a file we are not allowed to view is acceptable commenting (our files utilise it in the building via a makefile) .......luckily the course rep is going to bring it up later, hopefully as we are the first year to actually build the compiler (last year it was just an exam based on it) things will change for future years
    Could you not to a null scan to rip everything to a tempstring, then print that to a new file?
    That way you can view a copy of the .h file?

  9. #7
    HEXUS.social member finlay666's Avatar
    Join Date
    Aug 2006
    Location
    Newcastle
    Posts
    8,546
    Thanks
    297
    Thanked
    894 times in 535 posts
    • finlay666's system
      • CPU:
      • 3570k
      • Memory:
      • 16gb
      • Graphics card(s):
      • 6950 2gb
      • Case:
      • Fractal R3
      • Operating System:
      • Windows 8
      • Monitor(s):
      • U2713HM and V222H
      • Internet:
      • cable

    Re: Compiler Writing in C++...core dump :S

    It's done now, no point looking at it as it was for C-- and the bit we need for SCL we now have.

    Trying to get a struct for doing floats working but I cant get the stupid thing working...too tired to get my head around it properly I think
    H3XU5 Social FAQ
    Quote Originally Posted by tiggerai View Post
    I do like a bit of hot crumpet

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. PSU Calculator
    By Hullz-Modz in forum PC Hardware and Components
    Replies: 146
    Last Post: 10-04-2008, 07:07 PM
  2. Windows - a brief guide inside
    By Paul Adams in forum Software
    Replies: 31
    Last Post: 23-06-2007, 03:14 PM
  3. Problem with Nero
    By deathsith in forum Help! Quick Relief From Tech Headaches
    Replies: 2
    Last Post: 15-06-2007, 09:24 AM
  4. 3 degree temp difference between each core on my E6400??!
    By JamieS in forum PC Hardware and Components
    Replies: 9
    Last Post: 12-02-2007, 01:31 PM
  5. Dual core and all that - enlighten me please
    By iranu in forum PC Hardware and Components
    Replies: 11
    Last Post: 22-03-2005, 03:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •