If you run the command-line version of unrar it logs out vital information when an archive fails to extract.
I'm trying to do the same thing with the unrar DLL.
I've already had to make some changes to the DLL source code to support registering my own callback to handle extraction progress properly.
Now I want to handle error reporting properly.
There is really no documentation on using unrar source.
So I have a working callback function that can be called
CommandData *Cmd
Cmd->ErrorCallback(ERAR_BAD_DATA, Arc.FileName, ArcFileName);
The function works great if I call it next to my progress DLL (so I know the callback works), but I just can't figure out where the errors are being handled.
Specifically I'm after handling the code ERAR_BAD_DATA which I found is handled in extract.cpp ... but that code just doesn't seem to get run.
I also found some calls to RarErrorToDll ... I put the callback there too, nothing.
Any help would be hugely appreciated.
for a bit of context, this is what I was previously doing to catch errors.
bool archiveCorrupt = false;
while((read_header_code = RARReadHeader(archive_data, &header_data)) == 0)
{
process_file_code = RARProcessFile(archive_data, RAR_EXTRACT, m_output_dir, NULL);
if(process_file_code)
{
qDebug() << "Error extracting volume!"
<< header_data.ArcName << " "
<< " with error: " << process_file_code;
archiveCorrupt = true;
break;
}
}
The reason this approach doesn't work is that the error code process_file_code tells you what went wrong, but the archive name in header_data.ArcName is the archive that the file started in, not necessarily where the corruption was. I'm dealing with multi-part archives where one large file will span multiple archives ... so I need to know which archive(s) is corrupt, not just the archive the file started in.
EDIT:
Here is a link to the unrar source code
So I've discovered a place in extract.cpp line 670 that I can place the callback and it does return an error code to my app.
ErrHandler.SetErrorCode(RARX_CRC);
#ifdef RARDLL
Cmd->ErrorCallback(RARX_CRC, Arc.FileName, ArcFileName);
However, this has the same issue as before, where it returns the error at the end of processing the file extracting, rather than at the place where the CRC fails.
If I run the unrar command-line app that you can download from the rarlabs site, it seems to handle it properly and returns the correct error. I can't find text for those errors anywhere in the unrar source, so I can only assume that the unrar source doesn't actually build the unrar app they publish on their site.
Extracting from SL - Cinematic Guitars.part02.rar
... SL - Cinematic Guitars/Cinematic Guitars/Samples/Cinematic Guitars_001.nkx 16%
SL - Cinematic Guitars/Cinematic Guitars/Samples/Cinematic Guitars_001.nkx : packed data CRC failed in volume SL - Cinematic Guitars.part02.rar
I eventually found the answer, after lots of trial and error.
My issue was, I was comparing an old command line version of unrar to the newer source code when looking for the error messages.
The error message has changed in the new source code and is now
packed data checksum error in volume
This is defined in loclang.hpp and called from uiconsole.cpp in the function uiMsgStore:Msg when the error code is UIERROR_CHECKSUMPACKED
This gets called from volume.cpp on line 25
I have added my callback here, and it catches the error perfectly.
I hope this helps someone else if they ever have the misfortune of having to hack unrar source code.
Related
Been working on a lipsync project on UE4.27 and the Oculus OVRlipsync and the project has been working very well on UE editor. Packaging the game to ship it to the client, I started facing issues that is related on cooking frame sequence from WAV files resulting in crash in the packaged app.
The resulted crash log is
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000024bc963002c
OVRLipSync
OVRLipSync
OVRLipSync
OVRLipSync
MyProject_Win64_Shipping!ovrLipSync_ProcessFrameEx() [\software\coretech\src\engines\tracking\facetracking\facewave\ovrlipsyncshim.cpp:389]
MyProject_Win64_Shipping!<lambda_04cfcd2176d25e5a0c33289e1c33f647>::operator()() [D:\Unreal Projects\Lipsync\fix2\MyProject\Plugins\OVRLipSync\Source\OVRLipSync\Private\CreateFrameSequenceAsset.cpp:79]
MyProject_Win64_Shipping!TAsyncRunnable<void>::Run()
MyProject_Win64_Shipping!FRunnableThreadWin::Run()
Tracing the error at CreateFrameSequenceAsset.cpp:79 which was part of the plugin source code I found the following function
context.ProcessFrame(PCMData + offs, ChunkSizeSamples, Visemes, LaughterScore, FrameDelayInMs,NumChannels > 1);
putting efforts back on the declaration and definition of the function found nothing useful, except that I tried looking up the file ovrlipsyncshim.cpp and found nothing so I tried searching my project for ProcessFrameEx() I found another part of it in /ThirdParty/Include/OVRLipSync.h as follows
ovrLipSyncResult ovrLipSync_ProcessFrameEx(
ovrLipSyncContext context,
const void* audioBuffer,
int sampleCount,
ovrLipSyncAudioDataType dataType,
ovrLipSyncFrame* pFrame);
though tracing all this up couldn't find anything useful to handle the exception or tell the cause of it.
Anyone ever faced such a problem or having any experience solving such an issue
I had the same issue. I've changed a line in OvrLipSyncEditorModule.cpp:
From:
UOVRLipSyncContextWrapper context(ovrLipSyncContextProvider_Enhanced, SampleRate, 4096, ModelPath);
To:
UOVRLipSyncContextWrapper context(ovrLipSyncContextProvider_Enhanced, SampleRate, 8192, ModelPath);
(basically I've increased the buffer size)
And I've also added this line:
SoundWave->LoadingBehavior = ESoundWaveLoadingBehavior::ForceInline;
before the call:
DecompressSoundWave(SoundWave);
Now it doesn't crash anymore and it generates a sequence, but when I attach the sequence to the model, it does nothing.. It's weird, it seems to not be a working sequence even though I've checked and the sequence is not empty.
The Point Cloud library comes with an executable pcl_hdl_viewer_simple that I can run (./pcl_hdl_viewer_simple) without any extra arguments to get live data from a Velodyne LIDAR HDL32.
The source code for this program is supposed to be hdl_viewer_simple.cpp. A simplified version of the code is given on this page which cannot be compiled readily and requires a tiny bit of tweaking to make it compile.
My problem is that the executable that I build myself for both the versions are not able to run. I always get the smart pointer error "Assertion px!=0" error. I am not sure if I am not executing the program in the correct way or what. The executable is supposed to be executed like
./hdl_viewer_simple -calibrationFile hdl32calib.xml -pcapFile file.pcap
in case of playing from previously recorded PCAP files or just ./hdl_viewer_simple if wanting to get live data from the real sensor. However, I always get the assertion failed error.
Has anyone been able to run the executables? I do not want to use the ROS drivers
"Assertion px!=0" is occurring because your pointer is not initialized.
Now that being said, you could initialize it inside your routines, in case the pointer is NULL, especially for data input.
in here, you can try updating the line 83 like this :
CloudConstPtr cloud(new Cloud); //initializing your pointer
and hopefully, it will work.
Cheers,
I am facing error while compiling bitcoin-qt application, I didn't understand what is the problem in main.cpp.
The error:
/main.cpp:2985: bool InitBlockIndex(): Assertion `block.hashMerkleRoot
== uint256("0x7c0b21983dc5a17daeef4b6b936375b0a59f3414af7a1bf248d98209447a494b")'
failed.
The program has unexpectedly finished.
what is the problem? Please give some advice to resolve this problem.
Have you tried this solution?
https://bitcoin.stackexchange.com/questions/21303/creating-genesis-block
The first time you run the compiled code (daemon or qt), it will say
"assertion failed". Just exit the program, go to config dir (under
AppData/Roaming), open the debug.log, get the hash after
"block.GetHash() = ", copy and paste it to the beginnig of main.cpp,
hashGenesisBlock. Also get the merkle root in the same log file, paste
it to the ... position in the following code, in LoadBlockIndex()
assert(block.hashMerkleRoot == uint256("0x...")); recompile the code,
and genesis block created!
BTW, don't forget to change "txNew.vout[0].nValue = " to the coin per
block you defined, it doesn't matter to leave as 50, just be
consistent with your coin per block (do this before adjust the hash
and m-root, otherwise they will be changed again).
check https://bitcointalk.org/index.php?topic=225690.0 for complete
info
It's for an altcoin, but it seems you've some problem with the genesis block.
i have a project in C++/MFC
when i run its in debug mode and project crashed
i can get function and line number of code
with SetUnhandledExceptionFilter function
but in release mode i can not get it
i am test this function and source
_set_invalid_parameter_handler msdn.microsoft.com/en-us/library/a9yf33zb(v=vs.80).aspx
StackWalker http://www.codeproject.com/KB/threads/StackWalker.aspx
MiniDumpReader & crashrpt http://code.google.com/p/crashrpt/
StackTracer www.codeproject.com/KB/exception/StackTracer.aspx
any way to get function and line of code when project crashed in release mode
without require pdb file or map file or source file ?
PDB files are meant to provide you this information; the flaw is that don't you want a PDB file. I can understand not wanting to release the PDB to end users, but in that case why would you want them to see stack trace information? To me your goal is conflicting with itself.
The best solution for gathering debug info from end users is via a minidump, not by piecing together a stack trace on the client.
So, you have a few options:
Work with minidumps (ideal, and quite common)
Release the PDBs (which won't contain much more info than you're already trying to deduce)
Use inline trace information in your app such as __LINE__, __FILE__, and __FUNCTION__.
Just capture the crash address if you can't piece together a meaningful stack trace.
Hope this helps!
You can get verbose output from the linker that will show you where each function is placed in the executable. Then you can use the offset from the crash report to figure out which function was executing.
In release mode, this sort of debugging information isn't included in the binary. You can't use debugging information which simply isn't there.
If you need to debug release-mode code, start manually tracing execution by writing to a log file or stdout. You can include information about where your code appears using __FUNCTION__ and __LINE__, which the compiler will replace with the function/line they appear in/on. There are many other useful predefined macros which you can use to debug your code.
Here's a very basic TR macro, which you can sprinkle through out your code to follow the flow of execution.
void trace_function(const char* function, int line) {
std::cout << "In " << function << " on line " << line << std::endl;
}
#define TR trace_function(__FUNCTION__, __LINE__)
Use it by placing TR at the top of each function or anywhere you want to be sure the flow of execution is reaching:
void my_function() {
TR();
// your code here
}
The best solution though, is to do your debugging in debug mode.
You can separate the debug symbols so that your release version is clean, then bring them together with the core dump to diagnose the problem afterwards.
This works well for GNU/Linux, not sure what the Microsoft equivalent is. Someone mentioned PDB...?
I use boost's binary serialization and it worked well until now. I have std::list of pointers to serialize for output (oarchive) but serialization fails inside object's serialize() function with MSVC's dialog:
R6010 -abort() has been called
and such string is printed into console window:
Assertion failed: 0 == static_cast<int>(t) || 1 == static_cast<int>(t), file c:\program files\boost\boost_1_44\boost\archive\basic_binary_oprimitive.hpp, line 91
what does it mean?
Project is pretty big, sources are distributed so I cannot post it's code here, but I tried to simulate this error within simple project - there it works fine what is strange.
P.S. I use boost 1.44 with MSVC2010EE on Windows XP. When I click "retry" on "Debug Error!" window debugger shows arrow on the code line next to serialization archive << myList; line - I mean it seems like error occurred at some destructor or something.
When I make changes inside objects serialize() function - they will be applied just when I rebuild whole project (clean before compiling) - but if I just compile it (where IDE shows that all sources which include changed header are recompiled) - no changes will happen at runtime since last version (I tried with printf()) - that's strange.
Could I occasionally set some critical definitions or something?
The line in question says:
// trap usage of invalid uninitialized boolean which would
// otherwise crash on load.
It looks like at some point you are trying to serialize a bool that hasn't been initialized. Without further code we can't help you find which one.