Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libehp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source Software
libehp
Commits
96b51183
Commit
96b51183
authored
1 year ago
by
Jason Hiser
Browse files
Options
Downloads
Patches
Plain Diff
in progress
parent
dfc7b30e
No related branches found
No related tags found
No related merge requests found
Pipeline
#23266
failed
1 year ago
Stage: test
Stage: fuzz
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/arm_ehp.cpp
+25
-10
25 additions, 10 deletions
src/arm_ehp.cpp
src/ehp_priv.hpp
+27
-21
27 additions, 21 deletions
src/ehp_priv.hpp
test/test.cpp
+4
-0
4 additions, 0 deletions
test/test.cpp
with
56 additions
and
31 deletions
src/arm_ehp.cpp
+
25
−
10
View file @
96b51183
...
...
@@ -54,20 +54,20 @@ bool split_arm_eh_frame_impl_t<ptrsize>::parse(const bool is_be)
{
// fetch the first word of the lsda.
throw_assert
(
extab_scoop
->
getStart
()
<=
lsda_addr
&&
lsda_addr
<=
extab_scoop
->
getEnd
());
cout
<<
"Found out-of-line unwind info."
<<
endl
<<
hex
;
//
cout << "Found out-of-line unwind info." << endl << hex;
unwind_pgm
=
parse_arm_eh_pgm
(
lsda_addr
,
extab_scoop
.
get
(),
fde
,
is_be
);
}
if
(
contains_inline_unwind_entry
)
{
cout
<<
"Found inline_entry:"
<<
endl
<<
hex
;
//
cout << "Found inline_entry:" << endl << hex;
unwind_pgm
=
parse_arm_eh_pgm
(
current_address
+
4
,
exidx_scoop
.
get
(),
fde
,
is_be
);
}
cout
<<
"
\t
Fde ("
<<
fde
.
getStartAddress
();
cout
<<
"Unwind pgm = "
<<
hex
<<
endl
;
for
(
auto
byte
:
unwind_pgm
)
{
cout
<<
"
\t
"
<<
+
byte
<<
endl
;
}
//
cout << "\tFde ("<< fde.getStartAddress();
//
cout << "Unwind pgm = " << hex << endl;
//
for(auto byte : unwind_pgm)
//
{
//
cout << "\t" << +byte << endl;
//
}
fde
.
setProgram
(
arm_eh_program_t
<
ptrsize
>
{
unwind_pgm
});
local_fdes
.
push_back
(
fde
);
...
...
@@ -117,7 +117,7 @@ vector<uint8_t> split_arm_eh_frame_impl_t<ptrsize>::parse_arm_eh_pgm(const uint6
const
auto
byte3
=
(
first_word
>>
16
)
&
0xff
;
const
auto
byte4
=
(
first_word
>>
24
)
&
0xff
;
const
auto
personality_index
=
byte4
&
0xf
;
cout
<<
"Found arm32-specific personality routine, pr"
<<
hex
<<
personality_index
<<
endl
;
//
cout << "Found arm32-specific personality routine, pr" << hex << personality_index << endl;
switch
(
personality_index
)
{
case
0
:
...
...
@@ -155,7 +155,7 @@ vector<uint8_t> split_arm_eh_frame_impl_t<ptrsize>::parse_arm_eh_pgm(const uint6
const
auto
offset_to_personality_routine
=
handle_pcrel31
(
first_word
);
const
auto
personality_routine_addr
=
lsda_addr
+
offset_to_personality_routine
;
fde
.
setPersonality
(
personality_routine_addr
);
cout
<<
"Found generic model with personality = "
<<
hex
<<
personality_routine_addr
<<
endl
;
//
cout << "Found generic model with personality = " << hex << personality_routine_addr << endl;
const
auto
second_word
=
*
reinterpret_cast
<
const
uint32_t
*>
(
&
contents
[
start_offset
+
4
]);
const
auto
byte1
=
(
second_word
>>
0
)
&
0xff
;
const
auto
byte2
=
(
second_word
>>
8
)
&
0xff
;
...
...
@@ -366,3 +366,18 @@ void arm_eh_program_insn_t<ptrsize>::print(uint64_t &pc, int64_t caf) const
cout
<<
endl
;
}
template
<
int
ptrsize
>
void
arm_fde_contents_t
<
ptrsize
>::
print
()
const
{
cout
<<
"start_addr = "
<<
hex
<<
fde_start_addr
<<
endl
;
cout
<<
"end_addr = "
<<
hex
<<
fde_end_addr
<<
endl
;
cout
<<
"lsda_addr = "
<<
hex
<<
fde_lsda_addr
<<
endl
;
cout
<<
"can_unwind = "
<<
boolalpha
<<
can_unwind
<<
endl
;
// lsda_t<ptrsize> lsda;
// arm_eh_program_t<ptrsize> eh_pgm;
// arm_cie_contents_t<ptrsize> cie;
}
This diff is collapsed.
Click to expand it.
src/ehp_priv.hpp
+
27
−
21
View file @
96b51183
...
...
@@ -524,23 +524,29 @@ class arm_cie_contents_t : public CIEContents_t, private eh_frame_util_t<ptrsize
private:
uint64_t
personality
;
// there's not really a CIE on arm mode, so there's no pgm.
// but we declare one so people cna inspect that it's empty.
const
eh_program_t
<
ptrsize
>
pgm
;
public:
arm_cie_contents_t
()
{};
arm_cie_contents_t
()
:
personality
(
0
)
{
}
const
eh_program_t
<
ptrsize
>&
getProgram
()
const
{
throw
std
::
runtime_error
(
" not implimented"
)
;
}
uint64_t
getPosition
()
const
{
throw
std
::
runtime_error
(
" not impl
i
mented"
);
}
uint64_t
getLength
()
const
{
throw
std
::
runtime_error
(
" not impl
i
mented"
);
}
uint64_t
getCAF
()
const
{
throw
std
::
runtime_error
(
" not implimented"
)
;
}
int64_t
getDAF
()
const
{
throw
std
::
runtime_error
(
" not implimented"
)
;
}
uint8_t
getPersonalityEncoding
()
const
{
throw
std
::
runtime_error
(
" not implimented"
)
;
}
const
eh_program_t
<
ptrsize
>&
getProgram
()
const
{
return
pgm
;
}
uint64_t
getPosition
()
const
{
throw
std
::
runtime_error
(
" not impl
e
mented"
);
}
uint64_t
getLength
()
const
{
throw
std
::
runtime_error
(
" not impl
e
mented"
);
}
uint64_t
getCAF
()
const
{
return
4
;
}
int64_t
getDAF
()
const
{
return
4
;
}
uint8_t
getPersonalityEncoding
()
const
{
return
0
;
}
uint64_t
getPersonality
()
const
{
return
personality
;
}
uint64_t
getPersonalityPointerPosition
()
const
{
throw
std
::
runtime_error
(
" not impl
i
mented"
);
}
uint64_t
getPersonalityPointerSize
()
const
{
throw
std
::
runtime_error
(
" not impl
i
mented"
);
}
uint64_t
getReturnRegister
()
const
{
throw
std
::
runtime_error
(
" not implimented"
)
;
}
string
getAugmentation
()
const
{
throw
std
::
runtime_error
(
" not impl
i
mented"
);
}
uint8_t
getLSDAEncoding
()
const
{
throw
std
::
runtime_error
(
" not impl
i
mented"
);
}
uint8_t
getFDEEncoding
()
const
{
throw
std
::
runtime_error
(
" not impl
i
mented"
);
}
uint64_t
getPersonalityPointerPosition
()
const
{
throw
std
::
runtime_error
(
" not impl
e
mented"
);
}
uint64_t
getPersonalityPointerSize
()
const
{
throw
std
::
runtime_error
(
" not impl
e
mented"
);
}
uint64_t
getReturnRegister
()
const
{
return
0
;
}
string
getAugmentation
()
const
{
throw
std
::
runtime_error
(
" not impl
e
mented"
);
}
uint8_t
getLSDAEncoding
()
const
{
throw
std
::
runtime_error
(
" not impl
e
mented"
);
}
uint8_t
getFDEEncoding
()
const
{
throw
std
::
runtime_error
(
" not impl
e
mented"
);
}
virtual
void
print
(
const
uint64_t
startAddr
)
const
{
...
...
@@ -573,7 +579,7 @@ class arm_eh_program_insn_t : public EHProgramInstruction_t
virtual
bool
isRestoreState
()
const
{
return
false
;
}
virtual
bool
isRememberState
()
const
{
return
false
;
}
virtual
const
EHProgramInstructionByteVector_t
&
getBytes
()
const
{
return
program_bytes
;
}
virtual
bool
advance
(
uint64_t
&
cur_addr
,
uint64_t
CAF
)
const
{
throw
std
::
runtime_error
(
"not implemented"
);
}
virtual
bool
advance
(
uint64_t
&
cur_addr
,
uint64_t
CAF
)
const
{
return
false
;
/* no advance operations for arm */
}
private
:
...
...
@@ -618,7 +624,7 @@ class arm_fde_contents_t : public FDEContents_t, eh_frame_util_t<ptrsize>
fde_end_addr
(
end_addr
)
{}
virtual
uint64_t
getPosition
()
const
{
throw
std
::
runtime_error
(
" not impl
i
mented"
);
}
virtual
uint64_t
getPosition
()
const
{
throw
std
::
runtime_error
(
" not impl
e
mented"
);
}
virtual
uint64_t
getLength
()
const
{
return
fde_end_addr
-
fde_start_addr
+
1
;
}
virtual
uint64_t
getStartAddress
()
const
{
return
fde_start_addr
;
}
virtual
uint64_t
getEndAddress
()
const
{
return
fde_end_addr
;
}
...
...
@@ -628,12 +634,12 @@ class arm_fde_contents_t : public FDEContents_t, eh_frame_util_t<ptrsize>
virtual
const
EHProgram_t
&
getProgram
()
const
{
return
eh_pgm
;
}
virtual
const
LSDA_t
*
getLSDA
()
const
{
return
&
lsda
;
}
virtual
uint64_t
getLSDAAddress
()
const
{
return
fde_lsda_addr
;
}
virtual
uint64_t
getStartAddressPosition
()
const
{
throw
std
::
runtime_error
(
" not impl
i
mented"
);
}
virtual
uint64_t
getEndAddressPosition
()
const
{
throw
std
::
runtime_error
(
" not impl
i
mented"
);
}
virtual
uint64_t
getEndAddressSize
()
const
{
throw
std
::
runtime_error
(
" not impl
i
mented"
);
}
virtual
uint64_t
getLSDAAddressPosition
()
const
{
throw
std
::
runtime_error
(
" not impl
i
mented"
);
}
virtual
uint64_t
getLSDAAddressSize
()
const
{
throw
std
::
runtime_error
(
" not impl
i
mented"
);
}
virtual
void
print
()
const
{
throw
std
::
runtime_error
(
" not implimented"
);
}
virtual
uint64_t
getStartAddressPosition
()
const
{
throw
std
::
runtime_error
(
" not impl
e
mented"
);
}
virtual
uint64_t
getEndAddressPosition
()
const
{
throw
std
::
runtime_error
(
" not impl
e
mented"
);
}
virtual
uint64_t
getEndAddressSize
()
const
{
throw
std
::
runtime_error
(
" not impl
e
mented"
);
}
virtual
uint64_t
getLSDAAddressPosition
()
const
{
throw
std
::
runtime_error
(
" not impl
e
mented"
);
}
virtual
uint64_t
getLSDAAddressSize
()
const
{
throw
std
::
runtime_error
(
" not impl
e
mented"
);
}
virtual
void
print
()
const
;
void
setEndAddress
(
uint64_t
end
)
{
fde_end_addr
=
end
;
}
bool
getCanUnwind
()
const
{
return
can_unwind
;
}
...
...
This diff is collapsed.
Click to expand it.
test/test.cpp
+
4
−
0
View file @
96b51183
...
...
@@ -38,7 +38,11 @@ void print_lps(const EHFrameParser_t* ehp)
for
(
const
auto
fde
:
*
fdes
)
{
cout
<<
"Found FDE at : "
<<
fde
->
getStartAddress
()
<<
"-"
<<
fde
->
getEndAddress
()
<<
endl
;
fde
->
print
();
fde
->
getProgram
().
print
(
fde
->
getStartAddress
(),
1
);
const
auto
&
cie
=
fde
->
getCIE
();
const
auto
&
personality
=
cie
.
getPersonality
();
cout
<<
"Personality: "
<<
hex
<<
personality
<<
endl
;
const
auto
lsda
=
fde
->
getLSDA
();
assert
(
lsda
);
lsda
->
print
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment