Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Cannot catch OS exceptions

Cannot catch OS exceptions

Scheduled Pinned Locked Moved C++ Gurus
5 Posts 3 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MuratUrsavasM Offline
    MuratUrsavasM Offline
    MuratUrsavas
    wrote on last edited by
    #1

    In my setup I have a DLL from another company, which's source code is not in my hands. It's from a hardware vendor and uses an USB peripheral. I can use its full features, for both DLL and hardware. But there is a bug in the DLL which crashes if I run some functions while there is no hardware attached to the PC. In fact it does not crashes directly. It probably opens an USB endpoint but after an unsuccessful operation it tries to execute an invalid operation on that object while trying to unload the DLL.

    Since I don't have access to the source of DLL, I can not fix this bug directly. So I should be handling it in my own code. I was doing the same with try/catch using .NET but as far as I can see it's not so easy with Qt.

    How can I catch an exception thrown by OS (or from another subsystem) which can not be caught with usual "catch(...)".

    OS: Win8
    Compiler: MSVC 11.0 & MinGW 4.8.2

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stukdev
      wrote on last edited by
      #2

      Using Try Catch of c++?

      1 Reply Last reply
      0
      • MuratUrsavasM Offline
        MuratUrsavasM Offline
        MuratUrsavas
        wrote on last edited by
        #3

        Yes. I'm using C++ try/catch but unable to catch it.

        Here's the MSVC exception message under debug.

        bq. The inferior stopped because it triggered an exception.
        Stopped in thread 0 by: Exception at 0x3dc2cbea, code: 0xc0000008: , flags=0x0 (first chance).

        MinGW provides even less information.

        bq. The inferior stopped because it received a signal from the Operating System.
        Signal name : ?
        Signal meaning : Unknown signal

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andreyc
          wrote on last edited by
          #4

          Hardware exceptions do not come through C++ try/catch
          You may try to use "segvcatch library":https://code.google.com/p/segvcatch/
          It converts hardware exceptions into c++ exceptions.

          1 Reply Last reply
          0
          • MuratUrsavasM Offline
            MuratUrsavasM Offline
            MuratUrsavas
            wrote on last edited by
            #5

            Thanks andreyc. But looks like this project is not maintained and has issues. Even if it works, it wouldn't help to this problem.

            There is also a similar project called "libsigsegv":http://www.gnu.org/software/libsigsegv/ and it tries to solve similar exceptions in *nix OSes. But again, no luck with my problem.

            Thanks again.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved