Advertisement Jump to content
  • Advertisement

codingJoe

Member
  • Content Count

    33
  • Joined

  • Last visited

Community Reputation

192 Neutral

About codingJoe

  • Rank
    Member

Personal Information

  • Interests
    Programming
  1. An additional detail about my application: it's a exe that loads and runs routines in a dll (the dll is faulty)
  2. This is the second time I run in this strange situation: My application has a memory problem (e.g. writing over the end of an array) and crashes. While looking for the error I add plenty of prints and test the application several times, with several consecutive crashes, which is normal. Then, suddenly, my application doesn't crash anymore, but runs much slower. It took me very long to realize that Windows does something with the folder that contains my application, since renaming it, and running the application again, makes it crash again as expected. It is like windows detected that a given executable is problematic and then marks its containing folder as "run slower and more tolerant mode". I am not sure if I made myself understood, but I find that behaviour very strange, and couldn't find any other way to "unmark" the folder than renaming it. Any explanation of what is going on is very welcome!
  3. oh right! Thanks for the clarification!
  4. Oops, didn't check correctly, you are right. But still, I am puzzled as to why following prints twice hello: bool func() { printf("Hello\n"); return(true); } bool a=false; a|=func(); a|=func(); printf("----\n"); a=false; a=a|func(); a=a|func(); I always thought that the rest of the function doesn't get evaluated if a is already true..
  5. The title says it. Any rational explanation as to why this is?
  6. codingJoe

    Windows stack trace

    Thanks to both of you. I tried the printf of course, and as expected, it doesn't get called in the incriminated apiFunctionX. The location where I intentionally raise an exception is at the very beginning of the first API function that is being called, i.e. apiFunctionA (actually just after setting up the exception handler). No recursive functions were called before that: simInt apiFunctionA() { SetUnhandledExceptionFilter(exceptionHandler); RaiseException( EXCEPTION_ACCESS_VIOLATION, 0, 0, 0); ... } I also tried to recompile the project with all optimizations turned off, this doesn't make a difference. My application is very large, and runs perfectly fine. Trying to run the debugger (in release mode), via qtCreator and msvc2015, I get following disassembly at the point where the exception is raised (not in RaiseException, but one level before), in apiFunctionA (but the debugger tells me it is the code for apiFunctionX): 0x7ffab6900f9a <+0x3ab7a> lea rcx,[myApp!apiFunctionX+0x6dc0 (00007ffa`b68cd1e0)] 0x7ffab6900fa1 <+0x3ab81> call qword ptr [myApp!apiFunctionX+0x4b6ce0 (00007ffa`b6d7d100)] 0x7ffab6900fa7 <+0x3ab87> xor r9d,r9d 0x7ffab6900faa <+0x3ab8a> xor r8d,r8d 0x7ffab6900fad <+0x3ab8d> xor edx,edx 0x7ffab6900faf <+0x3ab8f> mov ecx,0C0000005h 0x7ffab6900fb4 <+0x3ab94> call qword ptr [myApp!apiFunctionX+0x4b6cd8 (00007ffa`b6d7d0f8)] point where debugger paused --> 0x7ffab6900fba <+0x3ab9a> mov edx,0Eh 0x7ffab6900fbf <+0x3ab9f> lea rcx,[rbp-61h] 0x7ffab6900fc3 <+0x3aba3> call myApp!apiFunctionX+0x1911d0 (00007ffa`b6a575f0) 0x7ffab6900fc8 <+0x3aba8> nop 0x7ffab6900fc9 <+0x3aba9> call myApp!apiFunctionX+0x7490 (00007ffa`b68cd8b0) 0x7ffab6900fce <+0x3abae> mov r8d,2 0x7ffab6900fd4 <+0x3abb4> lea rdx,[myApp!apiFunctionX+0x4d8a58 (00007ffa`b6d9ee78)] 0x7ffab6900fdb <+0x3abbb> lea rcx,[rbp-31h] 0x7ffab6900fdf <+0x3abbf> call myApp!apiFunctionX+0x18fa90 (00007ffa`b6a55eb0) So I notice all those myApp!apiFunctionX in above disassembly... which appears completely wrong. I am at a loss..
  7. codingJoe

    Windows stack trace

    Thank you very much Shaarigan. I got it to work more or less correctly, using the two functions you mentioned. This basically gives me following code: LONG WINAPI exceptionHandler(PEXCEPTION_POINTERS pExceptionInfo) { unsigned int i; void * stack[100]; unsigned short frames; SYMBOL_INFO * symbol; HANDLE process; process = GetCurrentProcess(); SymInitialize(process, NULL, TRUE); frames = CaptureStackBackTrace(0, 100, stack, NULL); symbol = (SYMBOL_INFO *)calloc(sizeof(SYMBOL_INFO) + 256 * sizeof(char), 1); symbol->MaxNameLen = 255; symbol->SizeOfStruct = sizeof(SYMBOL_INFO); for (i = 0; i < frames; i++) { SymFromAddr(process, (DWORD64)(stack[i]), 0, symbol); printf("%i: %s - 0x%0X\n", frames - i - 1, symbol->Name, symbol->Address); } free(symbol); return EXCEPTION_EXECUTE_HANDLER; } I initialize the exception handler with: SetUnhandledExceptionFilter(exceptionHandler); When an exception occurs, it prints the stack backtrace, but some functions appear in that backtrace, that have never been called. How can that be? for instance: In above stack backtrace, it indicates 3 times function apiFunctionX. This cannot be for 2 reasons: That function was never called That function is not recursive Does anyone know what is going on? Thanks
  8. Hello, I am at a loss. Went through many resources, but still can't figure it out: I have a Windows, c++ MSVC 2015 application. It sometimes randomly crashes, but never in debug mode. So I want to set-up a simple stack trace during crash, so that I can better guess where the problem happened. Is it really that complicated, or am I wrong? I am talking about crashes caused by null pointer access or similar. Not exceptions. Anyone with a simple code snippet I could use? Thanks!
  9. I still can't get it to work, maybe I misunderstood something. Why does following not compile? int myCallback(float value) { return(0); } int main(int argc,char* argv[]) { boost::function<int(float)> a=myCallback; boost::function<int(float)> b=myCallback; if (a==b) // causes a compilation error { } return(0); } Or in other words: how would I have to write my code to check if a and b reference the same function?
  10. Thanks to both of you for your replies. I am aware that you cannot directly print myCallback. But I need a function that allows to extract a unique string from myCallback. The only solution I can think of right now is to keep a list of registered functions, and associate each one with a counter that gets incremented each time a new callback is registered. Thanks
  11. Hello, I have a function that looks like following: void printCallbackAddress(boost::function<void()> myCallback) { printf("%x",myCallback); } The funny thing is that it will print a different address depending where I call above function. However I always call above function with the same callback argument, i.e. the same callback function. I guess this is linked to how the boost::function is working. But how can I uniquely identify a callback passed as argument? Because I need this so that a server can "remember" which callback was registered on a client. Thanks for any input
  12. Thanks for all the good and interesting replies! I ended up by putting the replacement words into a map (with the original words as keys). And having a recursive function that splits the text into 3 parts that will be reassembled again after the middle part was replaced. Before reassembling the 3 parts, the last part will be used in a call to the same recursive function. Above works really good if the searched words have a common prefix. Thanks again!
  13. Hi, I have following problem: I need to inspect each line of a text file, and replace all words that are recognized, with alternative words. For that, I have a correspondency list like in the example below: word1,alternativeWord1, word2,alternativeWord2, ... wordN,alternativeWordN Above list has above 1000 lines. The text file has more than 10'000 lines. My current C++ algorithm is as follows: for each line in text file:     for each word in correspondency list:         std::find(line,word). If found, replace. The correspondency list can be preprocessed offline if needed, not the text file. Above works fine but is too slow. Do you have a better suggestion? Thanks
  14. Thanks for that info MadWinter! Perfect!
  15. Hello,   I have a portable C++ Qt application that does some openGl rendering in a main window. The rendering is currently still plain old OpenGL (not even with shaders), and I feel I need to move one level up by using a third-party library.   I was first thinking about Ogre, but this is heavy, and will need to be updated on a regular basis. Then I discovered three.js and I am very pleased by the simplicity of everything. The only drawback for me is that it is javascript, but I can handle this.   My question is following:   I imagine using a webbrowser Qt widget as my main window content, so that I can do the display in there via three.js and javascript. The javascript code will read the render data from my C++ application. Is this feasable? And if yes, what kind of interface will I have to use between my C++ code and the javascript code, for fast data transfer and update?   Thanks
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!