/home/pedro/gdb/mygit/src/gdb/python/python.c: At global scope:
/home/pedro/gdb/mygit/src/gdb/python/python.c:106:31: error: storage size of ‘GdbMethods’ isn’t known
 static PyMethodDef GdbMethods[];
                               ^
Make GDB build with both g++ and gcc, on x86_64 Fedora 20
move exception_none to common code
mask argument not necessary
a
replace TRY_CATCH wrapper macros
Make GDB's TRY_CATCH more similar C++'s try/catch

Split TRY_CATCH into TRY and CATCH macros, so we can pass the
exception and mask to the CATCH part.

This still requires allocating an exception object on the stack, but
will allow making TRY/CATCH use real try/catch behind the scenes when
building with C++, and still use setjmp/longjmp when building in C
mode.  This means that we can push this change and fix call sites
before we can build the whole of GDB as C++.

Add END_CATCH

This allows creating an exception object local to the CATCH block,
thus allows getting rid of the manually allocated exception object all
over the place.  One we require a C++ compiler, END_CATCH can be
eliminated again.

This patch converts the framework, but doesn't adjust any caller yet.
Subsequent patches will do that.
a
TRY_CATCH calls to TRY+CATCH

This converts TRY_CATCH callers that look like this:

~~~
  volatile gdb_exception ex;

  TRY_CATCH (ex, RETURN_MASK_ERROR)
    {
    }
  if (ex.reason < 0)
    {
    }
~~~

into:

~~~
  TRY
    {
    }
  CATCH (ex, RETURN_MASK_ERROR)
    {
    }
  END_CATCH
~~~

Thus getting rid of the local volatile exception object, and declaring
the caught exception in the catch block.

This allows reimplementing TRY/CATCH in terms of C++ exceptions when
building in C++ mode, while still allowing to build GDB in C mode.

After this patch, is it _not_ valid to have code between the
TRY and the CATCH blocks, like:

  TRY
    {
    }

  // some code here.

  CATCH (ex, RETURN_MASK_ERROR)
    {
    }
  END_CATCH

Just like it wouldn't be valid with C++'s try/catch.

END_CATCH is necessary because we name the exception object in the
CATCH block, which requires creating a scope, which in turn must be
closed somewhere.  Declaring the exception variable in the initializer
field of a for block, like:

  #define CATCH(EXCEPTION, mask) \
    for (struct gdb_exception EXCEPTION; \
         exceptions_state_mc_catch (&EXCEPTION, MASK); \
	 EXCEPTION = exception_none)

would avoid needing END_CATCH, but alas, we build with C90, which
doesn't allow declaring variables like that.

IMO, this still makes the codebase clearer, so IMO worth it even if we
weren't considering C++.

After we require C++, we can trivially sed END_CATCH away, but we'll
still need TRY/CATCH until cleanups are completely phased out --
TRY/CATCH in C++ mode will save/restore the current cleanup chain,
like in C mode, so that C++ cleanups and exceptions can coexist.
TRY_CATCH -> TRY+CATCH, the manual conversions

This fixes the cases where we're using the exception object outside of
a the CATCH block, and cases where we were using "else" after a CATCH.

FIXME: These should actually be done _before_ running the script, and
then the script rerun.
more making TRY/CATCH callers look more like real C++ try/catch blocks

All these were caught by actually making TRY/CATCH use try/catch behind the scenes

One place expects "break;" to break out of the "try" block.  I've
wrapped that with do while (0) so it still works, but perhaps tweaking
the code to not rely on "break" would be cleaner.  Look for FIXME in
the patch.
a
Make TRY/CATCH use real try/catch in C++ mode

This allows RAII and cleanups to coexist while we phase out the later
instead of requiring a flag day.
a
/home/pedro/gdb/mygit/src/gdb/target.h:753:10: error: use of enum ‘exec_direction_kind’ without previous declaration
do not increment or decrement enum types

/home/pedro/gdb/mygit/src/gdb/i386-tdep.c: In function ‘int i386_stap_parse_special_token(gdbarch*, stap_parse_info*)’:
/home/pedro/gdb/mygit/src/gdb/i386-tdep.c:4309:7: error: no match for ‘operator++’ (operand type is ‘i386_stap_parse_special_token(gdbarch*, stap_parse_info*)::<anonymous enum>’)
       ++current_state;
       ^

...

/home/pedro/gdb/mygit/src/gdb/rs6000-tdep.c:4265:18: error: no match for ‘operator++’ (operand type is ‘powerpc_vector_abi’)
/home/pedro/gdb/mygit/src/gdb/arm-tdep.c:9428:71: error: no match for ‘operator++’ (operand type is ‘arm_float_model’)
/home/pedro/gdb/mygit/src/gdb/arm-tdep.c:9465:64: error: no match for ‘operator++’ (operand type is ‘arm_abi_kind’)

...
fix remote_insert_watchpoint interface

don't forward declare enum, and use target_hw_bp_type in the target methods

We need to fix all targets, though.
ptrace: fix offsetof usage

an earlier patch did the same to gdbserver.  should split that out and
merge with this one.
/home/pedro/gdb/mygit/src/gdb/mi/mi-cmd-stack.c:363:34: error: cannot convert ‘print_values’ to ‘ext_lang_frame_args’ for argument ‘3’ to ‘ext_lang_bt_status apply_ext_lang_frame_filter(frame_info*, int, ext_lang_frame_args, ui_out*, int, int)’
rename a struct to avoid a clash

/home/pedro/gdb/mygit/src/gdb/minidebug.c: At global scope:
/home/pedro/gdb/mygit/src/gdb/minidebug.c:55:8: error: using typedef-name ‘lzma_stream’ after ‘struct’
 struct lzma_stream
        ^
In file included from /usr/include/lzma.h:281:0,
                 from /home/pedro/gdb/mygit/src/gdb/minidebug.c:28:
/usr/include/lzma/base.h:498:3: note: ‘lzma_stream’ has a previous declaration here
 } lzma_stream;
   ^