Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
system_extras
Commits
21ac023d
Commit
21ac023d
authored
9 years ago
by
Yabin Cui
Committed by
Gerrit Code Review
9 years ago
Browse files
Options
Download
Plain Diff
Merge "simpleperf: fix build by removing off64_t."
parents
88a0a38c
41e32ca2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
simpleperf/read_apk.cpp
simpleperf/read_apk.cpp
+4
-4
simpleperf/read_apk.h
simpleperf/read_apk.h
+7
-5
No files found.
simpleperf/read_apk.cpp
View file @
21ac023d
...
...
@@ -56,7 +56,7 @@ class ArchiveHelper {
std
::
map
<
ApkInspector
::
ApkOffset
,
std
::
unique_ptr
<
EmbeddedElf
>>
ApkInspector
::
embedded_elf_cache_
;
EmbeddedElf
*
ApkInspector
::
FindElfInApkByOffset
(
const
std
::
string
&
apk_path
,
off
64_t
file_offset
)
{
EmbeddedElf
*
ApkInspector
::
FindElfInApkByOffset
(
const
std
::
string
&
apk_path
,
uint
64_t
file_offset
)
{
// Already in cache?
ApkOffset
ami
(
apk_path
,
file_offset
);
auto
it
=
embedded_elf_cache_
.
find
(
ami
);
...
...
@@ -70,7 +70,7 @@ EmbeddedElf* ApkInspector::FindElfInApkByOffset(const std::string& apk_path, off
}
std
::
unique_ptr
<
EmbeddedElf
>
ApkInspector
::
FindElfInApkByOffsetWithoutCache
(
const
std
::
string
&
apk_path
,
off
64_t
file_offset
)
{
uint
64_t
file_offset
)
{
// Crack open the apk(zip) file and take a look.
if
(
!
IsValidApkPath
(
apk_path
))
{
return
nullptr
;
...
...
@@ -99,8 +99,8 @@ std::unique_ptr<EmbeddedElf> ApkInspector::FindElfInApkByOffsetWithoutCache(cons
int
zrc
;
while
((
zrc
=
Next
(
iteration_cookie
,
&
zentry
,
&
zname
))
==
0
)
{
if
(
zentry
.
method
==
kCompressStored
&&
file_offset
>=
zentry
.
offset
&&
file_offset
<
zentry
.
offset
+
zentry
.
uncompressed_length
)
{
file_offset
>=
static_cast
<
uint64_t
>
(
zentry
.
offset
)
&&
file_offset
<
static_cast
<
uint64_t
>
(
zentry
.
offset
+
zentry
.
uncompressed_length
)
)
{
// Found.
found
=
true
;
break
;
...
...
This diff is collapsed.
Click to expand it.
simpleperf/read_apk.h
View file @
21ac023d
...
...
@@ -17,6 +17,8 @@
#ifndef SIMPLE_PERF_READ_APK_H_
#define SIMPLE_PERF_READ_APK_H_
#include <stdint.h>
#include <map>
#include <memory>
#include <string>
...
...
@@ -51,7 +53,7 @@ class EmbeddedElf {
const
std
::
string
&
entry_name
()
const
{
return
entry_name_
;
}
// Offset of zip entry from start of containing APK file
size
_t
entry_offset
()
const
{
return
entry_offset_
;
}
uint64
_t
entry_offset
()
const
{
return
entry_offset_
;
}
// Size of zip entry (length of embedded ELF)
uint32_t
entry_size
()
const
{
return
entry_size_
;
}
...
...
@@ -59,7 +61,7 @@ class EmbeddedElf {
private:
std
::
string
filepath_
;
// containing APK path
std
::
string
entry_name_
;
// name of entry in zip index of embedded elf file
size
_t
entry_offset_
;
// offset of ELF from start of containing APK file
uint64
_t
entry_offset_
;
// offset of ELF from start of containing APK file
uint32_t
entry_size_
;
// size of ELF file in zip
};
...
...
@@ -69,16 +71,16 @@ class ApkInspector {
// Given an APK/ZIP/JAR file and an offset into that file, if the
// corresponding region of the APK corresponds to an uncompressed
// ELF file, then return pertinent info on the ELF.
static
EmbeddedElf
*
FindElfInApkByOffset
(
const
std
::
string
&
apk_path
,
off
64_t
file_offset
);
static
EmbeddedElf
*
FindElfInApkByOffset
(
const
std
::
string
&
apk_path
,
uint
64_t
file_offset
);
static
std
::
unique_ptr
<
EmbeddedElf
>
FindElfInApkByName
(
const
std
::
string
&
apk_path
,
const
std
::
string
&
elf_filename
);
private:
static
std
::
unique_ptr
<
EmbeddedElf
>
FindElfInApkByOffsetWithoutCache
(
const
std
::
string
&
apk_path
,
off
64_t
file_offset
);
uint
64_t
file_offset
);
// First component of pair is APK file path, second is offset into APK.
typedef
std
::
pair
<
std
::
string
,
size
_t
>
ApkOffset
;
typedef
std
::
pair
<
std
::
string
,
uint64
_t
>
ApkOffset
;
static
std
::
map
<
ApkOffset
,
std
::
unique_ptr
<
EmbeddedElf
>>
embedded_elf_cache_
;
};
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment