Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Zipr Toolchain
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
Zipr Toolchain
Commits
a4b47dfc
Commit
a4b47dfc
authored
6 years ago
by
Jason Hiser
Browse files
Options
Downloads
Patches
Plain Diff
used findFDE api for efficiency, added call to init offset map properly
Former-commit-id: f9832fb9a7f84bef68a7f56f68c44b0a063e7c68
parent
5d6061e0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libIRDB/test/fill_in_cfg.cpp
+7
-5
7 additions, 5 deletions
libIRDB/test/fill_in_cfg.cpp
libIRDB/test/split_eh_frame.cpp
+16
-9
16 additions, 9 deletions
libIRDB/test/split_eh_frame.cpp
libehp
+1
-1
1 addition, 1 deletion
libehp
with
24 additions
and
15 deletions
libIRDB/test/fill_in_cfg.cpp
+
7
−
5
View file @
a4b47dfc
...
...
@@ -561,17 +561,19 @@ void fill_in_landing_pads(FileIR_t *firp)
map
<
Function_t
*
,
set
<
Instruction_t
*>
>
insns_to_add_to_funcs
;
for_each
(
firp
->
GetInstructions
().
begin
(),
firp
->
GetInstructions
().
end
(),
[
&
](
Instruction_t
*
t
)
// for_each(firp->GetInstructions().begin(), firp->GetInstructions().end(), [&](Instruction_t* t)
for
(
const
auto
t
:
firp
->
GetInstructions
())
{
if
(
t
->
GetFunction
()
==
NULL
)
return
;
continue
;
auto
lp
=
eh_frame_rep_ptr
->
find_lp
(
t
);
if
(
lp
&&
lp
->
GetFunction
()
==
NULL
)
insns_to_add_to_funcs
[
t
->
GetFunction
()].
insert
(
lp
);
}
)
;
};
for_each
(
insns_to_add_to_funcs
.
begin
(),
insns_to_add_to_funcs
.
end
(),
[
&
](
pair
<
Function_t
*
const
,
set
<
Instruction_t
*>
>
&
p
)
// for_each(insns_to_add_to_funcs.begin(), insns_to_add_to_funcs.end(), [&](pair<Function_t* const,set<Instruction_t*> > & p)
for
(
const
auto
&
p
:
insns_to_add_to_funcs
)
{
auto
&
func
=
p
.
first
;
auto
insns
=
p
.
second
;
/* copy */
...
...
@@ -603,7 +605,7 @@ void fill_in_landing_pads(FileIR_t *firp)
if
(
fallthru
)
insns
.
insert
(
fallthru
);
}
cout
<<
"Found LP outside of function "
<<
func
->
GetName
()
<<
" added "
<<
insn_count
<<
" instructions"
<<
endl
;
}
)
;
};
}
...
...
This diff is collapsed.
Click to expand it.
libIRDB/test/split_eh_frame.cpp
+
16
−
9
View file @
a4b47dfc
...
...
@@ -270,13 +270,17 @@ void split_eh_frame_impl_t<ptrsize>::build_ir() const
const auto fie_it=fdes.find(tofind);
*/
const
auto
find_addr
=
insn
->
GetAddress
()
->
GetVirtualOffset
();
/*
too slow
const auto finder=[&](const shared_ptr<FDEContents_t>& fde) -> bool
{ return fde->getStartAddress() <= find_addr && find_addr < fde->getEndAddress(); };
const auto fie_ptr_it=find_if ( ALLOF(*fdes), finder);
*/
const
auto
fie_ptr
=
eh_frame_parser
->
findFDE
(
find_addr
);
if
(
fie_ptr
_it
!=
fdes
->
end
())
if
(
fie_ptr
!=
nullptr
)
{
const
auto
fie_ptr
=*
fie_ptr_it
;
//
const auto fie_ptr=*fie_ptr_it;
if
(
getenv
(
"EHIR_VERBOSE"
)
!=
NULL
)
{
...
...
@@ -486,20 +490,21 @@ void split_eh_frame_impl_t<ptrsize>::build_ir() const
template
<
int
ptrsize
>
libIRDB
::
Instruction_t
*
split_eh_frame_impl_t
<
ptrsize
>::
find_lp
(
libIRDB
::
Instruction_t
*
i
)
const
{
const
auto
find_addr
=
i
->
GetAddress
()
->
GetVirtualOffset
();
//const auto tofind=fde_contents_t<ptrsize>( i->GetAddress()->GetVirtualOffset(), i->GetAddress()->GetVirtualOffset()+1);
//const auto fde_it=fdes.find(tofind);
const
auto
find_addr
=
i
->
GetAddress
()
->
GetVirtualOffset
();
/* too slow
const auto fde_ptr_it=find_if
(
ALLOF(*fdes),
[&](const shared_ptr<FDEContents_t>& fde) { return fde->getStartAddress() <= find_addr && find_addr < fde->getEndAddress(); }
);
*/
const
auto
fde_ptr
=
eh_frame_parser
->
findFDE
(
find_addr
);
if
(
fde_ptr
_it
==
fdes
->
end
()
)
return
NULL
;
if
(
fde_ptr
==
nullptr
)
return
nullptr
;
const
auto
fde_ptr
=*
fde_ptr_it
;
const
auto
&
the_fde
=*
fde_ptr
;
const
auto
&
the_lsda_ptr
=
the_fde
.
getLSDA
();
const
auto
&
the_lsda
=*
the_lsda_ptr
;
...
...
@@ -510,7 +515,7 @@ libIRDB::Instruction_t* split_eh_frame_impl_t<ptrsize>::find_lp(libIRDB::Instruc
{
return
lsda_call_site_appliesTo
(
*
cs
,
i
);
});
if
(
cstab_it
==
cstab
.
end
())
return
NULL
;
return
nullptr
;
const
auto
&
the_cstab_entry_ptr
=*
cstab_it
;
const
auto
&
the_cstab_entry
=*
the_cstab_entry_ptr
;
...
...
@@ -519,7 +524,7 @@ libIRDB::Instruction_t* split_eh_frame_impl_t<ptrsize>::find_lp(libIRDB::Instruc
const
auto
om_it
=
offset_to_insn_map
.
find
(
lp_addr
);
if
(
om_it
==
offset_to_insn_map
.
end
())
return
NULL
;
return
nullptr
;
auto
lp
=
om_it
->
second
;
return
lp
;
...
...
@@ -573,6 +578,8 @@ split_eh_frame_impl_t<ptrsize>::split_eh_frame_impl_t(FileIR_t* p_firp)
if
(
eh_frame_parser
!=
NULL
)
fdes
=
eh_frame_parser
->
getFDEs
();
(
void
)
init_offset_map
();
}
unique_ptr
<
split_eh_frame_t
>
split_eh_frame_t
::
factory
(
FileIR_t
*
firp
)
...
...
This diff is collapsed.
Click to expand it.
libehp
@
9e90afed
Compare
3a620bef
...
9e90afed
Subproject commit
3a620bef44acdb168c54cfa6a1a5354e1439fc25
Subproject commit
9e90afedeaa8474d158a452205f6271172c7d78d
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