Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
llvm-epi-0.8
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Roger Ferrer
llvm-epi-0.8
Commits
2756adf3
Commit
2756adf3
authored
11 years ago
by
Virgile Bello
Browse files
Options
Downloads
Patches
Plain Diff
Implement ObjectFilePECOFF::SetLoadAddress().
llvm-svn: 203350
parent
ffeba256
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+42
-0
42 additions, 0 deletions
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
+4
-0
4 additions, 0 deletions
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
with
46 additions
and
0 deletions
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+
42
−
0
View file @
2756adf3
...
...
@@ -24,6 +24,8 @@
#include
"lldb/Core/Timer.h"
#include
"lldb/Core/UUID.h"
#include
"lldb/Symbol/ObjectFile.h"
#include
"lldb/Target/SectionLoadList.h"
#include
"lldb/Target/Target.h"
#define IMAGE_DOS_SIGNATURE 0x5A4D // MZ
#define IMAGE_NT_SIGNATURE 0x00004550 // PE00
...
...
@@ -173,6 +175,43 @@ ObjectFilePECOFF::ParseHeader ()
return
false
;
}
bool
ObjectFilePECOFF
::
SetLoadAddress
(
Target
&
target
,
addr_t
value
,
bool
value_is_offset
)
{
bool
changed
=
false
;
ModuleSP
module_sp
=
GetModule
();
if
(
module_sp
)
{
size_t
num_loaded_sections
=
0
;
SectionList
*
section_list
=
GetSectionList
();
if
(
section_list
)
{
if
(
!
value_is_offset
)
{
value
-=
m_image_base
;
}
const
size_t
num_sections
=
section_list
->
GetSize
();
size_t
sect_idx
=
0
;
for
(
sect_idx
=
0
;
sect_idx
<
num_sections
;
++
sect_idx
)
{
// Iterate through the object file sections to find all
// of the sections that have SHF_ALLOC in their flag bits.
SectionSP
section_sp
(
section_list
->
GetSectionAtIndex
(
sect_idx
));
if
(
section_sp
&&
!
section_sp
->
IsThreadSpecific
())
{
if
(
target
.
GetSectionLoadList
().
SetSectionLoadAddress
(
section_sp
,
section_sp
->
GetFileAddress
()
+
value
))
++
num_loaded_sections
;
}
}
changed
=
num_loaded_sections
>
0
;
return
num_loaded_sections
>
0
;
}
}
return
changed
;
}
ByteOrder
ObjectFilePECOFF
::
GetByteOrder
()
const
...
...
@@ -351,6 +390,9 @@ ObjectFilePECOFF::ParseCOFFOptionalHeader(lldb::offset_t *offset_ptr)
m_coff_header_opt
.
data_dirs
[
i
].
vmaddr
=
m_data
.
GetU32
(
offset_ptr
);
m_coff_header_opt
.
data_dirs
[
i
].
vmsize
=
m_data
.
GetU32
(
offset_ptr
);
}
m_file_offset
=
m_coff_header_opt
.
image_base
;
m_image_base
=
m_coff_header_opt
.
image_base
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
+
4
−
0
View file @
2756adf3
...
...
@@ -73,6 +73,9 @@ public:
virtual
bool
ParseHeader
();
virtual
bool
SetLoadAddress
(
lldb_private
::
Target
&
target
,
lldb
::
addr_t
value
,
bool
value_is_offset
);
virtual
lldb
::
ByteOrder
GetByteOrder
()
const
;
...
...
@@ -262,6 +265,7 @@ private:
coff_header_t
m_coff_header
;
coff_opt_header_t
m_coff_header_opt
;
SectionHeaderColl
m_sect_headers
;
lldb
::
addr_t
m_image_base
;
};
#endif // #ifndef liblldb_ObjectFilePECOFF_h_
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