Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
elfio mirror
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Third Party Mirrors
elfio mirror
Commits
ac33c1e4
Commit
ac33c1e4
authored
12 years ago
by
Serge Lamikhov-Center
Browse files
Options
Downloads
Patches
Plain Diff
Output section names at the end of line
Increase width of Nr field Refactor format_assoc() implementation
parent
3aa0cc17
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
elfio/elfio_dump.hpp
+13
-20
13 additions, 20 deletions
elfio/elfio_dump.hpp
with
13 additions
and
20 deletions
elfio/elfio_dump.hpp
+
13
−
20
View file @
ac33c1e4
...
@@ -405,8 +405,8 @@ class dump
...
@@ -405,8 +405,8 @@ class dump
if
(
n
>
0
)
{
if
(
n
>
0
)
{
out
out
<<
"Section Headers:"
<<
std
::
endl
<<
"Section Headers:"
<<
std
::
endl
<<
"
[
Nr
] Name
Type Addr Size ES Flg Lk Inf Al"
<<
std
::
endl
;
<<
"
[
Nr
]
Type Addr Size ES Flg Lk Inf Al
Name
"
<<
std
::
endl
;
for
(
Elf_Half
i
=
0
;
i
<
n
;
++
i
)
{
// For all sections
for
(
Elf_Half
i
=
0
;
i
<
n
;
++
i
)
{
// For all sections
section
*
sec
=
reader
.
sections
[
i
];
section
*
sec
=
reader
.
sections
[
i
];
...
@@ -423,10 +423,9 @@ class dump
...
@@ -423,10 +423,9 @@ class dump
section_header
(
std
::
ostream
&
out
,
Elf_Half
no
,
const
section
*
sec
)
section_header
(
std
::
ostream
&
out
,
Elf_Half
no
,
const
section
*
sec
)
{
{
std
::
ios_base
::
fmtflags
original_flags
=
out
.
flags
();
std
::
ios_base
::
fmtflags
original_flags
=
out
.
flags
();
out
<<
"
["
out
<<
"["
<<
DUMP_DEC_FORMAT
(
2
)
<<
no
<<
DUMP_DEC_FORMAT
(
5
)
<<
no
<<
"] "
<<
"] "
<<
DUMP_STR_FORMAT
(
17
)
<<
sec
->
get_name
()
<<
" "
<<
DUMP_STR_FORMAT
(
17
)
<<
str_section_type
(
sec
->
get_type
()
)
<<
" "
<<
DUMP_STR_FORMAT
(
17
)
<<
str_section_type
(
sec
->
get_type
()
)
<<
" "
<<
DUMP_HEX_FORMAT
(
8
)
<<
sec
->
get_address
()
<<
" "
<<
DUMP_HEX_FORMAT
(
8
)
<<
sec
->
get_address
()
<<
" "
<<
DUMP_HEX_FORMAT
(
8
)
<<
sec
->
get_size
()
<<
" "
<<
DUMP_HEX_FORMAT
(
8
)
<<
sec
->
get_size
()
<<
" "
...
@@ -435,6 +434,7 @@ class dump
...
@@ -435,6 +434,7 @@ class dump
<<
DUMP_DEC_FORMAT
(
2
)
<<
sec
->
get_link
()
<<
" "
<<
DUMP_DEC_FORMAT
(
2
)
<<
sec
->
get_link
()
<<
" "
<<
DUMP_DEC_FORMAT
(
3
)
<<
sec
->
get_info
()
<<
" "
<<
DUMP_DEC_FORMAT
(
3
)
<<
sec
->
get_info
()
<<
" "
<<
DUMP_DEC_FORMAT
(
2
)
<<
sec
->
get_addr_align
()
<<
" "
<<
DUMP_DEC_FORMAT
(
2
)
<<
sec
->
get_addr_align
()
<<
" "
<<
DUMP_STR_FORMAT
(
17
)
<<
sec
->
get_name
()
<<
" "
<<
std
::
endl
;
<<
std
::
endl
;
out
.
flags
(
original_flags
);
out
.
flags
(
original_flags
);
...
@@ -448,7 +448,7 @@ class dump
...
@@ -448,7 +448,7 @@ class dump
Elf_Half
n
=
reader
.
segments
.
size
();
Elf_Half
n
=
reader
.
segments
.
size
();
if
(
n
>
0
)
{
if
(
n
>
0
)
{
out
<<
"Segment headers:"
<<
std
::
endl
out
<<
"Segment headers:"
<<
std
::
endl
<<
"
[
Nr] Type VirtAddr PhysAddr FileSize Mem.Size Flags Align"
<<
"
[
Nr
] Type VirtAddr PhysAddr FileSize Mem.Size Flags Align"
<<
std
::
endl
;
<<
std
::
endl
;
for
(
Elf_Half
i
=
0
;
i
<
n
;
++
i
)
{
for
(
Elf_Half
i
=
0
;
i
<
n
;
++
i
)
{
...
@@ -465,8 +465,8 @@ class dump
...
@@ -465,8 +465,8 @@ class dump
segment_header
(
std
::
ostream
&
out
,
Elf_Half
no
,
const
segment
*
seg
)
segment_header
(
std
::
ostream
&
out
,
Elf_Half
no
,
const
segment
*
seg
)
{
{
std
::
ios_base
::
fmtflags
original_flags
=
out
.
flags
();
std
::
ios_base
::
fmtflags
original_flags
=
out
.
flags
();
out
<<
"
["
out
<<
"["
<<
DUMP_DEC_FORMAT
(
2
)
<<
no
<<
DUMP_DEC_FORMAT
(
5
)
<<
no
<<
"] "
<<
"] "
<<
DUMP_STR_FORMAT
(
14
)
<<
str_segment_type
(
seg
->
get_type
()
)
<<
" "
<<
DUMP_STR_FORMAT
(
14
)
<<
str_segment_type
(
seg
->
get_type
()
)
<<
" "
<<
DUMP_HEX_FORMAT
(
8
)
<<
seg
->
get_virtual_address
()
<<
" "
<<
DUMP_HEX_FORMAT
(
8
)
<<
seg
->
get_virtual_address
()
<<
" "
...
@@ -492,7 +492,7 @@ class dump
...
@@ -492,7 +492,7 @@ class dump
Elf_Xword
sym_no
=
symbols
.
get_symbols_num
();
Elf_Xword
sym_no
=
symbols
.
get_symbols_num
();
if
(
sym_no
>
0
)
{
if
(
sym_no
>
0
)
{
out
<<
"Symbol table ("
<<
sec
->
get_name
()
<<
")"
<<
std
::
endl
out
<<
"Symbol table ("
<<
sec
->
get_name
()
<<
")"
<<
std
::
endl
<<
"
[
Nr] Value Size Type Bind Sect Name"
<<
"
[
Nr
] Value Size Type Bind Sect Name"
<<
std
::
endl
;
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
sym_no
;
++
i
)
{
for
(
int
i
=
0
;
i
<
sym_no
;
++
i
)
{
...
@@ -525,8 +525,8 @@ class dump
...
@@ -525,8 +525,8 @@ class dump
Elf_Half
section
)
Elf_Half
section
)
{
{
std
::
ios_base
::
fmtflags
original_flags
=
out
.
flags
();
std
::
ios_base
::
fmtflags
original_flags
=
out
.
flags
();
out
<<
"
["
out
<<
"["
<<
DUMP_DEC_FORMAT
(
2
)
<<
no
<<
DUMP_DEC_FORMAT
(
5
)
<<
no
<<
"] "
<<
"] "
<<
DUMP_HEX_FORMAT
(
8
)
<<
value
<<
" "
<<
DUMP_HEX_FORMAT
(
8
)
<<
value
<<
" "
<<
DUMP_HEX_FORMAT
(
8
)
<<
size
<<
" "
<<
DUMP_HEX_FORMAT
(
8
)
<<
size
<<
" "
...
@@ -626,14 +626,7 @@ class dump
...
@@ -626,14 +626,7 @@ class dump
std
::
string
std
::
string
format_assoc
(
const
T
&
table
,
const
char
key
)
format_assoc
(
const
T
&
table
,
const
char
key
)
{
{
std
::
string
str
=
find_value_in_table
(
table
,
key
);
return
format_assoc
(
table
,
(
const
int
)
key
);
if
(
str
==
"UNKNOWN"
)
{
std
::
ostringstream
oss
;
oss
<<
str
<<
" (0x"
<<
std
::
hex
<<
(
int
)
key
<<
")"
;
str
=
oss
.
str
();
}
return
str
;
}
}
...
@@ -662,7 +655,7 @@ class dump
...
@@ -662,7 +655,7 @@ class dump
template
<
typename
T
>
\
template
<
typename
T
>
\
static
\
static
\
std
::
string
\
std
::
string
\
str_
##
name
(
const
T
key
)
\
str_
##
name
(
const
T
key
)
\
{
\
{
\
return
format_assoc
(
name
##
_table
,
key
);
\
return
format_assoc
(
name
##
_table
,
key
);
\
}
}
...
...
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