For C++
program with try
catch
defined, when using g++
to compile it into assembly code (test is on x86 32bit Linux, g++
4.6.3)
g++ -S cppexcept.cc
A specified section called .gcc_except_table
is produced like below:
.section .gcc_except_table
.align 4
.LLSDA980:
.byte 0xff
.byte 0
.uleb128 .LLSDATT980-.LLSDATTD980
.LLSDATTD980:
.byte 0x1
.uleb128 .LLSDACSE980-.LLSDACSB980
.LLSDACSB980:
.uleb128 .LEHB3-.LFB980
.uleb128 .LEHE3-.LEHB3
.uleb128 0
.uleb128 0
.uleb128 .LEHB4-.LFB980
.uleb128 .LEHE4-.LEHB4
.uleb128 .L19-.LFB980
.uleb128 0x3
.uleb128 .LEHB5-.LFB980
.uleb128 .LEHE5-.LEHB5
.uleb128 0
.uleb128 0
.uleb128 .LEHB6-.LFB980
.uleb128 .LEHE6-.LEHB6
.uleb128 .L20-.LFB980
.uleb128 0
.uleb128 .LEHB7-.LFB980
.uleb128 .LEHE7-.LEHB7
.uleb128 .L21-.LFB980
.uleb128 0
After the compilation into exe file
with ELF
format, it seems that there are two sections related to exception handling, which are .gcc_except_table
and .eh_frame
.
However, I dumped the contents of these two section with the following commands, comparing the labels' memory addresses with what are defined in .gcc_except_table
, but it seems too blur to me...
objdump -s -j .gcc_except_table cppexcept
objdump -s -j .eh_frame cppexcept
So my question is:
Is there any way to recover the information defined in the .gcc_except_table
(which is shown above) from ELF
file's .gcc_except_table
and eh_frame
tables?