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

Caboosium

Well-Known Member
OP
Newcomer
Joined
Jan 19, 2018
Messages
48
Trophies
0
Age
20
Location
Planet Reach
XP
344
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
35,955
Trophies
3
Website
trastindustries.com
XP
26,547
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
20
Location
Planet Reach
XP
344
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,723
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,934
Trophies
2
XP
2,402
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.
 

You may also like...

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: *Surgeon general's warning, if you see someone eating this run away.