Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • opensrc/libehp
1 result
Show changes
Commits on Source (5)
......@@ -17,24 +17,23 @@
import os
Import('env')
myenv=env.Clone();
myenv.Replace(debug=ARGUMENTS.get("debug",0))
myenv.Append(CFLAGS=" -DUSE_ELFIO=1 ")
myenv.Append(CXXFLAGS=" -DUSE_ELFIO=1 ")
if int(myenv['debug']) == 1:
env.Replace(debug=ARGUMENTS.get("debug",0))
env.Append(CFLAGS=" -DUSE_ELFIO=1 ")
env.Append(CXXFLAGS=" -DUSE_ELFIO=1 ")
if int(env['debug']) == 1:
print "Setting debug mode"
myenv.Append(CFLAGS=" -g ")
myenv.Append(CXXFLAGS=" -g ")
myenv.Append(LINKFLAGS=" -g ")
env.Append(CFLAGS=" -g ")
env.Append(CXXFLAGS=" -g ")
env.Append(LINKFLAGS=" -g ")
else:
print "Setting release mode"
myenv.Append(CFLAGS=" -O3 ")
myenv.Append(CXXFLAGS=" -O3 ")
myenv.Append(LINKFLAGS=" -O3 ")
env.Append(CFLAGS=" -O3 ")
env.Append(CXXFLAGS=" -O3 ")
env.Append(LINKFLAGS=" -O3 ")
lib=myenv.SConscript("src/SConscript")
lib=env.SConscript("src/SConscript")
Return('lib')
......@@ -19,6 +19,9 @@
env=Environment()
Export('env')
env.Replace(debug=ARGUMENTS.get("debug",0))
lib=SConscript("SConscript")
Return('lib')
......@@ -243,10 +243,12 @@ bool eh_frame_util_t<ptrsize>::read_sleb128 (
auto byte=uint8_t(0);
do
{
if ( position > max )
return true;
byte = data [position];
position++;
result |= ((byte & 0x7f)<< shift);
shift += 7;
position++;
} while( (byte & 0x80) != 0);
/* sign bit of byte is second high order bit (0x40) */
......@@ -442,7 +444,6 @@ void eh_program_insn_t<ptrsize>::print(uint64_t &pc, int64_t caf) const
if(eh_frame_util_t<ptrsize>::read_uleb128(uleb, pos, (const uint8_t* const)data.data(), max))
return ;
cout<<" def_cfa_expression "<<dec<<uleb<<endl;
pos+=uleb; // doing this old school for now, as we aren't printing the expression.
break;
}
case DW_CFA_expression:
......@@ -454,7 +455,6 @@ void eh_program_insn_t<ptrsize>::print(uint64_t &pc, int64_t caf) const
if(eh_frame_util_t<ptrsize>::read_uleb128(uleb2, pos, (const uint8_t* const)data.data(), max))
return ;
cout<<" expression "<<dec<<uleb1<<" "<<uleb2<<endl;
pos+=uleb2;
break;
}
case DW_CFA_val_expression:
......@@ -466,7 +466,6 @@ void eh_program_insn_t<ptrsize>::print(uint64_t &pc, int64_t caf) const
if(eh_frame_util_t<ptrsize>::read_uleb128(uleb2, pos, (const uint8_t* const)data.data(), max))
return ;
cout<<" val_expression "<<dec<<uleb1<<" "<<uleb2<<endl;
pos+=uleb2;
break;
}
case DW_CFA_def_cfa_offset_sf:
......@@ -753,18 +752,26 @@ bool eh_program_insn_t<ptrsize>::parse_insn(
case DW_CFA_set_loc:
pos+=ptrsize;
if(pos>max)
return true;
break;
case DW_CFA_advance_loc1:
pos+=1;
if(pos>max)
return true;
break;
case DW_CFA_advance_loc2:
pos+=2;
if(pos>max)
return true;
break;
case DW_CFA_advance_loc4:
pos+=4;
if(pos>max)
return true;
break;
case DW_CFA_offset_extended:
......@@ -796,6 +803,10 @@ bool eh_program_insn_t<ptrsize>::parse_insn(
if(eh_frame_util_t<ptrsize>::read_uleb128(uleb, pos, data, max))
return true;
pos+=uleb;
if(pos>max)
return true;
if(pos>max)
return true;
break;
}
case DW_CFA_expression:
......@@ -808,6 +819,8 @@ bool eh_program_insn_t<ptrsize>::parse_insn(
if(eh_frame_util_t<ptrsize>::read_uleb128(uleb2, pos, data, max))
return true;
pos+=uleb2;
if(pos>max)
return true;
break;
}
case DW_CFA_def_cfa_offset_sf:
......@@ -1382,23 +1395,24 @@ bool lsda_call_site_t<ptrsize>::parse_lcs(
const uint8_t cs_table_encoding,
uint32_t &pos,
const uint8_t* const data,
const uint64_t max, /* call site table max */
const uint64_t cs_max, /* call site table max */
const uint64_t data_addr,
const uint64_t landing_pad_base_addr,
const uint64_t gcc_except_table_max)
{
const auto smallest_max = min(cs_max,gcc_except_table_max);
call_site_addr_position = pos + data_addr;
if(this->read_type_with_encoding(cs_table_encoding, call_site_offset, pos, data, max, data_addr))
if(this->read_type_with_encoding(cs_table_encoding, call_site_offset, pos, data, smallest_max, data_addr))
return true;
call_site_addr=landing_pad_base_addr+call_site_offset;
call_site_end_addr_position = pos + data_addr;
if(this->read_type_with_encoding(cs_table_encoding, call_site_length, pos, data, max, data_addr))
if(this->read_type_with_encoding(cs_table_encoding, call_site_length, pos, data, smallest_max, data_addr))
return true;
call_site_end_addr=call_site_addr+call_site_length;
landing_pad_addr_position = pos + data_addr;
if(this->read_type_with_encoding(cs_table_encoding, landing_pad_offset, pos, data, max, data_addr))
if(this->read_type_with_encoding(cs_table_encoding, landing_pad_offset, pos, data, smallest_max, data_addr))
return true;
landing_pad_addr_end_position = pos + data_addr;
......@@ -1408,7 +1422,7 @@ bool lsda_call_site_t<ptrsize>::parse_lcs(
else
landing_pad_addr=landing_pad_base_addr+landing_pad_offset;
if(this->read_uleb128(action, pos, data, max))
if(this->read_uleb128(action, pos, data, smallest_max))
return true;
if(action == 0)
......@@ -1424,7 +1438,7 @@ bool lsda_call_site_t<ptrsize>::parse_lcs(
while(!end)
{
lsda_call_site_action_t<ptrsize> lcsa;
if(lcsa.parse_lcsa(act_table_pos, data, gcc_except_table_max, end))
if(lcsa.parse_lcsa(act_table_pos, data, smallest_max, end))
return true;
action_table.push_back(lcsa);
......
#define use_throwing_assert
#ifndef throw_asssert
#ifdef use_throwing_assert
......