Homebrew Had a crash... Little help recovering code?

Caboosium

Well-Known Member
OP
Newcomer
Joined
Jan 19, 2018
Messages
48
Trophies
0
Age
21
Location
Planet Reach
XP
354
Country
United States
Okay so I was coding in Notepad++ and it crashed after I hit save(CTL+S). Now the file main.cpp has nothing in it. I do how ever have a "main.a", "main.d" and a "app.map" from a build of the code. I looked into the main.a and found what looks like bits and pieces of my code.

Is there anyway to use those files and turn them back into a main.cpp?
 
D

Deleted User

Guest
This seems like the wrong place to ask such a question. But, as far as I can tell, Notepad++ does not automatically save backups of your files; sorry. I'm not too experienced with C++, so I'm not sure if it's possible to recreate your document with parts of other files. My bets are on accomplishing such a feat being difficult, if not impossible. Hopefully someone with more knowledge can step in as well.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,348
Country
United Kingdom
Usual thing of did you email it to someone, stick it on a USB drive, commit to another source

.a files might be able to be extracted with the AR command
http://sourceware.org/binutils/docs/binutils/ar-cmdline.html
What you might get back from it I do not know but it unlikely to be the whole file.

Strides are being made into C and C++ decompilation but it is not really something I can point you are like I might for Java, C# or similar languages. Even with such a thing your comments, labels and other things are not going to come back.

In any case it will probably be easier to remake it. Hopefully you can remember the broad strokes, and maybe have something jogged but what you have remaining.

Also "backups, keep them". This is your lesson in it.
Equally you might want to consider starting to kick things to other files -- I usually go with if the main is more than the start, libs, calls to whatever and exit routines it had better be an extremely simple program.

It is odd that notepad++ did this though, while it is far from stable at times this is very new to me. Are you using some odd plugins?
 

Caboosium

Well-Known Member
OP
Newcomer
Joined
Jan 19, 2018
Messages
48
Trophies
0
Age
21
Location
Planet Reach
XP
354
Country
United States
Usual thing of did you email it to someone, stick it on a USB drive, commit to another source

.a files might be able to be extracted with the AR command
http://sourceware.org/binutils/docs/binutils/ar-cmdline.html
What you might get back from it I do not know but it unlikely to be the whole file.

Strides are being made into C and C++ decompilation but it is not really something I can point you are like I might for Java, C# or similar languages. Even with such a thing your comments, labels and other things are not going to come back.

In any case it will probably be easier to remake it. Hopefully you can remember the broad strokes, and maybe have something jogged but what you have remaining.

Also "backups, keep them". This is your lesson in it.
Equally you might want to consider starting to kick things to other files -- I usually go with if the main is more than the start, libs, calls to whatever and exit routines it had better be an extremely simple program.

It is odd that notepad++ did this though, while it is far from stable at times this is very new to me. Are you using some odd plugins?
New install, no plugins.
 

SimonMKWii

Professional Idiot
Member
Joined
Nov 18, 2017
Messages
666
Trophies
0
Location
Melbourne, Victoria
XP
2,760
Country
Australia
Okay so I was coding in Notepad++ and it crashed after I hit save(CTL+S). Now the file main.cpp has nothing in it. I do how ever have a "main.a", "main.d" and a "app.map" from a build of the code. I looked into the main.a and found what looks like bits and pieces of my code.

Is there anyway to use those files and turn them back into a main.cpp?
I'd like to take a look at the .map file (or all of them) if possible! The .map is the crash dump and will give me some helpful information.
 

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
1) I think so, but you need the arm9 executable, the (arm9) entrypoint, the stack settings and some real good disassembler (like IDA Pro), and know beforehand how to use them. You may want to ask around #3dsdev for disassembling that.

2) As it is, this is the closest you will get. It wasn´t that much of a loss, because I think what the code did was to read some numbers into a file, retrieve them and print results. Nothing you can not re-do.

3) Use svn or git and publish code in there, without it I wouldn´t be able to get that far in ToolchainGenericDS, newlib nano and other stuff.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • K3Nv2 @ K3Nv2:
    I'll reformat and have a 3tb raid0 m. 2 at least
    +1
  • K3Nv2 @ K3Nv2:
    Lmao that sold out fast
    +1
  • Veho @ Veho:
    Yeet the cat.
    +1
  • K3Nv2 @ K3Nv2:
    Good idea
    +1
  • The Real Jdbye @ The Real Jdbye:
    i thought everybody knew cocktails are like 75% ice
  • Veho @ Veho:
    Yeah but not like this.
  • Veho @ Veho:
    It's not like they're complaining that their Slurpee is 99% ice or something, but if the cocktail calls for "shot of vodka, shot of vermouth, shot of gin, shot of Campari, three shots of juice, squirt of lemon" and ends up being a thimbleful of booze, that's a problem.
  • The Real Jdbye @ The Real Jdbye:
    the funny thing is cocktails in norway are only allowed to have 1 20ml shot of booze
  • The Real Jdbye @ The Real Jdbye:
    so..... yeah
  • The Real Jdbye @ The Real Jdbye:
    we're used to only having a thimbleful of booze
  • Veho @ Veho:
    Booo.
  • The Real Jdbye @ The Real Jdbye:
    same thing if you want whisky on the rocks or something, you can't get a double
  • The Real Jdbye @ The Real Jdbye:
    but you could buy as many shots of whisky (or anything else) as you want and ask for a glass of ice and pour them in
  • The Real Jdbye @ The Real Jdbye:
    it's dumb
  • Veho @ Veho:
    Maybe.
  • Veho @ Veho:
    There was a comparison of the number of Ibuprofen poisonings before and after they limited the maximum dosage per box or per pill (i'll look that up). No limit on the number of boxes you can still buy as many as you want, so people argued it was pointless.
  • Veho @ Veho:
    But the number of (accidental) poisonings dropped because drinking an entire package of ibuprofen pills went from "I need a new liver" to "I need a new box of Ibuprofen".
  • Veho @ Veho:
    Here we have ketoprofen that used to be prescription-only because of the risk of toxic dosages, but then they halved the dose per pill and sell them in bottles of six pills apiece instead of twenty and it doesn't need a prescription any more. Yes you can buy more than one bottle but people simply don't.
  • Psionic Roshambo @ Psionic Roshambo:
    Usually accidentally overdose of ibuprofen here is from people taking like cold medicine then ibuprofen for a headache and the combination is over what they need
    Veho @ Veho: https://imgur.com/gallery/QQkYnQu