Skip to content

Commit

Permalink
Fix for bug where 64-bit executables were processed as 32-bit executa…
Browse files Browse the repository at this point in the history
…bles.

Added some more logging.

TBR=sra

Review URL: http://codereview.chromium.org/988002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41598 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
laforge@chromium.org committed Mar 15, 2010
1 parent 910d730 commit 7e6b926
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
4 changes: 4 additions & 0 deletions courgette/adjustment_method_2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/string_util.h"
#include "base/time.h"

#include "courgette/assembly_program.h"
#include "courgette/courgette.h"
Expand Down Expand Up @@ -1293,8 +1294,11 @@ class Adjuster : public AdjustmentMethod {
}

void Solve(const Trace& model, size_t model_end) {
base::Time start_time = base::Time::Now();
AssignmentProblem a(model, model_end);
a.Solve();
LOG(INFO) << " Adjuster::Solve "
<< (base::Time::Now() - start_time).InSecondsF();
}

void ReferenceLabel(Trace* trace, Label* label, bool is_model) {
Expand Down
15 changes: 9 additions & 6 deletions courgette/ensemble.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,15 @@ Status Ensemble::FindEmbeddedElements() {
Region region(start + position, info->length());

if (info->has_text_section()) {
Element* element = new ElementWinPE(Element::WIN32_X86_WITH_CODE,
this, region, info);
owned_elements_.push_back(element);
elements_.push_back(element);
position += region.length();
continue;
if (info->is_32bit()) {
Element* element = new ElementWinPE(Element::WIN32_X86_WITH_CODE,
this, region, info);
owned_elements_.push_back(element);
elements_.push_back(element);
position += region.length();
continue;
}
// TODO(sra): Extend to 64-bit executables.
}

// If we had a clever transformation for resource-only executables we
Expand Down
6 changes: 6 additions & 0 deletions courgette/ensemble_create.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ void FreeGenerators(std::vector<TransformationPatchGenerator*>* generators) {
Status GenerateEnsemblePatch(SourceStream* base,
SourceStream* update,
SinkStream* final_patch) {
LOG(INFO) << "start GenerateEnsemblePatch";
base::Time start_time = base::Time::Now();

Region old_region(base->Buffer(), base->Remaining());
Region new_region(update->Buffer(), update->Remaining());
Ensemble old_ensemble(old_region, "old");
Expand Down Expand Up @@ -376,6 +379,9 @@ Status GenerateEnsemblePatch(SourceStream* base,
if (!patch_streams.CopyTo(final_patch))
return C_STREAM_ERROR;

LOG(INFO) << "done GenerateEnsemblePatch "
<< (base::Time::Now() - start_time).InSecondsF() << "s";

return C_OK;
}

Expand Down
6 changes: 5 additions & 1 deletion courgette/win32_x86_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#ifndef COURGETTE_WIN32_X86_GENERATOR_H_
#define COURGETTE_WIN32_X86_GENERATOR_H_

#include "base/logging.h"
#include "base/scoped_ptr.h"

#include "courgette/ensemble.h"
Expand Down Expand Up @@ -60,8 +61,10 @@ class CourgetteWin32X86PatchGenerator : public TransformationPatchGenerator {
ParseWin32X86PE(old_element_->region().start(),
old_element_->region().length(),
&old_program);
if (old_parse_status != C_OK)
if (old_parse_status != C_OK) {
LOG(ERROR) << "Cannot parse as Win32X86PE " << old_element_->Name();
return old_parse_status;
}

AssemblyProgram* new_program = NULL;
Status new_parse_status =
Expand All @@ -70,6 +73,7 @@ class CourgetteWin32X86PatchGenerator : public TransformationPatchGenerator {
&new_program);
if (new_parse_status != C_OK) {
DeleteAssemblyProgram(old_program);
LOG(ERROR) << "Cannot parse as Win32X86PE " << new_element_->Name();
return new_parse_status;
}

Expand Down

0 comments on commit 7e6b926

Please sign in to comment.