Results 1 to 4 of 4

Thread: Misaligned stack error...

  1. #1
    Join Date
    Jan 2012
    Posts
    46
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    11

    Default Misaligned stack error...

    Good afternoon --

    After a little bit of time last week I finally got an older C++ app incorporated into my Qt app and compiled correctly (went back to square one and found that I was calling the C++ app with a QString parameter but it was receiving it as a char *). So, of course the next step was to run it and immediately it exited with an error code of 1.

    Now I then had to learn the debugger and thankfully have a past in assembly programming, so it wasn't too Greek (and even brought back some old memories). The error occurred in my initial "QApplication a(argc, argv);" command where unexpectedly methods in one of the C++ classes were called, but seeing that there are a lot of memory allocation command, I thought, well, hopefully that's a correct behavior as there's nothing I've done that was calling them.

    Stepping thru the debugger I got to a call in the stack view to "misaligned_stack_error_entering_dylb_stub_bin der" function and further, in the debug log, found a "msg="mi_cmd_stack_list_frames: Not enough frames in stack." " error.

    Before heading off down an incorrect path and wasting my time, knowing what a misaligned stack is and knowing my friend's C++ app is 13 years old, would it seem like a reasonable theory that the memory allocations being performed in C++ are causing this alignment issue? He's relying on size_t quite a bit and standard C++ types and doesn't appear to have anything hard coded. If this sounds logical, are their any suggestions beyond the obvious of tearing into the memory allocations?

    Interestingly, if within Qt I create a project and only include the code from C++ app, the ensuing executable works fine at the command line, and if I compile and link at the command line it works as well.

    It might matter that I'm working on a Mac OS 10.7.4, Qt 4.8.1, and GCC...

    Thanks for any direction!

    Kodi

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: Misaligned stack error...

    can you post your the cpp file where your main() is in?
    Do you use any structs with specific mem alignment?
    Any pragmas?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jan 2012
    Posts
    46
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    11

    Default Re: Misaligned stack error...

    Thanks! I'll post shortly but I just found out it works perfectly in Windows 7....


    Kodi


    Added after 41 minutes:


    Here are the files -- double checked and while my app runs in Windows, the call to my friend's app crashes my app with an error code 1.

    main.cpp is from my app, but the others are my friends app that I'm folding into mine. There is a STRUCT but no PRAGMA.


    Kodi
    Attached Files Attached Files
    Last edited by mtnbiker66; 3rd July 2012 at 17:50.

  4. #4
    Join Date
    Jan 2012
    Posts
    46
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    11

    Default Re: Misaligned stack error...

    I'm an idiot. Whenever you incorporate a standalone app into another one it helps to remove the "exit" statement. Everything works perfectly in Windows...

Similar Threads

  1. Syncing QTextDocument's undo stack with custom undo stack
    By Dini Selimović in forum Newbie
    Replies: 0
    Last Post: 24th June 2012, 14:11
  2. A stack of QWidget
    By _Mithrandir_ in forum Qt Programming
    Replies: 2
    Last Post: 23rd May 2012, 18:00
  3. Stack object on top of one other
    By Markus_AC in forum Qt Programming
    Replies: 3
    Last Post: 23rd September 2011, 12:05
  4. QObject in stack...??
    By joseph in forum Qt Programming
    Replies: 11
    Last Post: 30th October 2007, 09:17
  5. stack
    By mickey in forum General Programming
    Replies: 7
    Last Post: 20th November 2006, 15:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.