Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7052897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:26:20+00:00 2026-05-28T03:26:20+00:00

I have GDB attached to a process that is currently inside a catch(…) block.

  • 0

I have GDB attached to a process that is currently inside a catch(...) block.

Is there a known technique to access that thrown exception?

The program in question is a gcc/x86-64 binary, but I’m also curious about other builds.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:26:21+00:00Added an answer on May 28, 2026 at 3:26 am

    As you say, you can re-throw it, so you can re-throw it inside another try/catch block with more specific clauses to extract the exception (and another ... if you want as well). You can even do this inside another function so you can centralize your exception handling.

    Edit: I misunderstood the importance of gdb in your question, but you can apply the idea I described. Make a function that re-throws the exception you can set a breakpoint in:

    void
    helper()
    {
        try {
            throw;
        } catch (int i) {
            // anything that won't get optimized away
            volatile int j = i;  // breakpoint here
        }
    }
    

    Then in gdb just do call helper(). I just tested this to be sure it worked.

    Further edit: If you literally mean I’m running a program under gdb right now and you are not exiting gdb until you are sure you can’t get the exception, then it’s time to look at eh_throw.cc and friends in the gcc source. __cxa_rethrow starts with:

      __cxa_eh_globals *globals = __cxa_get_globals ();
      __cxa_exception *header = globals->caughtExceptions;
    

    You will have to examine all of those structures to figure out what’s buried inside.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have installed GDB on AIX 6.1 (gdb-6.0-1.aix5.1.ppc_AIX.rpm) and I notice that there is
Through GDB I have determined that the segfault is occuring somewhere in this block
I have GDB attached to a deadlocked application written with pthreads. There are ~10
I'm outside gdb's target executable and I don't even have a stack that corresponds
I've run into some problems debugging a multi-threaded process using GDB. I have a
I have a C++ Android application that I'm trying to debug with ndk-gdb. The
I have looked through GDB documentation, but haven't found anything that works or shows
I have a custom build of gcc/gdb that I'm trying to integrate with an
I have run gdb, as my code show segfault. I understand that the code
I'm writing an application that uses GDB to access information through java. Using Runtime.getRuntime.exec,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.