Page 2 of 2 FirstFirst 12
Results 21 to 30 of 30

Thread: Cannot access memory at address 0x0

  1. #21
    Join Date
    Jan 2008
    Posts
    21
    Thanks
    3

    Default Re: Cannot access memory at address 0x0

    I think so as well. It only happens when I debug, yes.

    Edit: aaargh, I downloaded gdb 6.7, compiled it, installed it, verified its version, tried to debug and yes, you can guess it alright. argc=cannot access mem at 0x0
    So with a newer version it still acts weird... Might be some ubuntu issue still, I think.
    Last edited by defumar; 26th January 2008 at 19:41.

  2. #22
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cannot access memory at address 0x0

    gdb might only reveal the real problem which might be completely elsewhere. For instance in debug symbols of Qt or libc or some other library.

  3. #23
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Cannot access memory at address 0x0

    Probably your qt build is corrupt i think. I closely looked at QApplication constructor and it uses
    int reference for argc parameter. I dont know whether this is the problem or not but can you tell me where it crashes if you try the below program.

    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. int k = argc + 1;
    4. int l = argc;
    5. QApplication app(argc, argv);
    6. //also try QApplication(l, argv);
    7. return 0;
    8. }
    To copy to clipboard, switch view to plain text mode 

    Also pay attention to this qapplication doc
    Initializes the window system and constructs an application object with argc command line arguments in argv.

    Warning: The data pointed to by argc and argv must stay valid for the entire lifetime of the QApplication object.

    The global qApp pointer refers to this application object. Only one application object should be created.

    This application object must be constructed before any paint devices (including widgets, pixmaps, bitmaps etc.).

    Note that argc and argv might be changed. Qt removes command line arguments that it recognizes. The original argc and argv can be accessed later with arguments().
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

  4. #24
    Join Date
    Jan 2008
    Posts
    21
    Thanks
    3

    Default Re: Cannot access memory at address 0x0

    okay I tried both things and both of them got corrupted after the QApplication ctor (both having argc=cannot access 0x0)

  5. #25
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cannot access memory at address 0x0

    The problem is clearly within gdb. If it was your application that was crashing you'd receive a different message from the debugger. Look that the "cannot access 0x0" message is received while the debugger tries to print the content of argc and not when executing any code from your application. The application doesn't crash when you don't debug it, so there is nothing wrong with it. Your debugger doesn't like your Qt installation or it doesn't like itself or your system. Either way your application is correct.

  6. #26
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Cannot access memory at address 0x0

    Oh i just can't believe this! Even gdb on my comp shows the same thing for any program i debug(wysota, i tried your chip program )

    And i use kubuntu.
    Probably you are right wysota.
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

  7. #27
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cannot access memory at address 0x0

    For the record - for me GDB works just fine

  8. #28
    Join Date
    Jan 2008
    Posts
    21
    Thanks
    3

    Default Re: Cannot access memory at address 0x0

    okay, so I installed SUSE 10.3 and on this one I get argc=1 before executing the ctor and argc=4 after executing the ctor and before exitting the function, according to gdb, is this correct or am I haunted?

  9. #29
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cannot access memory at address 0x0

    Could be. QApplication takes its arguments by reference, so it is likely that it modifies them.

  10. #30
    Join Date
    Jan 2008
    Posts
    21
    Thanks
    3

    Default Re: Cannot access memory at address 0x0

    goodie, thanks for all the help

Similar Threads

  1. Memory leak weirdness
    By Darhuuk in forum General Programming
    Replies: 10
    Last Post: 10th January 2008, 18:51
  2. Memory Leak in my Application :-(
    By Svaths in forum Qt Programming
    Replies: 4
    Last Post: 27th July 2007, 19:42
  3. what is free store in C++ memory?
    By Masih in forum General Programming
    Replies: 6
    Last Post: 2nd July 2007, 22:25
  4. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 22:14

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.