diff options
Diffstat (limited to 'tools')
119 files changed, 1955 insertions, 11136 deletions
diff --git a/tools/android/adb_profile_chrome/perf_controller.py b/tools/android/adb_profile_chrome/perf_controller.py index 523fb855ff..aeb29fd0ee 100644 --- a/tools/android/adb_profile_chrome/perf_controller.py +++ b/tools/android/adb_profile_chrome/perf_controller.py @@ -58,7 +58,7 @@ class _PerfProfiler(object): if categories: cmd += ['--event', ','.join(categories)] self._perf_control = perf_control.PerfControl(self._device) - self._perf_control.ForceAllCpusOnline(True) + self._perf_control.SetPerfProfilingMode() self._perf_process = subprocess.Popen(cmd, stdout=self._log_file, stderr=subprocess.STDOUT) @@ -67,7 +67,7 @@ class _PerfProfiler(object): perf_pids = self._device.old_interface.ExtractPid('perf') self._device.RunShellCommand('kill -SIGINT ' + ' '.join(perf_pids)) self._perf_process.wait() - self._perf_control.ForceAllCpusOnline(False) + self._perf_control.SetDefaultPerfMode() def _FailWithLog(self, msg): self._log_file.seek(0) diff --git a/tools/bisect-perf-regression.py b/tools/bisect-perf-regression.py index 5367345d6a..bb5ef19bfc 100755 --- a/tools/bisect-perf-regression.py +++ b/tools/bisect-perf-regression.py @@ -482,7 +482,7 @@ def FetchFromCloudStorage(bucket_name, source_path, destination_path): destination_path: Destination file path. Returns: - True if the fetching succeeds, otherwise False. + Downloaded file path if exisits, otherwise None. """ target_file = os.path.join(destination_path, os.path.basename(source_path)) try: @@ -490,7 +490,7 @@ def FetchFromCloudStorage(bucket_name, source_path, destination_path): print 'Fetching file from gs//%s/%s ...' % (bucket_name, source_path) cloud_storage.Get(bucket_name, source_path, destination_path) if os.path.exists(target_file): - return True + return target_file else: print ('File gs://%s/%s not found in cloud storage.' % ( bucket_name, source_path)) @@ -498,7 +498,7 @@ def FetchFromCloudStorage(bucket_name, source_path, destination_path): print 'Something went wrong while fetching file from cloud: %s' % e if os.path.exists(target_file): os.remove(target_file) - return False + return None # This is copied from Chromium's project build/scripts/common/chromium_utils.py. @@ -1553,12 +1553,42 @@ class BisectPerformanceMetrics(object): return destination_dir return None + def GetBuildArchiveForRevision(self, revision, gs_bucket, target_arch, + patch_sha, out_dir): + """Checks and downloads build archive for a given revision. + + Checks for build archive with Git hash or SVN revision. If either of the + file exists, then downloads the archive file. + + Args: + revision: A Git hash revision. + gs_bucket: Cloud storage bucket name + target_arch: 32 or 64 bit build target + patch: A DEPS patch (used while bisecting 3rd party repositories). + out_dir: Build output directory where downloaded file is stored. + + Returns: + Downloaded archive file path if exists, otherwise None. + """ + # Source archive file path on cloud storage using Git revision. + source_file = GetRemoteBuildPath(revision, target_arch, patch_sha) + downloaded_archive = FetchFromCloudStorage(gs_bucket, source_file, out_dir) + if not downloaded_archive: + # Get SVN revision for the given SHA. + svn_revision = self.source_control.SVNFindRev(revision) + if svn_revision: + # Source archive file path on cloud storage using SVN revision. + source_file = GetRemoteBuildPath(svn_revision, target_arch, patch_sha) + return FetchFromCloudStorage(gs_bucket, source_file, out_dir) + return downloaded_archive + def DownloadCurrentBuild(self, revision, build_type='Release', patch=None): """Downloads the build archive for the given revision. Args: - revision: The SVN revision to build. + revision: The Git revision to download or build. build_type: Target build type ('Release', 'Debug', 'Release_x64' etc.) + patch: A DEPS patch (used while bisecting 3rd party repositories). Returns: True if download succeeds, otherwise False. @@ -1572,27 +1602,25 @@ class BisectPerformanceMetrics(object): # 'DEPS.sha' and add patch_sha evaluated above to it. patch = '%s\n%s' % (patch, DEPS_SHA_PATCH % {'deps_sha': patch_sha}) - # Source archive file path on cloud storage. - source_file = GetRemoteBuildPath(revision, self.opts.target_arch, patch_sha) - # Get Build output directory abs_build_dir = os.path.abspath( self.builder.GetBuildOutputDirectory(self.opts, self.src_cwd)) - # Downloaded archive file path. - downloaded_file = os.path.join( - abs_build_dir, - GetZipFileName(revision, self.opts.target_arch, patch_sha)) - - fetch_build_func = lambda: FetchFromCloudStorage(self.opts.gs_bucket, - source_file, - abs_build_dir) - - if not fetch_build_func(): - if not self.PostBuildRequestAndWait(revision, - fetch_build=fetch_build_func, - patch=patch): - raise RuntimeError('Somewthing went wrong while processing build' - 'request for: %s' % revision) + + fetch_build_func = lambda: self.GetBuildArchiveForRevision( + revision, self.opts.gs_bucket, self.opts.target_arch, + patch_sha, abs_build_dir) + + # Downloaded archive file path, downloads build archive for given revision. + downloaded_file = fetch_build_func() + + # When build archive doesn't exists, post a build request to tryserver + # and wait for the build to be produced. + if not downloaded_file: + downloaded_file = self.PostBuildRequestAndWait( + revision, fetch_build=fetch_build_func, patch=patch) + if not downloaded_file: + return False + # Generic name for the archive, created when archive file is extracted. output_dir = os.path.join( abs_build_dir, GetZipFileName(target_arch=self.opts.target_arch)) @@ -1634,8 +1662,7 @@ class BisectPerformanceMetrics(object): max_timeout: Maximum time to wait for the build. Returns: - True if build exists and download is successful, otherwise throws - RuntimeError exception when time elapse. + Downloaded archive file path if exists, otherwise None. """ # Build number on the tryserver. build_num = None @@ -1665,16 +1692,36 @@ class BisectPerformanceMetrics(object): build_status, status_link = bisect_builder.GetBuildStatus( build_num, bot_name, builder_host, builder_port) if build_status == bisect_builder.FAILED: - return (False, 'Failed to produce build, log: %s' % status_link) + return (None, 'Failed to produce build, log: %s' % status_link) elapsed_time = time.time() - start_time if elapsed_time > max_timeout: - return (False, 'Timed out: %ss without build' % max_timeout) + return (None, 'Timed out: %ss without build' % max_timeout) print 'Time elapsed: %ss without build.' % elapsed_time time.sleep(poll_interval) def PostBuildRequestAndWait(self, revision, fetch_build, patch=None): - """POSTs the build request job to the tryserver instance.""" + """POSTs the build request job to the tryserver instance. + + A try job build request is posted to tryserver.chromium.perf master, + and waits for the binaries to be produced and archived on cloud storage. + Once the build is ready and stored onto cloud, build archive is downloaded + into the output folder. + + Args: + revision: A Git hash revision. + fetch_build: Function to check and download build from cloud storage. + patch: A DEPS patch (used while bisecting 3rd party repositories). + + Returns: + Downloaded archive file path when requested build exists and download is + successful, otherwise None. + """ + # Get SVN revision for the given SHA. + svn_revision = self.source_control.SVNFindRev(revision) + if not svn_revision: + raise RuntimeError( + 'Failed to determine SVN revision for %s' % revision) def GetBuilderNameAndBuildTime(target_arch='ia32'): """Gets builder bot name and buildtime in seconds based on platform.""" @@ -1698,12 +1745,12 @@ class BisectPerformanceMetrics(object): # Create a unique ID for each build request posted to tryserver builders. # This ID is added to "Reason" property in build's json. build_request_id = GetSHA1HexDigest( - '%s-%s-%s' % (revision, patch, time.time())) + '%s-%s-%s' % (svn_revision, patch, time.time())) # Creates a try job description. job_args = {'host': builder_host, 'port': builder_port, - 'revision': 'src@%s' % revision, + 'revision': 'src@%s' % svn_revision, 'bot': bot_name, 'name': build_request_id } @@ -1712,16 +1759,18 @@ class BisectPerformanceMetrics(object): job_args['patch'] = patch # Posts job to build the revision on the server. if bisect_builder.PostTryJob(job_args): - status, error_msg = self.WaitUntilBuildIsReady(fetch_build, - bot_name, - builder_host, - builder_port, - build_request_id, - build_timeout) - if not status: - raise RuntimeError('%s [revision: %s]' % (error_msg, revision)) - return True - return False + target_file, error_msg = self.WaitUntilBuildIsReady(fetch_build, + bot_name, + builder_host, + builder_port, + build_request_id, + build_timeout) + if not target_file: + print '%s [revision: %s]' % (error_msg, svn_revision) + return None + return target_file + print 'Failed to post build request for revision: [%s]' % svn_revision + return None def IsDownloadable(self, depot): """Checks if build is downloadable based on target platform and depot.""" @@ -1921,13 +1970,7 @@ class BisectPerformanceMetrics(object): if depot != 'chromium': # Create a DEPS patch with new revision for dependency repository. (revision, deps_patch) = self.CreateDEPSPatch(depot, revision) - # Get SVN revision for the given SHA, since builds are archived using SVN - # revision. - chromium_revision = self.source_control.SVNFindRev(revision) - if not chromium_revision: - raise RuntimeError( - 'Failed to determine SVN revision for %s' % revision) - if self.DownloadCurrentBuild(chromium_revision, patch=deps_patch): + if self.DownloadCurrentBuild(revision, patch=deps_patch): os.chdir(cwd) if deps_patch: # Reverts the changes to DEPS file. @@ -1935,12 +1978,9 @@ class BisectPerformanceMetrics(object): revision, cwd=self.src_cwd) return True - raise RuntimeError('Failed to download build archive for revision %s.\n' - 'Unfortunately, bisection couldn\'t continue any ' - 'further. Please try running script without ' - '--gs_bucket flag to produce local builds.' % revision) - + return False + # These codes are executed when bisect bots builds binaries locally. build_success = self.builder.Build(depot, self.opts) os.chdir(cwd) return build_success diff --git a/tools/checkperms/checkperms.py b/tools/checkperms/checkperms.py index ffb08043c1..c90f68de89 100755 --- a/tools/checkperms/checkperms.py +++ b/tools/checkperms/checkperms.py @@ -50,6 +50,8 @@ EXECUTABLE_EXTENSIONS = ( # # Case-insensitive, lower-case only. EXECUTABLE_PATHS = ( + 'chrome/test/data/app_shim/app_shim_32_bit.app/contents/' + 'macos/app_mode_loader', 'chrome/test/data/extensions/uitest/plugins/plugin.plugin/contents/' 'macos/testnetscapeplugin', 'chrome/test/data/extensions/uitest/plugins_private/plugin.plugin/contents/' diff --git a/tools/clang/plugins/FindBadConstructs.cpp b/tools/clang/plugins/FindBadConstructs.cpp deleted file mode 100644 index 4b74fbe1f7..0000000000 --- a/tools/clang/plugins/FindBadConstructs.cpp +++ /dev/null @@ -1,779 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file defines a bunch of recurring problems in the Chromium C++ code. -// -// Checks that are implemented: -// - Constructors/Destructors should not be inlined if they are of a complex -// class type. -// - Missing "virtual" keywords on methods that should be virtual. -// - Non-annotated overriding virtual methods. -// - Virtual methods with nonempty implementations in their headers. -// - Classes that derive from base::RefCounted / base::RefCountedThreadSafe -// should have protected or private destructors. -// - WeakPtrFactory members that refer to their outer class should be the last -// member. -// - Enum types with a xxxx_LAST or xxxxLast const actually have that constant -// have the maximal value for that type. - -#include "clang/AST/ASTConsumer.h" -#include "clang/AST/AST.h" -#include "clang/AST/Attr.h" -#include "clang/AST/CXXInheritance.h" -#include "clang/AST/TypeLoc.h" -#include "clang/Basic/SourceManager.h" -#include "clang/Frontend/CompilerInstance.h" -#include "clang/Frontend/FrontendPluginRegistry.h" -#include "clang/Lex/Lexer.h" -#include "llvm/Support/raw_ostream.h" - -#include "ChromeClassTester.h" - -using namespace clang; - -namespace { - -const char kMethodRequiresOverride[] = - "[chromium-style] Overriding method must be marked with OVERRIDE."; -const char kMethodRequiresVirtual[] = - "[chromium-style] Overriding method must have \"virtual\" keyword."; -const char kNoExplicitDtor[] = - "[chromium-style] Classes that are ref-counted should have explicit " - "destructors that are declared protected or private."; -const char kPublicDtor[] = - "[chromium-style] Classes that are ref-counted should have " - "destructors that are declared protected or private."; -const char kProtectedNonVirtualDtor[] = - "[chromium-style] Classes that are ref-counted and have non-private " - "destructors should declare their destructor virtual."; -const char kWeakPtrFactoryOrder[] = - "[chromium-style] WeakPtrFactory members which refer to their outer class " - "must be the last member in the outer class definition."; -const char kBadLastEnumValue[] = - "[chromium-style] _LAST/Last constants of enum types must have the maximal " - "value for any constant of that type."; -const char kNoteInheritance[] = - "[chromium-style] %0 inherits from %1 here"; -const char kNoteImplicitDtor[] = - "[chromium-style] No explicit destructor for %0 defined"; -const char kNotePublicDtor[] = - "[chromium-style] Public destructor declared here"; -const char kNoteProtectedNonVirtualDtor[] = - "[chromium-style] Protected non-virtual destructor declared here"; - -bool TypeHasNonTrivialDtor(const Type* type) { - if (const CXXRecordDecl* cxx_r = type->getPointeeCXXRecordDecl()) - return !cxx_r->hasTrivialDestructor(); - - return false; -} - -// Returns the underlying Type for |type| by expanding typedefs and removing -// any namespace qualifiers. This is similar to desugaring, except that for -// ElaboratedTypes, desugar will unwrap too much. -const Type* UnwrapType(const Type* type) { - if (const ElaboratedType* elaborated = dyn_cast<ElaboratedType>(type)) - return UnwrapType(elaborated->getNamedType().getTypePtr()); - if (const TypedefType* typedefed = dyn_cast<TypedefType>(type)) - return UnwrapType(typedefed->desugar().getTypePtr()); - return type; -} - -struct FindBadConstructsOptions { - FindBadConstructsOptions() : check_base_classes(false), - check_virtuals_in_implementations(true), - check_weak_ptr_factory_order(false), - check_enum_last_value(false) { - } - bool check_base_classes; - bool check_virtuals_in_implementations; - bool check_weak_ptr_factory_order; - bool check_enum_last_value; -}; - -// Searches for constructs that we know we don't want in the Chromium code base. -class FindBadConstructsConsumer : public ChromeClassTester { - public: - FindBadConstructsConsumer(CompilerInstance& instance, - const FindBadConstructsOptions& options) - : ChromeClassTester(instance), - options_(options) { - // Register warning/error messages. - diag_method_requires_override_ = diagnostic().getCustomDiagID( - getErrorLevel(), kMethodRequiresOverride); - diag_method_requires_virtual_ = diagnostic().getCustomDiagID( - getErrorLevel(), kMethodRequiresVirtual); - diag_no_explicit_dtor_ = diagnostic().getCustomDiagID( - getErrorLevel(), kNoExplicitDtor); - diag_public_dtor_ = diagnostic().getCustomDiagID( - getErrorLevel(), kPublicDtor); - diag_protected_non_virtual_dtor_ = diagnostic().getCustomDiagID( - getErrorLevel(), kProtectedNonVirtualDtor); - diag_weak_ptr_factory_order_ = diagnostic().getCustomDiagID( - getErrorLevel(), kWeakPtrFactoryOrder); - diag_bad_enum_last_value_ = diagnostic().getCustomDiagID( - getErrorLevel(), kBadLastEnumValue); - - // Registers notes to make it easier to interpret warnings. - diag_note_inheritance_ = diagnostic().getCustomDiagID( - DiagnosticsEngine::Note, kNoteInheritance); - diag_note_implicit_dtor_ = diagnostic().getCustomDiagID( - DiagnosticsEngine::Note, kNoteImplicitDtor); - diag_note_public_dtor_ = diagnostic().getCustomDiagID( - DiagnosticsEngine::Note, kNotePublicDtor); - diag_note_protected_non_virtual_dtor_ = diagnostic().getCustomDiagID( - DiagnosticsEngine::Note, kNoteProtectedNonVirtualDtor); - } - - virtual void CheckChromeClass(SourceLocation record_location, - CXXRecordDecl* record) { - bool implementation_file = InImplementationFile(record_location); - - if (!implementation_file) { - // Only check for "heavy" constructors/destructors in header files; - // within implementation files, there is no performance cost. - CheckCtorDtorWeight(record_location, record); - } - - if (!implementation_file || options_.check_virtuals_in_implementations) { - bool warn_on_inline_bodies = !implementation_file; - - // Check that all virtual methods are marked accordingly with both - // virtual and OVERRIDE. - CheckVirtualMethods(record_location, record, warn_on_inline_bodies); - } - - CheckRefCountedDtors(record_location, record); - - if (options_.check_weak_ptr_factory_order) - CheckWeakPtrFactoryMembers(record_location, record); - } - - virtual void CheckChromeEnum(SourceLocation enum_location, - EnumDecl* enum_decl) { - if (!options_.check_enum_last_value) - return; - - bool got_one = false; - bool is_signed = false; - llvm::APSInt max_so_far; - EnumDecl::enumerator_iterator iter; - for (iter = enum_decl->enumerator_begin(); - iter != enum_decl->enumerator_end(); ++iter) { - llvm::APSInt current_value = iter->getInitVal(); - if (!got_one) { - max_so_far = current_value; - is_signed = current_value.isSigned(); - got_one = true; - } else { - if (is_signed != current_value.isSigned()) { - // This only happens in some cases when compiling C (not C++) files, - // so it is OK to bail out here. - return; - } - if (current_value > max_so_far) - max_so_far = current_value; - } - } - for (iter = enum_decl->enumerator_begin(); - iter != enum_decl->enumerator_end(); ++iter) { - std::string name = iter->getNameAsString(); - if (((name.size() > 4 && - name.compare(name.size() - 4, 4, "Last") == 0) || - (name.size() > 5 && - name.compare(name.size() - 5, 5, "_LAST") == 0)) && - iter->getInitVal() < max_so_far) { - diagnostic().Report(iter->getLocation(), diag_bad_enum_last_value_); - } - } - } - - private: - // The type of problematic ref-counting pattern that was encountered. - enum RefcountIssue { - None, - ImplicitDestructor, - PublicDestructor - }; - - FindBadConstructsOptions options_; - - unsigned diag_method_requires_override_; - unsigned diag_method_requires_virtual_; - unsigned diag_no_explicit_dtor_; - unsigned diag_public_dtor_; - unsigned diag_protected_non_virtual_dtor_; - unsigned diag_weak_ptr_factory_order_; - unsigned diag_bad_enum_last_value_; - unsigned diag_note_inheritance_; - unsigned diag_note_implicit_dtor_; - unsigned diag_note_public_dtor_; - unsigned diag_note_protected_non_virtual_dtor_; - - // Prints errors if the constructor/destructor weight is too heavy. - void CheckCtorDtorWeight(SourceLocation record_location, - CXXRecordDecl* record) { - // We don't handle anonymous structs. If this record doesn't have a - // name, it's of the form: - // - // struct { - // ... - // } name_; - if (record->getIdentifier() == NULL) - return; - - // Count the number of templated base classes as a feature of whether the - // destructor can be inlined. - int templated_base_classes = 0; - for (CXXRecordDecl::base_class_const_iterator it = record->bases_begin(); - it != record->bases_end(); ++it) { - if (it->getTypeSourceInfo()->getTypeLoc().getTypeLocClass() == - TypeLoc::TemplateSpecialization) { - ++templated_base_classes; - } - } - - // Count the number of trivial and non-trivial member variables. - int trivial_member = 0; - int non_trivial_member = 0; - int templated_non_trivial_member = 0; - for (RecordDecl::field_iterator it = record->field_begin(); - it != record->field_end(); ++it) { - CountType(it->getType().getTypePtr(), - &trivial_member, - &non_trivial_member, - &templated_non_trivial_member); - } - - // Check to see if we need to ban inlined/synthesized constructors. Note - // that the cutoffs here are kind of arbitrary. Scores over 10 break. - int dtor_score = 0; - // Deriving from a templated base class shouldn't be enough to trigger - // the ctor warning, but if you do *anything* else, it should. - // - // TODO(erg): This is motivated by templated base classes that don't have - // any data members. Somehow detect when templated base classes have data - // members and treat them differently. - dtor_score += templated_base_classes * 9; - // Instantiating a template is an insta-hit. - dtor_score += templated_non_trivial_member * 10; - // The fourth normal class member should trigger the warning. - dtor_score += non_trivial_member * 3; - - int ctor_score = dtor_score; - // You should be able to have 9 ints before we warn you. - ctor_score += trivial_member; - - if (ctor_score >= 10) { - if (!record->hasUserDeclaredConstructor()) { - emitWarning(record_location, - "Complex class/struct needs an explicit out-of-line " - "constructor."); - } else { - // Iterate across all the constructors in this file and yell if we - // find one that tries to be inline. - for (CXXRecordDecl::ctor_iterator it = record->ctor_begin(); - it != record->ctor_end(); ++it) { - if (it->hasInlineBody()) { - if (it->isCopyConstructor() && - !record->hasUserDeclaredCopyConstructor()) { - emitWarning(record_location, - "Complex class/struct needs an explicit out-of-line " - "copy constructor."); - } else { - emitWarning(it->getInnerLocStart(), - "Complex constructor has an inlined body."); - } - } - } - } - } - - // The destructor side is equivalent except that we don't check for - // trivial members; 20 ints don't need a destructor. - if (dtor_score >= 10 && !record->hasTrivialDestructor()) { - if (!record->hasUserDeclaredDestructor()) { - emitWarning( - record_location, - "Complex class/struct needs an explicit out-of-line " - "destructor."); - } else if (CXXDestructorDecl* dtor = record->getDestructor()) { - if (dtor->hasInlineBody()) { - emitWarning(dtor->getInnerLocStart(), - "Complex destructor has an inline body."); - } - } - } - } - - void CheckVirtualMethod(const CXXMethodDecl* method, - bool warn_on_inline_bodies) { - if (!method->isVirtual()) - return; - - if (!method->isVirtualAsWritten()) { - SourceLocation loc = method->getTypeSpecStartLoc(); - if (isa<CXXDestructorDecl>(method)) - loc = method->getInnerLocStart(); - SourceManager& manager = instance().getSourceManager(); - FullSourceLoc full_loc(loc, manager); - SourceLocation spelling_loc = manager.getSpellingLoc(loc); - diagnostic().Report(full_loc, diag_method_requires_virtual_) - << FixItHint::CreateInsertion(spelling_loc, "virtual "); - } - - // Virtual methods should not have inline definitions beyond "{}". This - // only matters for header files. - if (warn_on_inline_bodies && method->hasBody() && - method->hasInlineBody()) { - if (CompoundStmt* cs = dyn_cast<CompoundStmt>(method->getBody())) { - if (cs->size()) { - emitWarning( - cs->getLBracLoc(), - "virtual methods with non-empty bodies shouldn't be " - "declared inline."); - } - } - } - } - - bool InTestingNamespace(const Decl* record) { - return GetNamespace(record).find("testing") != std::string::npos; - } - - bool IsMethodInBannedOrTestingNamespace(const CXXMethodDecl* method) { - if (InBannedNamespace(method)) - return true; - for (CXXMethodDecl::method_iterator i = method->begin_overridden_methods(); - i != method->end_overridden_methods(); - ++i) { - const CXXMethodDecl* overridden = *i; - if (IsMethodInBannedOrTestingNamespace(overridden) || - InTestingNamespace(overridden)) { - return true; - } - } - - return false; - } - - void CheckOverriddenMethod(const CXXMethodDecl* method) { - if (!method->size_overridden_methods() || method->getAttr<OverrideAttr>()) - return; - - if (isa<CXXDestructorDecl>(method) || method->isPure()) - return; - - if (IsMethodInBannedOrTestingNamespace(method)) - return; - - SourceManager& manager = instance().getSourceManager(); - SourceRange type_info_range = - method->getTypeSourceInfo()->getTypeLoc().getSourceRange(); - FullSourceLoc loc(type_info_range.getBegin(), manager); - - // Build the FixIt insertion point after the end of the method definition, - // including any const-qualifiers and attributes, and before the opening - // of the l-curly-brace (if inline) or the semi-color (if a declaration). - SourceLocation spelling_end = - manager.getSpellingLoc(type_info_range.getEnd()); - if (spelling_end.isValid()) { - SourceLocation token_end = Lexer::getLocForEndOfToken( - spelling_end, 0, manager, LangOptions()); - diagnostic().Report(token_end, diag_method_requires_override_) - << FixItHint::CreateInsertion(token_end, " OVERRIDE"); - } else { - diagnostic().Report(loc, diag_method_requires_override_); - } - } - - // Makes sure there is a "virtual" keyword on virtual methods. - // - // Gmock objects trigger these for each MOCK_BLAH() macro used. So we have a - // trick to get around that. If a class has member variables whose types are - // in the "testing" namespace (which is how gmock works behind the scenes), - // there's a really high chance we won't care about these errors - void CheckVirtualMethods(SourceLocation record_location, - CXXRecordDecl* record, - bool warn_on_inline_bodies) { - for (CXXRecordDecl::field_iterator it = record->field_begin(); - it != record->field_end(); ++it) { - CXXRecordDecl* record_type = - it->getTypeSourceInfo()->getTypeLoc().getTypePtr()-> - getAsCXXRecordDecl(); - if (record_type) { - if (InTestingNamespace(record_type)) { - return; - } - } - } - - for (CXXRecordDecl::method_iterator it = record->method_begin(); - it != record->method_end(); ++it) { - if (it->isCopyAssignmentOperator() || isa<CXXConstructorDecl>(*it)) { - // Ignore constructors and assignment operators. - } else if (isa<CXXDestructorDecl>(*it) && - !record->hasUserDeclaredDestructor()) { - // Ignore non-user-declared destructors. - } else { - CheckVirtualMethod(*it, warn_on_inline_bodies); - CheckOverriddenMethod(*it); - } - } - } - - void CountType(const Type* type, - int* trivial_member, - int* non_trivial_member, - int* templated_non_trivial_member) { - switch (type->getTypeClass()) { - case Type::Record: { - // Simplifying; the whole class isn't trivial if the dtor is, but - // we use this as a signal about complexity. - if (TypeHasNonTrivialDtor(type)) - (*trivial_member)++; - else - (*non_trivial_member)++; - break; - } - case Type::TemplateSpecialization: { - TemplateName name = - dyn_cast<TemplateSpecializationType>(type)->getTemplateName(); - bool whitelisted_template = false; - - // HACK: I'm at a loss about how to get the syntax checker to get - // whether a template is exterened or not. For the first pass here, - // just do retarded string comparisons. - if (TemplateDecl* decl = name.getAsTemplateDecl()) { - std::string base_name = decl->getNameAsString(); - if (base_name == "basic_string") - whitelisted_template = true; - } - - if (whitelisted_template) - (*non_trivial_member)++; - else - (*templated_non_trivial_member)++; - break; - } - case Type::Elaborated: { - CountType( - dyn_cast<ElaboratedType>(type)->getNamedType().getTypePtr(), - trivial_member, non_trivial_member, templated_non_trivial_member); - break; - } - case Type::Typedef: { - while (const TypedefType* TT = dyn_cast<TypedefType>(type)) { - type = TT->getDecl()->getUnderlyingType().getTypePtr(); - } - CountType(type, trivial_member, non_trivial_member, - templated_non_trivial_member); - break; - } - default: { - // Stupid assumption: anything we see that isn't the above is one of - // the 20 integer types. - (*trivial_member)++; - break; - } - } - } - - // Check |record| for issues that are problematic for ref-counted types. - // Note that |record| may not be a ref-counted type, but a base class for - // a type that is. - // If there are issues, update |loc| with the SourceLocation of the issue - // and returns appropriately, or returns None if there are no issues. - static RefcountIssue CheckRecordForRefcountIssue( - const CXXRecordDecl* record, - SourceLocation &loc) { - if (!record->hasUserDeclaredDestructor()) { - loc = record->getLocation(); - return ImplicitDestructor; - } - - if (CXXDestructorDecl* dtor = record->getDestructor()) { - if (dtor->getAccess() == AS_public) { - loc = dtor->getInnerLocStart(); - return PublicDestructor; - } - } - - return None; - } - - // Adds either a warning or error, based on the current handling of - // -Werror. - DiagnosticsEngine::Level getErrorLevel() { - return diagnostic().getWarningsAsErrors() ? - DiagnosticsEngine::Error : DiagnosticsEngine::Warning; - } - - // Returns true if |base| specifies one of the Chromium reference counted - // classes (base::RefCounted / base::RefCountedThreadSafe). - static bool IsRefCountedCallback(const CXXBaseSpecifier* base, - CXXBasePath& path, - void* user_data) { - FindBadConstructsConsumer* self = - static_cast<FindBadConstructsConsumer*>(user_data); - - const TemplateSpecializationType* base_type = - dyn_cast<TemplateSpecializationType>( - UnwrapType(base->getType().getTypePtr())); - if (!base_type) { - // Base-most definition is not a template, so this cannot derive from - // base::RefCounted. However, it may still be possible to use with a - // scoped_refptr<> and support ref-counting, so this is not a perfect - // guarantee of safety. - return false; - } - - TemplateName name = base_type->getTemplateName(); - if (TemplateDecl* decl = name.getAsTemplateDecl()) { - std::string base_name = decl->getNameAsString(); - - // Check for both base::RefCounted and base::RefCountedThreadSafe. - if (base_name.compare(0, 10, "RefCounted") == 0 && - self->GetNamespace(decl) == "base") { - return true; - } - } - - return false; - } - - // Returns true if |base| specifies a class that has a public destructor, - // either explicitly or implicitly. - static bool HasPublicDtorCallback(const CXXBaseSpecifier* base, - CXXBasePath& path, - void* user_data) { - // Only examine paths that have public inheritance, as they are the - // only ones which will result in the destructor potentially being - // exposed. This check is largely redundant, as Chromium code should be - // exclusively using public inheritance. - if (path.Access != AS_public) - return false; - - CXXRecordDecl* record = dyn_cast<CXXRecordDecl>( - base->getType()->getAs<RecordType>()->getDecl()); - SourceLocation unused; - return None != CheckRecordForRefcountIssue(record, unused); - } - - // Outputs a C++ inheritance chain as a diagnostic aid. - void PrintInheritanceChain(const CXXBasePath& path) { - for (CXXBasePath::const_iterator it = path.begin(); it != path.end(); - ++it) { - diagnostic().Report(it->Base->getLocStart(), diag_note_inheritance_) - << it->Class << it->Base->getType(); - } - } - - unsigned DiagnosticForIssue(RefcountIssue issue) { - switch (issue) { - case ImplicitDestructor: - return diag_no_explicit_dtor_; - case PublicDestructor: - return diag_public_dtor_; - case None: - assert(false && "Do not call DiagnosticForIssue with issue None"); - return 0; - } - assert(false); - return 0; - } - - // Check |record| to determine if it has any problematic refcounting - // issues and, if so, print them as warnings/errors based on the current - // value of getErrorLevel(). - // - // If |record| is a C++ class, and if it inherits from one of the Chromium - // ref-counting classes (base::RefCounted / base::RefCountedThreadSafe), - // ensure that there are no public destructors in the class hierarchy. This - // is to guard against accidentally stack-allocating a RefCounted class or - // sticking it in a non-ref-counted container (like scoped_ptr<>). - void CheckRefCountedDtors(SourceLocation record_location, - CXXRecordDecl* record) { - // Skip anonymous structs. - if (record->getIdentifier() == NULL) - return; - - // Determine if the current type is even ref-counted. - CXXBasePaths refcounted_path; - if (!record->lookupInBases( - &FindBadConstructsConsumer::IsRefCountedCallback, this, - refcounted_path)) { - return; // Class does not derive from a ref-counted base class. - } - - // Easy check: Check to see if the current type is problematic. - SourceLocation loc; - RefcountIssue issue = CheckRecordForRefcountIssue(record, loc); - if (issue != None) { - diagnostic().Report(loc, DiagnosticForIssue(issue)); - PrintInheritanceChain(refcounted_path.front()); - return; - } - if (CXXDestructorDecl* dtor = - refcounted_path.begin()->back().Class->getDestructor()) { - if (dtor->getAccess() == AS_protected && - !dtor->isVirtual()) { - loc = dtor->getInnerLocStart(); - diagnostic().Report(loc, diag_protected_non_virtual_dtor_); - return; - } - } - - // Long check: Check all possible base classes for problematic - // destructors. This checks for situations involving multiple - // inheritance, where the ref-counted class may be implementing an - // interface that has a public or implicit destructor. - // - // struct SomeInterface { - // virtual void DoFoo(); - // }; - // - // struct RefCountedInterface - // : public base::RefCounted<RefCountedInterface>, - // public SomeInterface { - // private: - // friend class base::Refcounted<RefCountedInterface>; - // virtual ~RefCountedInterface() {} - // }; - // - // While RefCountedInterface is "safe", in that its destructor is - // private, it's possible to do the following "unsafe" code: - // scoped_refptr<RefCountedInterface> some_class( - // new RefCountedInterface); - // // Calls SomeInterface::~SomeInterface(), which is unsafe. - // delete static_cast<SomeInterface*>(some_class.get()); - if (!options_.check_base_classes) - return; - - // Find all public destructors. This will record the class hierarchy - // that leads to the public destructor in |dtor_paths|. - CXXBasePaths dtor_paths; - if (!record->lookupInBases( - &FindBadConstructsConsumer::HasPublicDtorCallback, this, - dtor_paths)) { - return; - } - - for (CXXBasePaths::const_paths_iterator it = dtor_paths.begin(); - it != dtor_paths.end(); ++it) { - // The record with the problem will always be the last record - // in the path, since it is the record that stopped the search. - const CXXRecordDecl* problem_record = dyn_cast<CXXRecordDecl>( - it->back().Base->getType()->getAs<RecordType>()->getDecl()); - - issue = CheckRecordForRefcountIssue(problem_record, loc); - - if (issue == ImplicitDestructor) { - diagnostic().Report(record_location, diag_no_explicit_dtor_); - PrintInheritanceChain(refcounted_path.front()); - diagnostic().Report(loc, diag_note_implicit_dtor_) << problem_record; - PrintInheritanceChain(*it); - } else if (issue == PublicDestructor) { - diagnostic().Report(record_location, diag_public_dtor_); - PrintInheritanceChain(refcounted_path.front()); - diagnostic().Report(loc, diag_note_public_dtor_); - PrintInheritanceChain(*it); - } - } - } - - // Check for any problems with WeakPtrFactory class members. This currently - // only checks that any WeakPtrFactory<T> member of T appears as the last - // data member in T. We could consider checking for bad uses of - // WeakPtrFactory to refer to other data members, but that would require - // looking at the initializer list in constructors to see what the factory - // points to. - // Note, if we later add other unrelated checks of data members, we should - // consider collapsing them in to one loop to avoid iterating over the data - // members more than once. - void CheckWeakPtrFactoryMembers(SourceLocation record_location, - CXXRecordDecl* record) { - // Skip anonymous structs. - if (record->getIdentifier() == NULL) - return; - - // Iterate through members of the class. - RecordDecl::field_iterator iter(record->field_begin()), - the_end(record->field_end()); - SourceLocation weak_ptr_factory_location; // Invalid initially. - for (; iter != the_end; ++iter) { - // If we enter the loop but have already seen a matching WeakPtrFactory, - // it means there is at least one member after the factory. - if (weak_ptr_factory_location.isValid()) { - diagnostic().Report(weak_ptr_factory_location, - diag_weak_ptr_factory_order_); - } - const TemplateSpecializationType* template_spec_type = - iter->getType().getTypePtr()->getAs<TemplateSpecializationType>(); - if (template_spec_type) { - const TemplateDecl* template_decl = - template_spec_type->getTemplateName().getAsTemplateDecl(); - if (template_decl && template_spec_type->getNumArgs() >= 1) { - if (template_decl->getNameAsString().compare("WeakPtrFactory") == 0 && - GetNamespace(template_decl) == "base") { - const TemplateArgument& arg = template_spec_type->getArg(0); - if (arg.getAsType().getTypePtr()->getAsCXXRecordDecl() == - record->getTypeForDecl()->getAsCXXRecordDecl()) { - weak_ptr_factory_location = iter->getLocation(); - } - } - } - } - } - } -}; - - -class FindBadConstructsAction : public PluginASTAction { - public: - FindBadConstructsAction() { - } - - protected: - // Overridden from PluginASTAction: - virtual ASTConsumer* CreateASTConsumer(CompilerInstance& instance, - llvm::StringRef ref) { - return new FindBadConstructsConsumer(instance, options_); - } - - virtual bool ParseArgs(const CompilerInstance& instance, - const std::vector<std::string>& args) { - bool parsed = true; - - for (size_t i = 0; i < args.size() && parsed; ++i) { - if (args[i] == "skip-virtuals-in-implementations") { - // TODO(rsleevi): Remove this once http://crbug.com/115047 is fixed. - options_.check_virtuals_in_implementations = false; - } else if (args[i] == "check-base-classes") { - // TODO(rsleevi): Remove this once http://crbug.com/123295 is fixed. - options_.check_base_classes = true; - } else if (args[i] == "check-weak-ptr-factory-order") { - // TODO(dmichael): Remove this once http://crbug.com/303818 is fixed. - options_.check_weak_ptr_factory_order = true; - } else if (args[i] == "check-enum-last-value") { - // TODO(tsepez): Enable this by default once http://crbug.com/356815 - // and http://crbug.com/356816 are fixed. - options_.check_enum_last_value = true; - } else { - parsed = false; - llvm::errs() << "Unknown clang plugin argument: " << args[i] << "\n"; - } - } - - return parsed; - } - - private: - FindBadConstructsOptions options_; -}; - -} // namespace - -static FrontendPluginRegistry::Add<FindBadConstructsAction> -X("find-bad-constructs", "Finds bad C++ constructs"); diff --git a/tools/clang/plugins/FindBadConstructsAction.cpp b/tools/clang/plugins/FindBadConstructsAction.cpp new file mode 100644 index 0000000000..838590d7d3 --- /dev/null +++ b/tools/clang/plugins/FindBadConstructsAction.cpp @@ -0,0 +1,55 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "FindBadConstructsAction.h" + +#include "clang/Frontend/FrontendPluginRegistry.h" + +#include "FindBadConstructsConsumer.h" + +using namespace clang; + +namespace chrome_checker { + +FindBadConstructsAction::FindBadConstructsAction() { +} + +ASTConsumer* FindBadConstructsAction::CreateASTConsumer( + CompilerInstance& instance, + llvm::StringRef ref) { + return new FindBadConstructsConsumer(instance, options_); +} + +bool FindBadConstructsAction::ParseArgs(const CompilerInstance& instance, + const std::vector<std::string>& args) { + bool parsed = true; + + for (size_t i = 0; i < args.size() && parsed; ++i) { + if (args[i] == "skip-virtuals-in-implementations") { + // TODO(rsleevi): Remove this once http://crbug.com/115047 is fixed. + options_.check_virtuals_in_implementations = false; + } else if (args[i] == "check-base-classes") { + // TODO(rsleevi): Remove this once http://crbug.com/123295 is fixed. + options_.check_base_classes = true; + } else if (args[i] == "check-weak-ptr-factory-order") { + // TODO(dmichael): Remove this once http://crbug.com/303818 is fixed. + options_.check_weak_ptr_factory_order = true; + } else if (args[i] == "check-enum-last-value") { + // TODO(tsepez): Enable this by default once http://crbug.com/356815 + // and http://crbug.com/356816 are fixed. + options_.check_enum_last_value = true; + } else { + parsed = false; + llvm::errs() << "Unknown clang plugin argument: " << args[i] << "\n"; + } + } + + return parsed; +} + +} // namespace chrome_checker + +static FrontendPluginRegistry::Add<chrome_checker::FindBadConstructsAction> X( + "find-bad-constructs", + "Finds bad C++ constructs"); diff --git a/tools/clang/plugins/FindBadConstructsAction.h b/tools/clang/plugins/FindBadConstructsAction.h new file mode 100644 index 0000000000..887d339cca --- /dev/null +++ b/tools/clang/plugins/FindBadConstructsAction.h @@ -0,0 +1,32 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef TOOLS_CLANG_PLUGINS_FINDBADCONSTRUCTIONS_ACTION_H_ +#define TOOLS_CLANG_PLUGINS_FINDBADCONSTRUCTIONS_ACTION_H_ + +#include "clang/Frontend/FrontendAction.h" + +#include "Options.h" + +namespace chrome_checker { + +class FindBadConstructsAction : public clang::PluginASTAction { + public: + FindBadConstructsAction(); + + protected: + // Overridden from PluginASTAction: + virtual clang::ASTConsumer* CreateASTConsumer( + clang::CompilerInstance& instance, + llvm::StringRef ref); + virtual bool ParseArgs(const clang::CompilerInstance& instance, + const std::vector<std::string>& args); + + private: + Options options_; +}; + +} // namespace chrome_checker + +#endif // TOOLS_CLANG_PLUGINS_FINDBADCONSTRUCTIONS_ACTION_H_ diff --git a/tools/clang/plugins/FindBadConstructsConsumer.cpp b/tools/clang/plugins/FindBadConstructsConsumer.cpp new file mode 100644 index 0000000000..c4219a1ff2 --- /dev/null +++ b/tools/clang/plugins/FindBadConstructsConsumer.cpp @@ -0,0 +1,687 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "FindBadConstructsConsumer.h" + +#include "clang/Frontend/CompilerInstance.h" +#include "clang/Lex/Lexer.h" +#include "llvm/Support/raw_ostream.h" + +using namespace clang; + +namespace chrome_checker { + +namespace { + +const char kMethodRequiresOverride[] = + "[chromium-style] Overriding method must be marked with OVERRIDE."; +const char kMethodRequiresVirtual[] = + "[chromium-style] Overriding method must have \"virtual\" keyword."; +const char kNoExplicitDtor[] = + "[chromium-style] Classes that are ref-counted should have explicit " + "destructors that are declared protected or private."; +const char kPublicDtor[] = + "[chromium-style] Classes that are ref-counted should have " + "destructors that are declared protected or private."; +const char kProtectedNonVirtualDtor[] = + "[chromium-style] Classes that are ref-counted and have non-private " + "destructors should declare their destructor virtual."; +const char kWeakPtrFactoryOrder[] = + "[chromium-style] WeakPtrFactory members which refer to their outer class " + "must be the last member in the outer class definition."; +const char kBadLastEnumValue[] = + "[chromium-style] _LAST/Last constants of enum types must have the maximal " + "value for any constant of that type."; +const char kNoteInheritance[] = "[chromium-style] %0 inherits from %1 here"; +const char kNoteImplicitDtor[] = + "[chromium-style] No explicit destructor for %0 defined"; +const char kNotePublicDtor[] = + "[chromium-style] Public destructor declared here"; +const char kNoteProtectedNonVirtualDtor[] = + "[chromium-style] Protected non-virtual destructor declared here"; + +bool TypeHasNonTrivialDtor(const Type* type) { + if (const CXXRecordDecl* cxx_r = type->getPointeeCXXRecordDecl()) + return !cxx_r->hasTrivialDestructor(); + + return false; +} + +// Returns the underlying Type for |type| by expanding typedefs and removing +// any namespace qualifiers. This is similar to desugaring, except that for +// ElaboratedTypes, desugar will unwrap too much. +const Type* UnwrapType(const Type* type) { + if (const ElaboratedType* elaborated = dyn_cast<ElaboratedType>(type)) + return UnwrapType(elaborated->getNamedType().getTypePtr()); + if (const TypedefType* typedefed = dyn_cast<TypedefType>(type)) + return UnwrapType(typedefed->desugar().getTypePtr()); + return type; +} + +} // namespace + +FindBadConstructsConsumer::FindBadConstructsConsumer(CompilerInstance& instance, + const Options& options) + : ChromeClassTester(instance), options_(options) { + // Register warning/error messages. + diag_method_requires_override_ = + diagnostic().getCustomDiagID(getErrorLevel(), kMethodRequiresOverride); + diag_method_requires_virtual_ = + diagnostic().getCustomDiagID(getErrorLevel(), kMethodRequiresVirtual); + diag_no_explicit_dtor_ = + diagnostic().getCustomDiagID(getErrorLevel(), kNoExplicitDtor); + diag_public_dtor_ = + diagnostic().getCustomDiagID(getErrorLevel(), kPublicDtor); + diag_protected_non_virtual_dtor_ = + diagnostic().getCustomDiagID(getErrorLevel(), kProtectedNonVirtualDtor); + diag_weak_ptr_factory_order_ = + diagnostic().getCustomDiagID(getErrorLevel(), kWeakPtrFactoryOrder); + diag_bad_enum_last_value_ = + diagnostic().getCustomDiagID(getErrorLevel(), kBadLastEnumValue); + + // Registers notes to make it easier to interpret warnings. + diag_note_inheritance_ = + diagnostic().getCustomDiagID(DiagnosticsEngine::Note, kNoteInheritance); + diag_note_implicit_dtor_ = + diagnostic().getCustomDiagID(DiagnosticsEngine::Note, kNoteImplicitDtor); + diag_note_public_dtor_ = + diagnostic().getCustomDiagID(DiagnosticsEngine::Note, kNotePublicDtor); + diag_note_protected_non_virtual_dtor_ = diagnostic().getCustomDiagID( + DiagnosticsEngine::Note, kNoteProtectedNonVirtualDtor); +} + +void FindBadConstructsConsumer::CheckChromeClass(SourceLocation record_location, + CXXRecordDecl* record) { + bool implementation_file = InImplementationFile(record_location); + + if (!implementation_file) { + // Only check for "heavy" constructors/destructors in header files; + // within implementation files, there is no performance cost. + CheckCtorDtorWeight(record_location, record); + } + + if (!implementation_file || options_.check_virtuals_in_implementations) { + bool warn_on_inline_bodies = !implementation_file; + + // Check that all virtual methods are marked accordingly with both + // virtual and OVERRIDE. + CheckVirtualMethods(record_location, record, warn_on_inline_bodies); + } + + CheckRefCountedDtors(record_location, record); + + if (options_.check_weak_ptr_factory_order) + CheckWeakPtrFactoryMembers(record_location, record); +} + +void FindBadConstructsConsumer::CheckChromeEnum(SourceLocation enum_location, + EnumDecl* enum_decl) { + if (!options_.check_enum_last_value) + return; + + bool got_one = false; + bool is_signed = false; + llvm::APSInt max_so_far; + EnumDecl::enumerator_iterator iter; + for (iter = enum_decl->enumerator_begin(); + iter != enum_decl->enumerator_end(); + ++iter) { + llvm::APSInt current_value = iter->getInitVal(); + if (!got_one) { + max_so_far = current_value; + is_signed = current_value.isSigned(); + got_one = true; + } else { + if (is_signed != current_value.isSigned()) { + // This only happens in some cases when compiling C (not C++) files, + // so it is OK to bail out here. + return; + } + if (current_value > max_so_far) + max_so_far = current_value; + } + } + for (iter = enum_decl->enumerator_begin(); + iter != enum_decl->enumerator_end(); + ++iter) { + std::string name = iter->getNameAsString(); + if (((name.size() > 4 && name.compare(name.size() - 4, 4, "Last") == 0) || + (name.size() > 5 && name.compare(name.size() - 5, 5, "_LAST") == 0)) && + iter->getInitVal() < max_so_far) { + diagnostic().Report(iter->getLocation(), diag_bad_enum_last_value_); + } + } +} + +void FindBadConstructsConsumer::CheckCtorDtorWeight( + SourceLocation record_location, + CXXRecordDecl* record) { + // We don't handle anonymous structs. If this record doesn't have a + // name, it's of the form: + // + // struct { + // ... + // } name_; + if (record->getIdentifier() == NULL) + return; + + // Count the number of templated base classes as a feature of whether the + // destructor can be inlined. + int templated_base_classes = 0; + for (CXXRecordDecl::base_class_const_iterator it = record->bases_begin(); + it != record->bases_end(); + ++it) { + if (it->getTypeSourceInfo()->getTypeLoc().getTypeLocClass() == + TypeLoc::TemplateSpecialization) { + ++templated_base_classes; + } + } + + // Count the number of trivial and non-trivial member variables. + int trivial_member = 0; + int non_trivial_member = 0; + int templated_non_trivial_member = 0; + for (RecordDecl::field_iterator it = record->field_begin(); + it != record->field_end(); + ++it) { + CountType(it->getType().getTypePtr(), + &trivial_member, + &non_trivial_member, + &templated_non_trivial_member); + } + + // Check to see if we need to ban inlined/synthesized constructors. Note + // that the cutoffs here are kind of arbitrary. Scores over 10 break. + int dtor_score = 0; + // Deriving from a templated base class shouldn't be enough to trigger + // the ctor warning, but if you do *anything* else, it should. + // + // TODO(erg): This is motivated by templated base classes that don't have + // any data members. Somehow detect when templated base classes have data + // members and treat them differently. + dtor_score += templated_base_classes * 9; + // Instantiating a template is an insta-hit. + dtor_score += templated_non_trivial_member * 10; + // The fourth normal class member should trigger the warning. + dtor_score += non_trivial_member * 3; + + int ctor_score = dtor_score; + // You should be able to have 9 ints before we warn you. + ctor_score += trivial_member; + + if (ctor_score >= 10) { + if (!record->hasUserDeclaredConstructor()) { + emitWarning(record_location, + "Complex class/struct needs an explicit out-of-line " + "constructor."); + } else { + // Iterate across all the constructors in this file and yell if we + // find one that tries to be inline. + for (CXXRecordDecl::ctor_iterator it = record->ctor_begin(); + it != record->ctor_end(); + ++it) { + if (it->hasInlineBody()) { + if (it->isCopyConstructor() && + !record->hasUserDeclaredCopyConstructor()) { + emitWarning(record_location, + "Complex class/struct needs an explicit out-of-line " + "copy constructor."); + } else { + emitWarning(it->getInnerLocStart(), + "Complex constructor has an inlined body."); + } + } + } + } + } + + // The destructor side is equivalent except that we don't check for + // trivial members; 20 ints don't need a destructor. + if (dtor_score >= 10 && !record->hasTrivialDestructor()) { + if (!record->hasUserDeclaredDestructor()) { + emitWarning(record_location, + "Complex class/struct needs an explicit out-of-line " + "destructor."); + } else if (CXXDestructorDecl* dtor = record->getDestructor()) { + if (dtor->hasInlineBody()) { + emitWarning(dtor->getInnerLocStart(), + "Complex destructor has an inline body."); + } + } + } +} + +void FindBadConstructsConsumer::CheckVirtualMethod(const CXXMethodDecl* method, + bool warn_on_inline_bodies) { + if (!method->isVirtual()) + return; + + if (!method->isVirtualAsWritten()) { + SourceLocation loc = method->getTypeSpecStartLoc(); + if (isa<CXXDestructorDecl>(method)) + loc = method->getInnerLocStart(); + SourceManager& manager = instance().getSourceManager(); + FullSourceLoc full_loc(loc, manager); + SourceLocation spelling_loc = manager.getSpellingLoc(loc); + diagnostic().Report(full_loc, diag_method_requires_virtual_) + << FixItHint::CreateInsertion(spelling_loc, "virtual "); + } + + // Virtual methods should not have inline definitions beyond "{}". This + // only matters for header files. + if (warn_on_inline_bodies && method->hasBody() && method->hasInlineBody()) { + if (CompoundStmt* cs = dyn_cast<CompoundStmt>(method->getBody())) { + if (cs->size()) { + emitWarning(cs->getLBracLoc(), + "virtual methods with non-empty bodies shouldn't be " + "declared inline."); + } + } + } +} + +bool FindBadConstructsConsumer::InTestingNamespace(const Decl* record) { + return GetNamespace(record).find("testing") != std::string::npos; +} + +bool FindBadConstructsConsumer::IsMethodInBannedOrTestingNamespace( + const CXXMethodDecl* method) { + if (InBannedNamespace(method)) + return true; + for (CXXMethodDecl::method_iterator i = method->begin_overridden_methods(); + i != method->end_overridden_methods(); + ++i) { + const CXXMethodDecl* overridden = *i; + if (IsMethodInBannedOrTestingNamespace(overridden) || + InTestingNamespace(overridden)) { + return true; + } + } + + return false; +} + +void FindBadConstructsConsumer::CheckOverriddenMethod( + const CXXMethodDecl* method) { + if (!method->size_overridden_methods() || method->getAttr<OverrideAttr>()) + return; + + if (isa<CXXDestructorDecl>(method) || method->isPure()) + return; + + if (IsMethodInBannedOrTestingNamespace(method)) + return; + + SourceManager& manager = instance().getSourceManager(); + SourceRange type_info_range = + method->getTypeSourceInfo()->getTypeLoc().getSourceRange(); + FullSourceLoc loc(type_info_range.getBegin(), manager); + + // Build the FixIt insertion point after the end of the method definition, + // including any const-qualifiers and attributes, and before the opening + // of the l-curly-brace (if inline) or the semi-color (if a declaration). + SourceLocation spelling_end = + manager.getSpellingLoc(type_info_range.getEnd()); + if (spelling_end.isValid()) { + SourceLocation token_end = + Lexer::getLocForEndOfToken(spelling_end, 0, manager, LangOptions()); + diagnostic().Report(token_end, diag_method_requires_override_) + << FixItHint::CreateInsertion(token_end, " OVERRIDE"); + } else { + diagnostic().Report(loc, diag_method_requires_override_); + } +} + +// Makes sure there is a "virtual" keyword on virtual methods. +// +// Gmock objects trigger these for each MOCK_BLAH() macro used. So we have a +// trick to get around that. If a class has member variables whose types are +// in the "testing" namespace (which is how gmock works behind the scenes), +// there's a really high chance we won't care about these errors +void FindBadConstructsConsumer::CheckVirtualMethods( + SourceLocation record_location, + CXXRecordDecl* record, + bool warn_on_inline_bodies) { + for (CXXRecordDecl::field_iterator it = record->field_begin(); + it != record->field_end(); + ++it) { + CXXRecordDecl* record_type = it->getTypeSourceInfo() + ->getTypeLoc() + .getTypePtr() + ->getAsCXXRecordDecl(); + if (record_type) { + if (InTestingNamespace(record_type)) { + return; + } + } + } + + for (CXXRecordDecl::method_iterator it = record->method_begin(); + it != record->method_end(); + ++it) { + if (it->isCopyAssignmentOperator() || isa<CXXConstructorDecl>(*it)) { + // Ignore constructors and assignment operators. + } else if (isa<CXXDestructorDecl>(*it) && + !record->hasUserDeclaredDestructor()) { + // Ignore non-user-declared destructors. + } else { + CheckVirtualMethod(*it, warn_on_inline_bodies); + CheckOverriddenMethod(*it); + } + } +} + +void FindBadConstructsConsumer::CountType(const Type* type, + int* trivial_member, + int* non_trivial_member, + int* templated_non_trivial_member) { + switch (type->getTypeClass()) { + case Type::Record: { + // Simplifying; the whole class isn't trivial if the dtor is, but + // we use this as a signal about complexity. + if (TypeHasNonTrivialDtor(type)) + (*trivial_member)++; + else + (*non_trivial_member)++; + break; + } + case Type::TemplateSpecialization: { + TemplateName name = + dyn_cast<TemplateSpecializationType>(type)->getTemplateName(); + bool whitelisted_template = false; + + // HACK: I'm at a loss about how to get the syntax checker to get + // whether a template is exterened or not. For the first pass here, + // just do retarded string comparisons. + if (TemplateDecl* decl = name.getAsTemplateDecl()) { + std::string base_name = decl->getNameAsString(); + if (base_name == "basic_string") + whitelisted_template = true; + } + + if (whitelisted_template) + (*non_trivial_member)++; + else + (*templated_non_trivial_member)++; + break; + } + case Type::Elaborated: { + CountType(dyn_cast<ElaboratedType>(type)->getNamedType().getTypePtr(), + trivial_member, + non_trivial_member, + templated_non_trivial_member); + break; + } + case Type::Typedef: { + while (const TypedefType* TT = dyn_cast<TypedefType>(type)) { + type = TT->getDecl()->getUnderlyingType().getTypePtr(); + } + CountType(type, + trivial_member, + non_trivial_member, + templated_non_trivial_member); + break; + } + default: { + // Stupid assumption: anything we see that isn't the above is one of + // the 20 integer types. + (*trivial_member)++; + break; + } + } +} + +// Check |record| for issues that are problematic for ref-counted types. +// Note that |record| may not be a ref-counted type, but a base class for +// a type that is. +// If there are issues, update |loc| with the SourceLocation of the issue +// and returns appropriately, or returns None if there are no issues. +FindBadConstructsConsumer::RefcountIssue +FindBadConstructsConsumer::CheckRecordForRefcountIssue( + const CXXRecordDecl* record, + SourceLocation& loc) { + if (!record->hasUserDeclaredDestructor()) { + loc = record->getLocation(); + return ImplicitDestructor; + } + + if (CXXDestructorDecl* dtor = record->getDestructor()) { + if (dtor->getAccess() == AS_public) { + loc = dtor->getInnerLocStart(); + return PublicDestructor; + } + } + + return None; +} + +// Adds either a warning or error, based on the current handling of +// -Werror. +DiagnosticsEngine::Level FindBadConstructsConsumer::getErrorLevel() { + return diagnostic().getWarningsAsErrors() ? DiagnosticsEngine::Error + : DiagnosticsEngine::Warning; +} + +// Returns true if |base| specifies one of the Chromium reference counted +// classes (base::RefCounted / base::RefCountedThreadSafe). +bool FindBadConstructsConsumer::IsRefCountedCallback( + const CXXBaseSpecifier* base, + CXXBasePath& path, + void* user_data) { + FindBadConstructsConsumer* self = + static_cast<FindBadConstructsConsumer*>(user_data); + + const TemplateSpecializationType* base_type = + dyn_cast<TemplateSpecializationType>( + UnwrapType(base->getType().getTypePtr())); + if (!base_type) { + // Base-most definition is not a template, so this cannot derive from + // base::RefCounted. However, it may still be possible to use with a + // scoped_refptr<> and support ref-counting, so this is not a perfect + // guarantee of safety. + return false; + } + + TemplateName name = base_type->getTemplateName(); + if (TemplateDecl* decl = name.getAsTemplateDecl()) { + std::string base_name = decl->getNameAsString(); + + // Check for both base::RefCounted and base::RefCountedThreadSafe. + if (base_name.compare(0, 10, "RefCounted") == 0 && + self->GetNamespace(decl) == "base") { + return true; + } + } + + return false; +} + +// Returns true if |base| specifies a class that has a public destructor, +// either explicitly or implicitly. +bool FindBadConstructsConsumer::HasPublicDtorCallback( + const CXXBaseSpecifier* base, + CXXBasePath& path, + void* user_data) { + // Only examine paths that have public inheritance, as they are the + // only ones which will result in the destructor potentially being + // exposed. This check is largely redundant, as Chromium code should be + // exclusively using public inheritance. + if (path.Access != AS_public) + return false; + + CXXRecordDecl* record = + dyn_cast<CXXRecordDecl>(base->getType()->getAs<RecordType>()->getDecl()); + SourceLocation unused; + return None != CheckRecordForRefcountIssue(record, unused); +} + +// Outputs a C++ inheritance chain as a diagnostic aid. +void FindBadConstructsConsumer::PrintInheritanceChain(const CXXBasePath& path) { + for (CXXBasePath::const_iterator it = path.begin(); it != path.end(); ++it) { + diagnostic().Report(it->Base->getLocStart(), diag_note_inheritance_) + << it->Class << it->Base->getType(); + } +} + +unsigned FindBadConstructsConsumer::DiagnosticForIssue(RefcountIssue issue) { + switch (issue) { + case ImplicitDestructor: + return diag_no_explicit_dtor_; + case PublicDestructor: + return diag_public_dtor_; + case None: + assert(false && "Do not call DiagnosticForIssue with issue None"); + return 0; + } + assert(false); + return 0; +} + +// Check |record| to determine if it has any problematic refcounting +// issues and, if so, print them as warnings/errors based on the current +// value of getErrorLevel(). +// +// If |record| is a C++ class, and if it inherits from one of the Chromium +// ref-counting classes (base::RefCounted / base::RefCountedThreadSafe), +// ensure that there are no public destructors in the class hierarchy. This +// is to guard against accidentally stack-allocating a RefCounted class or +// sticking it in a non-ref-counted container (like scoped_ptr<>). +void FindBadConstructsConsumer::CheckRefCountedDtors( + SourceLocation record_location, + CXXRecordDecl* record) { + // Skip anonymous structs. + if (record->getIdentifier() == NULL) + return; + + // Determine if the current type is even ref-counted. + CXXBasePaths refcounted_path; + if (!record->lookupInBases(&FindBadConstructsConsumer::IsRefCountedCallback, + this, + refcounted_path)) { + return; // Class does not derive from a ref-counted base class. + } + + // Easy check: Check to see if the current type is problematic. + SourceLocation loc; + RefcountIssue issue = CheckRecordForRefcountIssue(record, loc); + if (issue != None) { + diagnostic().Report(loc, DiagnosticForIssue(issue)); + PrintInheritanceChain(refcounted_path.front()); + return; + } + if (CXXDestructorDecl* dtor = + refcounted_path.begin()->back().Class->getDestructor()) { + if (dtor->getAccess() == AS_protected && !dtor->isVirtual()) { + loc = dtor->getInnerLocStart(); + diagnostic().Report(loc, diag_protected_non_virtual_dtor_); + return; + } + } + + // Long check: Check all possible base classes for problematic + // destructors. This checks for situations involving multiple + // inheritance, where the ref-counted class may be implementing an + // interface that has a public or implicit destructor. + // + // struct SomeInterface { + // virtual void DoFoo(); + // }; + // + // struct RefCountedInterface + // : public base::RefCounted<RefCountedInterface>, + // public SomeInterface { + // private: + // friend class base::Refcounted<RefCountedInterface>; + // virtual ~RefCountedInterface() {} + // }; + // + // While RefCountedInterface is "safe", in that its destructor is + // private, it's possible to do the following "unsafe" code: + // scoped_refptr<RefCountedInterface> some_class( + // new RefCountedInterface); + // // Calls SomeInterface::~SomeInterface(), which is unsafe. + // delete static_cast<SomeInterface*>(some_class.get()); + if (!options_.check_base_classes) + return; + + // Find all public destructors. This will record the class hierarchy + // that leads to the public destructor in |dtor_paths|. + CXXBasePaths dtor_paths; + if (!record->lookupInBases(&FindBadConstructsConsumer::HasPublicDtorCallback, + this, + dtor_paths)) { + return; + } + + for (CXXBasePaths::const_paths_iterator it = dtor_paths.begin(); + it != dtor_paths.end(); + ++it) { + // The record with the problem will always be the last record + // in the path, since it is the record that stopped the search. + const CXXRecordDecl* problem_record = dyn_cast<CXXRecordDecl>( + it->back().Base->getType()->getAs<RecordType>()->getDecl()); + + issue = CheckRecordForRefcountIssue(problem_record, loc); + + if (issue == ImplicitDestructor) { + diagnostic().Report(record_location, diag_no_explicit_dtor_); + PrintInheritanceChain(refcounted_path.front()); + diagnostic().Report(loc, diag_note_implicit_dtor_) << problem_record; + PrintInheritanceChain(*it); + } else if (issue == PublicDestructor) { + diagnostic().Report(record_location, diag_public_dtor_); + PrintInheritanceChain(refcounted_path.front()); + diagnostic().Report(loc, diag_note_public_dtor_); + PrintInheritanceChain(*it); + } + } +} + +// Check for any problems with WeakPtrFactory class members. This currently +// only checks that any WeakPtrFactory<T> member of T appears as the last +// data member in T. We could consider checking for bad uses of +// WeakPtrFactory to refer to other data members, but that would require +// looking at the initializer list in constructors to see what the factory +// points to. +// Note, if we later add other unrelated checks of data members, we should +// consider collapsing them in to one loop to avoid iterating over the data +// members more than once. +void FindBadConstructsConsumer::CheckWeakPtrFactoryMembers( + SourceLocation record_location, + CXXRecordDecl* record) { + // Skip anonymous structs. + if (record->getIdentifier() == NULL) + return; + + // Iterate through members of the class. + RecordDecl::field_iterator iter(record->field_begin()), + the_end(record->field_end()); + SourceLocation weak_ptr_factory_location; // Invalid initially. + for (; iter != the_end; ++iter) { + // If we enter the loop but have already seen a matching WeakPtrFactory, + // it means there is at least one member after the factory. + if (weak_ptr_factory_location.isValid()) { + diagnostic().Report(weak_ptr_factory_location, + diag_weak_ptr_factory_order_); + } + const TemplateSpecializationType* template_spec_type = + iter->getType().getTypePtr()->getAs<TemplateSpecializationType>(); + if (template_spec_type) { + const TemplateDecl* template_decl = + template_spec_type->getTemplateName().getAsTemplateDecl(); + if (template_decl && template_spec_type->getNumArgs() >= 1) { + if (template_decl->getNameAsString().compare("WeakPtrFactory") == 0 && + GetNamespace(template_decl) == "base") { + const TemplateArgument& arg = template_spec_type->getArg(0); + if (arg.getAsType().getTypePtr()->getAsCXXRecordDecl() == + record->getTypeForDecl()->getAsCXXRecordDecl()) { + weak_ptr_factory_location = iter->getLocation(); + } + } + } + } + } +} + +} // namespace chrome_checker diff --git a/tools/clang/plugins/FindBadConstructsConsumer.h b/tools/clang/plugins/FindBadConstructsConsumer.h new file mode 100644 index 0000000000..4e511939cb --- /dev/null +++ b/tools/clang/plugins/FindBadConstructsConsumer.h @@ -0,0 +1,100 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file defines a bunch of recurring problems in the Chromium C++ code. +// +// Checks that are implemented: +// - Constructors/Destructors should not be inlined if they are of a complex +// class type. +// - Missing "virtual" keywords on methods that should be virtual. +// - Non-annotated overriding virtual methods. +// - Virtual methods with nonempty implementations in their headers. +// - Classes that derive from base::RefCounted / base::RefCountedThreadSafe +// should have protected or private destructors. +// - WeakPtrFactory members that refer to their outer class should be the last +// member. +// - Enum types with a xxxx_LAST or xxxxLast const actually have that constant +// have the maximal value for that type. + +#include "clang/AST/AST.h" +#include "clang/AST/ASTConsumer.h" +#include "clang/AST/Attr.h" +#include "clang/AST/CXXInheritance.h" +#include "clang/AST/TypeLoc.h" +#include "clang/Basic/SourceManager.h" + +#include "ChromeClassTester.h" +#include "Options.h" + +namespace chrome_checker { + +// Searches for constructs that we know we don't want in the Chromium code base. +class FindBadConstructsConsumer : public ChromeClassTester { + public: + FindBadConstructsConsumer(clang::CompilerInstance& instance, + const Options& options); + + // ChromeClassTester overrides: + virtual void CheckChromeClass(clang::SourceLocation record_location, + clang::CXXRecordDecl* record); + virtual void CheckChromeEnum(clang::SourceLocation enum_location, + clang::EnumDecl* enum_decl); + + private: + // The type of problematic ref-counting pattern that was encountered. + enum RefcountIssue { None, ImplicitDestructor, PublicDestructor }; + + void CheckCtorDtorWeight(clang::SourceLocation record_location, + clang::CXXRecordDecl* record); + + void CheckVirtualMethod(const clang::CXXMethodDecl* method, + bool warn_on_inline_bodies); + + bool InTestingNamespace(const clang::Decl* record); + bool IsMethodInBannedOrTestingNamespace(const clang::CXXMethodDecl* method); + + void CheckOverriddenMethod(const clang::CXXMethodDecl* method); + void CheckVirtualMethods(clang::SourceLocation record_location, + clang::CXXRecordDecl* record, + bool warn_on_inline_bodies); + + void CountType(const clang::Type* type, + int* trivial_member, + int* non_trivial_member, + int* templated_non_trivial_member); + + static RefcountIssue CheckRecordForRefcountIssue( + const clang::CXXRecordDecl* record, + clang::SourceLocation& loc); + clang::DiagnosticsEngine::Level getErrorLevel(); + static bool IsRefCountedCallback(const clang::CXXBaseSpecifier* base, + clang::CXXBasePath& path, + void* user_data); + static bool HasPublicDtorCallback(const clang::CXXBaseSpecifier* base, + clang::CXXBasePath& path, + void* user_data); + void PrintInheritanceChain(const clang::CXXBasePath& path); + unsigned DiagnosticForIssue(RefcountIssue issue); + void CheckRefCountedDtors(clang::SourceLocation record_location, + clang::CXXRecordDecl* record); + + void CheckWeakPtrFactoryMembers(clang::SourceLocation record_location, + clang::CXXRecordDecl* record); + + const Options options_; + + unsigned diag_method_requires_override_; + unsigned diag_method_requires_virtual_; + unsigned diag_no_explicit_dtor_; + unsigned diag_public_dtor_; + unsigned diag_protected_non_virtual_dtor_; + unsigned diag_weak_ptr_factory_order_; + unsigned diag_bad_enum_last_value_; + unsigned diag_note_inheritance_; + unsigned diag_note_implicit_dtor_; + unsigned diag_note_public_dtor_; + unsigned diag_note_protected_non_virtual_dtor_; +}; + +} // namespace chrome_checker diff --git a/tools/clang/plugins/Options.h b/tools/clang/plugins/Options.h new file mode 100644 index 0000000000..bb50124d57 --- /dev/null +++ b/tools/clang/plugins/Options.h @@ -0,0 +1,25 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef TOOLS_CLANG_PLUGINS_OPTIONS_H_ +#define TOOLS_CLANG_PLUGINS_OPTIONS_H_ + +namespace chrome_checker { + +struct Options { + Options() + : check_base_classes(false), + check_virtuals_in_implementations(true), + check_weak_ptr_factory_order(false), + check_enum_last_value(false) {} + + bool check_base_classes; + bool check_virtuals_in_implementations; + bool check_weak_ptr_factory_order; + bool check_enum_last_value; +}; + +} // namespace chrome_checker + +#endif // TOOLS_CLANG_PLUGINS_OPTIONS_H_ diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py index d0ba883078..97b1d0c931 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py @@ -18,6 +18,12 @@ import sys # Note: this revision is only used for Windows. Other platforms use update.sh. LLVM_WIN_REVISION = 'HEAD' +# ASan on Windows is useful enough to use it even while the clang/win is still +# in bringup. Use a pinned revision to make it slightly more stable. +if (re.search(r'\b(asan)=1', os.environ.get('GYP_DEFINES', '')) and + not 'LLVM_FORCE_HEAD_REVISION' in os.environ): + LLVM_WIN_REVISION = '210586' + # Path constants. (All of these should be absolute paths.) THIS_DIR = os.path.abspath(os.path.dirname(__file__)) CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..')) diff --git a/tools/gn/command_desc.cc b/tools/gn/command_desc.cc index d178233827..4491920da9 100644 --- a/tools/gn/command_desc.cc +++ b/tools/gn/command_desc.cc @@ -276,7 +276,7 @@ void PrintOutputs(const Target* target, bool display_header) { std::vector<std::string> output_strings; FileTemplate file_template = FileTemplate::GetForTargetOutputs(target); for (size_t i = 0; i < target->sources().size(); i++) - file_template.ApplyString(target->sources()[i].value(), &output_strings); + file_template.Apply(target->sources()[i], &output_strings); std::sort(output_strings.begin(), output_strings.end()); for (size_t i = 0; i < output_strings.size(); i++) { diff --git a/tools/gn/file_template.cc b/tools/gn/file_template.cc index b00eb39173..2809920ea2 100644 --- a/tools/gn/file_template.cc +++ b/tools/gn/file_template.cc @@ -15,6 +15,10 @@ const char FileTemplate::kSource[] = "{{source}}"; const char FileTemplate::kSourceNamePart[] = "{{source_name_part}}"; const char FileTemplate::kSourceFilePart[] = "{{source_file_part}}"; +const char FileTemplate::kSourceDir[] = "{{source_dir}}"; +const char FileTemplate::kRootRelDir[] = "{{source_root_relative_dir}}"; +const char FileTemplate::kSourceGenDir[] = "{{source_gen_dir}}"; +const char FileTemplate::kSourceOutDir[] = "{{source_out_dir}}"; const char kSourceExpansion_Help[] = "How Source Expansion Works\n" @@ -44,17 +48,47 @@ const char kSourceExpansion_Help[] = " directory (which is the current directory when running compilers\n" " and scripts). This will generally be used for specifying inputs\n" " to a script in the \"args\" variable.\n" + " \"//foo/bar/baz.txt\" => \"../../foo/bar/baz.txt\"\n" "\n" " {{source_file_part}}\n" - " The file part of the source including the extension. For the\n" - " source \"foo/bar.txt\" the source file part will be \"bar.txt\".\n" + " The file part of the source including the extension.\n" + " \"//foo/bar/baz.txt\" => \"baz.txt\"\n" "\n" " {{source_name_part}}\n" " The filename part of the source file with no directory or\n" " extension. This will generally be used for specifying a\n" " transformation from a soruce file to a destination file with the\n" - " same name but different extension. For the source \"foo/bar.txt\"\n" - " the source name part will be \"bar\".\n" + " same name but different extension.\n" + " \"//foo/bar/baz.txt\" => \"baz\"\n" + "\n" + " {{source_dir}}\n" + " The directory containing the source file, relative to the build\n" + " directory, with no trailing slash.\n" + " \"//foo/bar/baz.txt\" => \"../../foo/bar\"\n" + "\n" + " {{source_root_relative_dir}}\n" + " The path to the source file's directory relative to the source\n" + " root, with no leading \"//\" or trailing slashes. If the path is\n" + " system-absolute, (beginning in a single slash) this will just\n" + " return the path with no trailing slash.\n" + " \"//foo/bar/baz.txt\" => \"foo/bar\"\n" + "\n" + " {{source_gen_dir}}\n" + " The generated file directory corresponding to the source file's\n" + " path, relative to the build directory. This will be different than\n" + " the target's generated file directory if the source file is in a\n" + " different directory than the build.gn file. If the input path is\n" + " system absolute, this will return the root generated file\n" + " directory." + " \"//foo/bar/baz.txt\" => \"gen/foo/bar\"\n" + "\n" + " {{source_out_dir}}\n" + " The object file directory corresponding to the source file's\n" + " path, relative to the build directory. this us be different than\n" + " the target's out directory if the source file is in a different\n" + " directory than the build.gn file. if the input path is system\n" + " absolute, this will return the root generated file directory.\n" + " \"//foo/bar/baz.txt\" => \"obj/foo/bar\"\n" "\n" "Examples\n" "\n" @@ -78,21 +112,26 @@ const char kSourceExpansion_Help[] = " //out/Debug/obj/mydirectory/input2.h\n" " //out/Debug/obj/mydirectory/input2.cc\n"; -FileTemplate::FileTemplate(const Value& t, Err* err) - : has_substitutions_(false) { +FileTemplate::FileTemplate(const Settings* settings, const Value& t, Err* err) + : settings_(settings), + has_substitutions_(false) { std::fill(types_required_, &types_required_[Subrange::NUM_TYPES], false); ParseInput(t, err); } -FileTemplate::FileTemplate(const std::vector<std::string>& t) - : has_substitutions_(false) { +FileTemplate::FileTemplate(const Settings* settings, + const std::vector<std::string>& t) + : settings_(settings), + has_substitutions_(false) { std::fill(types_required_, &types_required_[Subrange::NUM_TYPES], false); for (size_t i = 0; i < t.size(); i++) ParseOneTemplateString(t[i]); } -FileTemplate::FileTemplate(const std::vector<SourceFile>& t) - : has_substitutions_(false) { +FileTemplate::FileTemplate(const Settings* settings, + const std::vector<SourceFile>& t) + : settings_(settings), + has_substitutions_(false) { std::fill(types_required_, &types_required_[Subrange::NUM_TYPES], false); for (size_t i = 0; i < t.size(); i++) ParseOneTemplateString(t[i].value()); @@ -107,7 +146,7 @@ FileTemplate FileTemplate::GetForTargetOutputs(const Target* target) { std::vector<std::string> output_template_args; for (size_t i = 0; i < outputs.size(); i++) output_template_args.push_back(outputs[i].value()); - return FileTemplate(output_template_args); + return FileTemplate(target->settings(), output_template_args); } bool FileTemplate::IsTypeUsed(Subrange::Type type) const { @@ -115,37 +154,16 @@ bool FileTemplate::IsTypeUsed(Subrange::Type type) const { return types_required_[type]; } -void FileTemplate::Apply(const Value& sources, - const ParseNode* origin, - std::vector<Value>* dest, - Err* err) const { - if (!sources.VerifyTypeIs(Value::LIST, err)) - return; - dest->reserve(sources.list_value().size() * templates_.container().size()); - - // Temporary holding place, allocate outside to re-use- buffer. - std::vector<std::string> string_output; - - const std::vector<Value>& sources_list = sources.list_value(); - for (size_t i = 0; i < sources_list.size(); i++) { - string_output.clear(); - if (!sources_list[i].VerifyTypeIs(Value::STRING, err)) - return; - - ApplyString(sources_list[i].string_value(), &string_output); - for (size_t out_i = 0; out_i < string_output.size(); out_i++) - dest->push_back(Value(origin, string_output[out_i])); - } -} - -void FileTemplate::ApplyString(const std::string& str, - std::vector<std::string>* output) const { +void FileTemplate::Apply(const SourceFile& source, + std::vector<std::string>* output) const { // Compute all substitutions needed so we can just do substitutions below. // We skip the LITERAL one since that varies each time. std::string subst[Subrange::NUM_TYPES]; for (int i = 1; i < Subrange::NUM_TYPES; i++) { - if (types_required_[i]) - subst[i] = GetSubstitution(str, static_cast<Subrange::Type>(i)); + if (types_required_[i]) { + subst[i] = + GetSubstitution(settings_, source, static_cast<Subrange::Type>(i)); + } } size_t first_output_index = output->size(); @@ -209,13 +227,15 @@ void FileTemplate::WriteWithNinjaExpansions(std::ostream& out) const { void FileTemplate::WriteNinjaVariablesForSubstitution( std::ostream& out, - const std::string& source, + const Settings* settings, + const SourceFile& source, const EscapeOptions& escape_options) const { for (int i = 1; i < Subrange::NUM_TYPES; i++) { if (types_required_[i]) { Subrange::Type type = static_cast<Subrange::Type>(i); out << " " << GetNinjaVariableNameForType(type) << " = "; - EscapeStringToStream(out, GetSubstitution(source, type), escape_options); + EscapeStringToStream(out, GetSubstitution(settings, source, type), + escape_options); out << std::endl; } } @@ -230,6 +250,15 @@ const char* FileTemplate::GetNinjaVariableNameForType(Subrange::Type type) { return "source_name_part"; case Subrange::FILE_PART: return "source_file_part"; + case Subrange::SOURCE_DIR: + return "source_dir"; + case Subrange::ROOT_RELATIVE_DIR: + return "source_root_rel_dir"; + case Subrange::SOURCE_GEN_DIR: + return "source_gen_dir"; + case Subrange::SOURCE_OUT_DIR: + return "source_out_dir"; + default: NOTREACHED(); } @@ -237,15 +266,47 @@ const char* FileTemplate::GetNinjaVariableNameForType(Subrange::Type type) { } // static -std::string FileTemplate::GetSubstitution(const std::string& source, +std::string FileTemplate::GetSubstitution(const Settings* settings, + const SourceFile& source, Subrange::Type type) { switch (type) { case Subrange::SOURCE: - return source; + if (source.is_system_absolute()) + return source.value(); + return RebaseSourceAbsolutePath(source.value(), + settings->build_settings()->build_dir()); + case Subrange::NAME_PART: - return FindFilenameNoExtension(&source).as_string(); + return FindFilenameNoExtension(&source.value()).as_string(); + case Subrange::FILE_PART: - return FindFilename(&source).as_string(); + return source.GetName(); + + case Subrange::SOURCE_DIR: + if (source.is_system_absolute()) + return DirectoryWithNoLastSlash(source.GetDir()); + return RebaseSourceAbsolutePath( + DirectoryWithNoLastSlash(source.GetDir()), + settings->build_settings()->build_dir()); + + case Subrange::ROOT_RELATIVE_DIR: + if (source.is_system_absolute()) + return DirectoryWithNoLastSlash(source.GetDir()); + return RebaseSourceAbsolutePath( + DirectoryWithNoLastSlash(source.GetDir()), SourceDir("//")); + + case Subrange::SOURCE_GEN_DIR: + return RebaseSourceAbsolutePath( + DirectoryWithNoLastSlash( + GetGenDirForSourceDir(settings, source.GetDir())), + settings->build_settings()->build_dir()); + + case Subrange::SOURCE_OUT_DIR: + return RebaseSourceAbsolutePath( + DirectoryWithNoLastSlash( + GetOutputDirForSourceDir(settings, source.GetDir())), + settings->build_settings()->build_dir()); + default: NOTREACHED(); } @@ -288,30 +349,34 @@ void FileTemplate::ParseOneTemplateString(const std::string& str) { Subrange(Subrange::LITERAL, str.substr(cur, next - cur))); } + // Given the name of the string constant and enum for a template parameter, + // checks for it and stores it. Writing this as a function requires passing + // the entire state of this function as arguments, so this actually ends + // up being more clear. + #define IF_MATCH_THEN_STORE(const_name, enum_name) \ + if (str.compare(next, arraysize(const_name) - 1, const_name) == 0) { \ + t.container().push_back(Subrange(Subrange::enum_name)); \ + types_required_[Subrange::enum_name] = true; \ + has_substitutions_ = true; \ + cur = next + arraysize(const_name) - 1; \ + } + // Decode the template param. - if (str.compare(next, arraysize(kSource) - 1, kSource) == 0) { - t.container().push_back(Subrange(Subrange::SOURCE)); - types_required_[Subrange::SOURCE] = true; - has_substitutions_ = true; - cur = next + arraysize(kSource) - 1; - } else if (str.compare(next, arraysize(kSourceNamePart) - 1, - kSourceNamePart) == 0) { - t.container().push_back(Subrange(Subrange::NAME_PART)); - types_required_[Subrange::NAME_PART] = true; - has_substitutions_ = true; - cur = next + arraysize(kSourceNamePart) - 1; - } else if (str.compare(next, arraysize(kSourceFilePart) - 1, - kSourceFilePart) == 0) { - t.container().push_back(Subrange(Subrange::FILE_PART)); - types_required_[Subrange::FILE_PART] = true; - has_substitutions_ = true; - cur = next + arraysize(kSourceFilePart) - 1; - } else { + IF_MATCH_THEN_STORE(kSource, SOURCE) + else IF_MATCH_THEN_STORE(kSourceNamePart, NAME_PART) + else IF_MATCH_THEN_STORE(kSourceFilePart, FILE_PART) + else IF_MATCH_THEN_STORE(kSourceDir, SOURCE_DIR) + else IF_MATCH_THEN_STORE(kRootRelDir, ROOT_RELATIVE_DIR) + else IF_MATCH_THEN_STORE(kSourceGenDir, SOURCE_GEN_DIR) + else IF_MATCH_THEN_STORE(kSourceOutDir, SOURCE_OUT_DIR) + else { // If it's not a match, treat it like a one-char literal (this will be // rare, so it's not worth the bother to add to the previous literal) so // we can keep going. t.container().push_back(Subrange(Subrange::LITERAL, "{")); cur = next + 1; } + + #undef IF_MATCH_THEN_STORE } } diff --git a/tools/gn/file_template.h b/tools/gn/file_template.h index 30b40da620..b04a6c7f4c 100644 --- a/tools/gn/file_template.h +++ b/tools/gn/file_template.h @@ -14,6 +14,7 @@ struct EscapeOptions; class ParseNode; +class Settings; class SourceFile; class Target; @@ -30,20 +31,17 @@ extern const char kSourceExpansion_Help[]; class FileTemplate { public: struct Subrange { + // See the help in the .cc file for what these mean. enum Type { LITERAL = 0, - // {{source}} -> expands to be the source file name relative to the build - // root dir. - SOURCE, - - // {{source_name_part}} -> file name without extension or directory. - // Maps "foo/bar.txt" to "bar". - NAME_PART, - - // {{source_file_part}} -> file name including extension but no directory. - // Maps "foo/bar.txt" to "bar.txt". - FILE_PART, + SOURCE, // {{source}} + NAME_PART, // {{source_name_part}} + FILE_PART, // {{source_file_part}} + SOURCE_DIR, // {{source_dir}} + ROOT_RELATIVE_DIR, // {{root_relative_dir}} + SOURCE_GEN_DIR, // {{source_gen_dir}} + SOURCE_OUT_DIR, // {{source_out_dir}} NUM_TYPES // Must be last }; @@ -60,9 +58,9 @@ class FileTemplate { // Constructs a template from the given value. On error, the err will be // set. In this case you should not use this object. - FileTemplate(const Value& t, Err* err); - FileTemplate(const std::vector<std::string>& t); - FileTemplate(const std::vector<SourceFile>& t); + FileTemplate(const Settings* settings, const Value& t, Err* err); + FileTemplate(const Settings* settings, const std::vector<std::string>& t); + FileTemplate(const Settings* settings, const std::vector<SourceFile>& t); ~FileTemplate(); @@ -76,18 +74,10 @@ class FileTemplate { // Returns true if there are any substitutions. bool has_substitutions() const { return has_substitutions_; } - // Applies this template to the given list of sources, appending all - // results to the given dest list. The sources must be a list for the - // one that takes a value as an input, otherwise the given error will be set. - void Apply(const Value& sources, - const ParseNode* origin, - std::vector<Value>* dest, - Err* err) const; - - // Low-level version of Apply that handles one source file. The results - // will be *appended* to the output. - void ApplyString(const std::string& input, - std::vector<std::string>* output) const; + // Applies the template to one source file. The results will be *appended* to + // the output. + void Apply(const SourceFile& source, + std::vector<std::string>* output) const; // Writes a string representing the template with Ninja variables for the // substitutions, and the literals escaped for Ninja consumption. @@ -115,7 +105,8 @@ class FileTemplate { // (see GetWithNinjaExpansions). void WriteNinjaVariablesForSubstitution( std::ostream& out, - const std::string& source, + const Settings* settings, + const SourceFile& source, const EscapeOptions& escape_options) const; // Returns the Ninja variable name used by the above Ninja functions to @@ -124,13 +115,18 @@ class FileTemplate { // Extracts the given type of substitution from the given source. The source // should be the file name relative to the output directory. - static std::string GetSubstitution(const std::string& source, + static std::string GetSubstitution(const Settings* settings, + const SourceFile& source, Subrange::Type type); // Known template types, these include the "{{ }}" static const char kSource[]; static const char kSourceNamePart[]; static const char kSourceFilePart[]; + static const char kSourceDir[]; + static const char kRootRelDir[]; + static const char kSourceGenDir[]; + static const char kSourceOutDir[]; private: typedef base::StackVector<Subrange, 8> Template; @@ -141,6 +137,8 @@ class FileTemplate { // Parses a template string and adds it to the templates_ list. void ParseOneTemplateString(const std::string& str); + const Settings* settings_; + TemplateVector templates_; // The corresponding value is set to true if the given subrange type is diff --git a/tools/gn/file_template_unittest.cc b/tools/gn/file_template_unittest.cc index 8e3bf40b90..d10791eeb4 100644 --- a/tools/gn/file_template_unittest.cc +++ b/tools/gn/file_template_unittest.cc @@ -7,58 +7,62 @@ #include "testing/gtest/include/gtest/gtest.h" #include "tools/gn/escape.h" #include "tools/gn/file_template.h" +#include "tools/gn/test_with_scope.h" TEST(FileTemplate, Static) { + TestWithScope setup; + std::vector<std::string> templates; templates.push_back("something_static"); - FileTemplate t(templates); + FileTemplate t(setup.settings(), templates); EXPECT_FALSE(t.has_substitutions()); std::vector<std::string> result; - t.ApplyString("", &result); - ASSERT_EQ(1u, result.size()); - EXPECT_EQ("something_static", result[0]); - - result.clear(); - t.ApplyString("lalala", &result); + t.Apply(SourceFile("//foo/bar"), &result); ASSERT_EQ(1u, result.size()); EXPECT_EQ("something_static", result[0]); } TEST(FileTemplate, Typical) { + TestWithScope setup; + std::vector<std::string> templates; templates.push_back("foo/{{source_name_part}}.cc"); templates.push_back("foo/{{source_name_part}}.h"); - FileTemplate t(templates); + FileTemplate t(setup.settings(), templates); EXPECT_TRUE(t.has_substitutions()); std::vector<std::string> result; - t.ApplyString("sources/ha.idl", &result); + t.Apply(SourceFile("//sources/ha.idl"), &result); ASSERT_EQ(2u, result.size()); EXPECT_EQ("foo/ha.cc", result[0]); EXPECT_EQ("foo/ha.h", result[1]); } TEST(FileTemplate, Weird) { + TestWithScope setup; + std::vector<std::string> templates; templates.push_back("{{{source}}{{source}}{{"); - FileTemplate t(templates); + FileTemplate t(setup.settings(), templates); EXPECT_TRUE(t.has_substitutions()); std::vector<std::string> result; - t.ApplyString("foo/lalala.c", &result); + t.Apply(SourceFile("//foo/lalala.c"), &result); ASSERT_EQ(1u, result.size()); - EXPECT_EQ("{foo/lalala.cfoo/lalala.c{{", result[0]); + EXPECT_EQ("{../../foo/lalala.c../../foo/lalala.c{{", result[0]); } TEST(FileTemplate, NinjaExpansions) { + TestWithScope setup; + std::vector<std::string> templates; templates.push_back("-i"); templates.push_back("{{source}}"); templates.push_back("--out=foo bar\"{{source_name_part}}\".o"); templates.push_back(""); // Test empty string. - FileTemplate t(templates); + FileTemplate t(setup.settings(), templates); std::ostringstream out; t.WriteWithNinjaExpansions(out); @@ -79,21 +83,64 @@ TEST(FileTemplate, NinjaExpansions) { } TEST(FileTemplate, NinjaVariables) { + TestWithScope setup; + std::vector<std::string> templates; templates.push_back("-i"); templates.push_back("{{source}}"); templates.push_back("--out=foo bar\"{{source_name_part}}\".o"); + templates.push_back("{{source_file_part}}"); + templates.push_back("{{source_dir}}"); + templates.push_back("{{source_root_relative_dir}}"); + templates.push_back("{{source_gen_dir}}"); + templates.push_back("{{source_out_dir}}"); - FileTemplate t(templates); + FileTemplate t(setup.settings(), templates); std::ostringstream out; EscapeOptions options; options.mode = ESCAPE_NINJA_COMMAND; - t.WriteNinjaVariablesForSubstitution(out, "../../foo/bar.txt", options); + t.WriteNinjaVariablesForSubstitution(out, setup.settings(), + SourceFile("//foo/bar.txt"), options); // Just the variables used above should be written. EXPECT_EQ( " source = ../../foo/bar.txt\n" - " source_name_part = bar\n", + " source_name_part = bar\n" + " source_file_part = bar.txt\n" + " source_dir = ../../foo\n" + " source_root_rel_dir = foo\n" + " source_gen_dir = gen/foo\n" + " source_out_dir = obj/foo\n", out.str()); } + +// Tests in isolation different types of substitutions and that the right +// things are generated. +TEST(FileTemplate, Substitutions) { + TestWithScope setup; + + #define GetSubst(str, what) \ + FileTemplate::GetSubstitution(setup.settings(), \ + SourceFile(str), \ + FileTemplate::Subrange::what) + + // Try all possible templates with a normal looking string. + EXPECT_EQ("../../foo/bar/baz.txt", GetSubst("//foo/bar/baz.txt", SOURCE)); + EXPECT_EQ("baz", GetSubst("//foo/bar/baz.txt", NAME_PART)); + EXPECT_EQ("baz.txt", GetSubst("//foo/bar/baz.txt", FILE_PART)); + EXPECT_EQ("../../foo/bar", GetSubst("//foo/bar/baz.txt", SOURCE_DIR)); + EXPECT_EQ("foo/bar", GetSubst("//foo/bar/baz.txt", ROOT_RELATIVE_DIR)); + EXPECT_EQ("gen/foo/bar", GetSubst("//foo/bar/baz.txt", SOURCE_GEN_DIR)); + EXPECT_EQ("obj/foo/bar", GetSubst("//foo/bar/baz.txt", SOURCE_OUT_DIR)); + + // Operations on an absolute path. + EXPECT_EQ("/baz.txt", GetSubst("/baz.txt", SOURCE)); + EXPECT_EQ("/.", GetSubst("/baz.txt", SOURCE_DIR)); + EXPECT_EQ("gen", GetSubst("/baz.txt", SOURCE_GEN_DIR)); + EXPECT_EQ("obj", GetSubst("/baz.txt", SOURCE_OUT_DIR)); + + EXPECT_EQ(".", GetSubst("//baz.txt", ROOT_RELATIVE_DIR)); + + #undef GetSubst +} diff --git a/tools/gn/filesystem_utils.cc b/tools/gn/filesystem_utils.cc index 4cfefa9dc7..ca4562574d 100644 --- a/tools/gn/filesystem_utils.cc +++ b/tools/gn/filesystem_utils.cc @@ -720,10 +720,12 @@ SourceDir GetOutputDirForSourceDir(const Settings* settings, toolchain.SwapValue(&ret); ret.append("obj/"); - // The source dir should be source-absolute, so we trim off the two leading - // slashes to append to the toolchain object directory. - DCHECK(source_dir.is_source_absolute()); - ret.append(&source_dir.value()[2], source_dir.value().size() - 2); + if (source_dir.is_source_absolute()) { + // The source dir is source-absolute, so we trim off the two leading + // slashes to append to the toolchain object directory. + ret.append(&source_dir.value()[2], source_dir.value().size() - 2); + } + // (Put system-absolute stuff in the root obj directory.) return SourceDir(SourceDir::SWAP_IN, &ret); } @@ -735,10 +737,13 @@ SourceDir GetGenDirForSourceDir(const Settings* settings, std::string ret; toolchain.SwapValue(&ret); - // The source dir should be source-absolute, so we trim off the two leading - // slashes to append to the toolchain object directory. - DCHECK(source_dir.is_source_absolute()); - ret.append(&source_dir.value()[2], source_dir.value().size() - 2); + if (source_dir.is_source_absolute()) { + // The source dir should be source-absolute, so we trim off the two leading + // slashes to append to the toolchain object directory. + DCHECK(source_dir.is_source_absolute()); + ret.append(&source_dir.value()[2], source_dir.value().size() - 2); + } + // (Put system-absolute stuff in the root gen directory.) return SourceDir(SourceDir::SWAP_IN, &ret); } diff --git a/tools/gn/function_get_path_info.cc b/tools/gn/function_get_path_info.cc index 23f690cfdc..ea6651c2f0 100644 --- a/tools/gn/function_get_path_info.cc +++ b/tools/gn/function_get_path_info.cc @@ -20,9 +20,25 @@ enum What { WHAT_EXTENSION, WHAT_DIR, WHAT_ABSPATH, + WHAT_GEN_DIR, + WHAT_OUT_DIR, }; -std::string GetOnePathInfo(const SourceDir& current_dir, +// Returns the directory containing the input (resolving it against the +// |current_dir|), regardless of whether the input is a directory or a file. +SourceDir DirForInput(const SourceDir& current_dir, + const std::string& input_string) { + if (!input_string.empty() && input_string[input_string.size() - 1] == '/') { + // Input is a directory. + return current_dir.ResolveRelativeDir(input_string); + } + + // Input is a directory. + return current_dir.ResolveRelativeFile(input_string).GetDir(); +} + +std::string GetOnePathInfo(const Settings* settings, + const SourceDir& current_dir, What what, const Value& input, Err* err) { @@ -62,6 +78,16 @@ std::string GetOnePathInfo(const SourceDir& current_dir, return std::string("//."); return dir_incl_slash.substr(0, dir_incl_slash.size() - 1).as_string(); } + case WHAT_GEN_DIR: { + return DirectoryWithNoLastSlash( + GetGenDirForSourceDir(settings, + DirForInput(current_dir, input_string))); + } + case WHAT_OUT_DIR: { + return DirectoryWithNoLastSlash( + GetOutputDirForSourceDir(settings, + DirForInput(current_dir, input_string))); + } case WHAT_ABSPATH: { if (!input_string.empty() && input_string[input_string.size() - 1] == '/') return current_dir.ResolveRelativeDir(input_string).value(); @@ -123,6 +149,16 @@ const char kGetPathInfo_Help[] = " will be appended such that it is always legal to append a slash\n" " and a filename and get a valid path.\n" "\n" + " \"out_dir\"\n" + " The output file directory corresponding to the path of the\n" + " given file, not including a trailing slash.\n" + " \"//foo/bar/baz.txt\" => \"//out/Default/obj/foo/bar\"\n" + + " \"gen_dir\"\n" + " The generated file directory corresponding to the path of the\n" + " given file, not including a trailing slash.\n" + " \"//foo/bar/baz.txt\" => \"//out/Default/gen/foo/bar\"\n" + "\n" " \"abspath\"\n" " The full absolute path name to the file or directory. It will be\n" " resolved relative to the currebt directory, and then the source-\n" @@ -168,6 +204,10 @@ Value RunGetPathInfo(Scope* scope, what = WHAT_EXTENSION; } else if (args[1].string_value() == "dir") { what = WHAT_DIR; + } else if (args[1].string_value() == "out_dir") { + what = WHAT_OUT_DIR; + } else if (args[1].string_value() == "gen_dir") { + what = WHAT_GEN_DIR; } else if (args[1].string_value() == "abspath") { what = WHAT_ABSPATH; } else { @@ -177,13 +217,15 @@ Value RunGetPathInfo(Scope* scope, const SourceDir& current_dir = scope->GetSourceDir(); if (args[0].type() == Value::STRING) { - return Value(function, GetOnePathInfo(current_dir, what, args[0], err)); + return Value(function, GetOnePathInfo(scope->settings(), current_dir, what, + args[0], err)); } else if (args[0].type() == Value::LIST) { const std::vector<Value>& input_list = args[0].list_value(); Value result(function, Value::LIST); for (size_t i = 0; i < input_list.size(); i++) { result.list_value().push_back(Value(function, - GetOnePathInfo(current_dir, what, input_list[i], err))); + GetOnePathInfo(scope->settings(), current_dir, what, + input_list[i], err))); if (err->has_error()) return Value(); } diff --git a/tools/gn/function_get_path_info_unittest.cc b/tools/gn/function_get_path_info_unittest.cc index 12bdc2a5ad..1756c0c3f4 100644 --- a/tools/gn/function_get_path_info_unittest.cc +++ b/tools/gn/function_get_path_info_unittest.cc @@ -87,3 +87,25 @@ TEST_F(GetPathInfoTest, AbsPath) { EXPECT_EQ("/foo/", Call("/foo/", "abspath")); EXPECT_EQ("/", Call("/", "abspath")); } + +// Note build dir is "//out/Debug/". +TEST_F(GetPathInfoTest, OutDir) { + EXPECT_EQ("//out/Debug/obj/src/foo/foo", Call("foo/bar.txt", "out_dir")); + EXPECT_EQ("//out/Debug/obj/src/foo/bar", Call("bar/", "out_dir")); + EXPECT_EQ("//out/Debug/obj/src/foo", Call(".", "out_dir")); + EXPECT_EQ("//out/Debug/obj/src/foo", Call("bar", "out_dir")); + EXPECT_EQ("//out/Debug/obj/foo", Call("//foo/bar.txt", "out_dir")); + // System paths go into the root obj directory. + EXPECT_EQ("//out/Debug/obj", Call("/foo/bar.txt", "out_dir")); +} + +// Note build dir is "//out/Debug/". +TEST_F(GetPathInfoTest, GenDir) { + EXPECT_EQ("//out/Debug/gen/src/foo/foo", Call("foo/bar.txt", "gen_dir")); + EXPECT_EQ("//out/Debug/gen/src/foo/bar", Call("bar/", "gen_dir")); + EXPECT_EQ("//out/Debug/gen/src/foo", Call(".", "gen_dir")); + EXPECT_EQ("//out/Debug/gen/src/foo", Call("bar", "gen_dir")); + EXPECT_EQ("//out/Debug/gen/foo", Call("//foo/bar.txt", "gen_dir")); + // System paths go into the root obj directory. + EXPECT_EQ("//out/Debug/gen", Call("/foo/bar.txt", "gen_dir")); +} diff --git a/tools/gn/function_get_target_outputs.cc b/tools/gn/function_get_target_outputs.cc index 370fee9cb2..be014f26b3 100644 --- a/tools/gn/function_get_target_outputs.cc +++ b/tools/gn/function_get_target_outputs.cc @@ -15,7 +15,7 @@ namespace functions { namespace { -void GetOutputsForTarget(const BuildSettings* build_settings, +void GetOutputsForTarget(const Settings* settings, const Target* target, std::vector<std::string>* ret) { switch (target->output_type()) { @@ -31,10 +31,10 @@ void GetOutputsForTarget(const BuildSettings* build_settings, case Target::ACTION_FOREACH: { // Action_foreach: return the result of the template in the outputs. - FileTemplate file_template(target->action_values().outputs()); + FileTemplate file_template(settings, target->action_values().outputs()); const std::vector<SourceFile>& sources = target->sources(); for (size_t i = 0; i < sources.size(); i++) - file_template.ApplyString(sources[i].value(), ret); + file_template.Apply(sources[i], ret); break; } @@ -50,11 +50,12 @@ void GetOutputsForTarget(const BuildSettings* build_settings, case Target::GROUP: case Target::SOURCE_SET: { // These return the stamp file, which is computed by the NinjaHelper. - NinjaHelper helper(build_settings); + NinjaHelper helper(settings->build_settings()); OutputFile output_file = helper.GetTargetOutputFile(target); // The output file is relative to the build dir. - std::string absolute_output_file = build_settings->build_dir().value(); + std::string absolute_output_file = + settings->build_settings()->build_dir().value(); absolute_output_file.append(output_file.value()); ret->push_back(absolute_output_file); @@ -168,7 +169,7 @@ Value RunGetTargetOutputs(Scope* scope, } std::vector<std::string> files; - GetOutputsForTarget(scope->settings()->build_settings(), target, &files); + GetOutputsForTarget(scope->settings(), target, &files); Value ret(function, Value::LIST); ret.list_value().reserve(files.size()); diff --git a/tools/gn/function_process_file_template.cc b/tools/gn/function_process_file_template.cc index 5d4c9d7b4e..061c9017db 100644 --- a/tools/gn/function_process_file_template.cc +++ b/tools/gn/function_process_file_template.cc @@ -5,6 +5,10 @@ #include "tools/gn/file_template.h" #include "tools/gn/functions.h" #include "tools/gn/parse_tree.h" +#include "tools/gn/scope.h" +#include "tools/gn/settings.h" +#include "tools/gn/target.h" +#include "tools/gn/value_extractors.h" namespace functions { @@ -67,12 +71,26 @@ Value RunProcessFileTemplate(Scope* scope, return Value(); } - FileTemplate file_template(args[1], err); + FileTemplate file_template(scope->settings(), args[1], err); if (err->has_error()) return Value(); + Target::FileList input_files; + if (!ExtractListOfRelativeFiles(scope->settings()->build_settings(), args[0], + scope->GetSourceDir(), &input_files, err)) + return Value(); + Value ret(function, Value::LIST); - file_template.Apply(args[0], function, &ret.list_value(), err); + + // Temporary holding place, allocate outside to re-use buffer. + std::vector<std::string> string_output; + + for (size_t i = 0; i < input_files.size(); i++) { + string_output.clear(); + file_template.Apply(input_files[i], &string_output); + for (size_t out_i = 0; out_i < string_output.size(); out_i++) + ret.list_value().push_back(Value(function, string_output[out_i])); + } return ret; } diff --git a/tools/gn/ninja_action_target_writer.cc b/tools/gn/ninja_action_target_writer.cc index 7f14e74660..6a632e789e 100644 --- a/tools/gn/ninja_action_target_writer.cc +++ b/tools/gn/ninja_action_target_writer.cc @@ -23,7 +23,8 @@ NinjaActionTargetWriter::~NinjaActionTargetWriter() { } void NinjaActionTargetWriter::Run() { - FileTemplate args_template(target_->action_values().args()); + FileTemplate args_template(target_->settings(), + target_->action_values().args()); std::string custom_rule_name = WriteRuleDefinition(args_template); // Collect our deps to pass as "extra hard dependencies" for input deps. This @@ -136,14 +137,11 @@ std::string NinjaActionTargetWriter::WriteRuleDefinition( void NinjaActionTargetWriter::WriteArgsSubstitutions( const SourceFile& source, const FileTemplate& args_template) { - std::ostringstream source_file_stream; - path_output_no_escaping_.WriteFile(source_file_stream, source); - EscapeOptions template_escape_options; template_escape_options.mode = ESCAPE_NINJA_COMMAND; args_template.WriteNinjaVariablesForSubstitution( - out_, source_file_stream.str(), template_escape_options); + out_, target_->settings(), source, template_escape_options); } void NinjaActionTargetWriter::WriteSourceRules( @@ -208,7 +206,7 @@ void NinjaActionTargetWriter::WriteOutputFilesForBuildLine( const SourceFile& source, std::vector<OutputFile>* output_files) { std::vector<std::string> output_template_result; - output_template.ApplyString(source.value(), &output_template_result); + output_template.Apply(source, &output_template_result); for (size_t out_i = 0; out_i < output_template_result.size(); out_i++) { OutputFile output_path(output_template_result[out_i]); output_files->push_back(output_path); @@ -219,7 +217,7 @@ void NinjaActionTargetWriter::WriteOutputFilesForBuildLine( void NinjaActionTargetWriter::WriteDepfile(const SourceFile& source) { std::vector<std::string> result; - GetDepfileTemplate().ApplyString(source.value(), &result); + GetDepfileTemplate().Apply(source, &result); path_output_.WriteFile(out_, OutputFile(result[0])); } @@ -229,5 +227,5 @@ FileTemplate NinjaActionTargetWriter::GetDepfileTemplate() const { RemovePrefix(target_->action_values().depfile().value(), settings_->build_settings()->build_dir().value()); template_args.push_back(depfile_relative_to_build_dir); - return FileTemplate(template_args); + return FileTemplate(settings_, template_args); } diff --git a/tools/gn/ninja_action_target_writer_unittest.cc b/tools/gn/ninja_action_target_writer_unittest.cc index 9899e2cbb7..c6aa5f8516 100644 --- a/tools/gn/ninja_action_target_writer_unittest.cc +++ b/tools/gn/ninja_action_target_writer_unittest.cc @@ -44,7 +44,7 @@ TEST(NinjaActionTargetWriter, WriteArgsSubstitutions) { args.push_back("-i"); args.push_back("{{source}}"); args.push_back("--out=foo bar{{source_name_part}}.o"); - FileTemplate args_template(args); + FileTemplate args_template(setup.settings(), args); writer.WriteArgsSubstitutions(SourceFile("//foo/b ar.in"), args_template); #if defined(OS_WIN) diff --git a/tools/gn/ninja_copy_target_writer.cc b/tools/gn/ninja_copy_target_writer.cc index 9ab88e435c..4f8534f8ed 100644 --- a/tools/gn/ninja_copy_target_writer.cc +++ b/tools/gn/ninja_copy_target_writer.cc @@ -30,7 +30,7 @@ void NinjaCopyTargetWriter::Run() { // Make the output file from the template. std::vector<std::string> template_result; - output_template.ApplyString(input_file.value(), &template_result); + output_template.Apply(input_file, &template_result); CHECK(template_result.size() == 1); OutputFile output_file(template_result[0]); diff --git a/tools/gn/ninja_target_writer.cc b/tools/gn/ninja_target_writer.cc index b6412dcaf4..2383251c68 100644 --- a/tools/gn/ninja_target_writer.cc +++ b/tools/gn/ninja_target_writer.cc @@ -165,5 +165,5 @@ FileTemplate NinjaTargetWriter::GetOutputTemplate() const { RemovePrefix(outputs[i].value(), settings_->build_settings()->build_dir().value())); } - return FileTemplate(output_template_args); + return FileTemplate(target_->settings(), output_template_args); } diff --git a/tools/gn/secondary/chrome/BUILD.gn b/tools/gn/secondary/chrome/BUILD.gn deleted file mode 100644 index aaff67facd..0000000000 --- a/tools/gn/secondary/chrome/BUILD.gn +++ /dev/null @@ -1,299 +0,0 @@ -# Copyright (c) 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("//build/config/crypto.gni") -import("//build/config/ui.gni") -import("//tools/grit/grit_rule.gni") - -executable("chrome") { - sources = [ - "app/breakpad_field_trial_win.cc", - "app/breakpad_field_trial_win.h", - "app/breakpad_win.cc", - "app/breakpad_win.h", - "app/chrome_dll_resource.h", - "app/chrome_exe_main_aura.cc", - "app/chrome_exe_main_gtk.cc", - "app/chrome_exe_main_mac.cc", - "app/chrome_exe_main_win.cc", - "app/chrome_exe_resource.h", - "app/chrome_main.cc", - "app/chrome_main_delegate.cc", - "app/chrome_main_delegate.h", - "app/client_util.cc", - "app/client_util.h", - "app/hard_error_handler_win.cc", - "app/hard_error_handler_win.h", - "app/metro_driver_win.cc", - "app/metro_driver_win.h", - "../content/app/startup_helper_win.cc", - ] - - if (is_linux) { - configs += [ - # TODO(brettw) this is wrong, it should be picked up from deps. - "//build/config/linux:gtk", - "//build/config/linux:x11", - ] - } - - deps = [ - # TODO(brettw) this is right on linux? Everything is linked into the - # exe, but wrong on Windows, where chrome_exe and chrome_dll are separate. - ":browser", - ":common", - ":debugger", - ":plugin", - ":renderer", - ":utility", - "//base", - ] - - # TODO(brettw) this isn't right for all platforms. - if (!use_aura) { - sources -= [ "app/chrome_exe_main_aura.cc" ] - } - - if (!is_win) { - sources -= [ - "app/client_util.cc", - "app/client_util.h", - ] - } -} - -static_library("browser") { - if (is_linux) { - configs += [ - "//build/config/linux:x11", - ] - } - - deps = [ - "//third_party/expat", - ] -} - -static_library("common") { - if (!use_openssl && is_linux) { - # common/net uses NSS. - # TODO(brettw) have a better way to express this without having to do - # "if (use_nss)" everywhere. - configs += [ "//third_party/nss:nss_linux_config" ] - } - deps = [ - ] -} - -# TODO(brettw) move to browser/devtools/BUILD.gn -source_set("debugger") { - sources = [ - "browser/devtools/device/adb/adb_client_socket.cc", - "browser/devtools/device/adb/adb_client_socket.h", - "browser/devtools/device/adb/adb_device_info_query.h", - "browser/devtools/device/adb/adb_device_info_query.cc", - "browser/devtools/device/adb/adb_device_provider.cc", - "browser/devtools/device/adb/adb_device_provider.h", - "browser/devtools/device/android_device_manager.cc", - "browser/devtools/device/android_device_manager.h", - "browser/devtools/device/android_web_socket.cc", - "browser/devtools/device/devtools_android_bridge.cc", - "browser/devtools/device/devtools_android_bridge.h", - "browser/devtools/device/port_forwarding_controller.cc", - "browser/devtools/device/port_forwarding_controller.h", - "browser/devtools/device/self_device_provider.cc", - "browser/devtools/device/self_device_provider.h", - "browser/devtools/device/usb/android_rsa.cc", - "browser/devtools/device/usb/android_rsa.h", - "browser/devtools/device/usb/android_usb_device.cc", - "browser/devtools/device/usb/android_usb_device.h", - "browser/devtools/device/usb/android_usb_socket.cc", - "browser/devtools/device/usb/android_usb_socket.h", - "browser/devtools/device/usb/usb_device_provider.cc", - "browser/devtools/device/usb/usb_device_provider.h", - "browser/devtools/browser_list_tabcontents_provider.cc", - "browser/devtools/browser_list_tabcontents_provider.h", - "browser/devtools/devtools_contents_resizing_strategy.cc", - "browser/devtools/devtools_contents_resizing_strategy.h", - "browser/devtools/devtools_embedder_message_dispatcher.cc", - "browser/devtools/devtools_embedder_message_dispatcher.h", - "browser/devtools/devtools_file_helper.cc", - "browser/devtools/devtools_file_helper.h", - "browser/devtools/devtools_file_system_indexer.cc", - "browser/devtools/devtools_file_system_indexer.h", - "browser/devtools/devtools_network_controller.cpp", - "browser/devtools/devtools_network_controller.h", - "browser/devtools/devtools_network_transaction.cpp", - "browser/devtools/devtools_network_transaction.h", - "browser/devtools/devtools_network_transaction_factory.cpp", - "browser/devtools/devtools_network_transaction_factory.h", - "browser/devtools/devtools_protocol.cc", - "browser/devtools/devtools_protocol.h", - "browser/devtools/devtools_toggle_action.h", - "browser/devtools/devtools_window.cc", - "browser/devtools/devtools_window.h", - "browser/devtools/remote_debugging_server.cc", - "browser/devtools/remote_debugging_server.h", - ] - - deps = [ -# ":chrome_extra_resources", -# ":chrome_resources", -# ":chrome_strings", -# ":theme_resources", - "//base", - "//net", - "//net:http_server", - "//skia", - "//third_party/icu", - "//third_party/leveldatabase", - "//third_party/libusb", - ] - - if (is_android) { - sources -= [ - "browser/devtools/adb/android_rsa.cc", - "browser/devtools/browser_list_tabcontents_provider.cc", - "browser/devtools/devtools_file_system_indexer.cc", - "browser/devtools/devtools_window.cc", - "browser/devtools/remote_debugging_server.cc", - ] - deps -= [ "//third_party/libusb" ] - } - - # TODO implement debug_devtools - # if (debug_devtools) { - # defines = [ "DEBUG_DEVTOOLS=1" ] - # } - # TODO(brettw) this may be required on Windows: - # if (is_win) { - # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. - # 'msvs_disabled_warnings': [ 4267, ] - # } - -} - -source_set("plugin") { -} - -source_set("renderer") { -} - -source_set("utility") { -} - - -# Credits ---------------------------------------------------------------------- - -about_credits_file = "$root_gen_dir/about_credits.html" -build_relative_about_credits_file = - rebase_path(about_credits_file, root_build_dir) - -action("about_credits") { - script = "//tools/licenses.py" - outputs = [ about_credits_file ] - - # This script is impossible to write proper input dependencies for because it - # basically greps the source tree for third_party directories. If a directory - # is added or removed, it will change the result, but there is no way to - # express this as a build dependency. We approximate this by depending on - # the last change file to force an update whenever the code is updated. - source_prereqs = [ "//build/util/LASTCHANGE" ] - - args = [ "credits", build_relative_about_credits_file ] -} - -# Resources -------------------------------------------------------------------- - -#group("chrome_resources") { -# deps = [ -# ":browser_resources", -# ":common_resources", -# ":renderer_resources", -# ] -#} -#grit("browser_resources") { -# source = "browser/browser_resources.grd" -# grit_flags = [ "-E", "about_credits_file=$build_relative_about_credits_file" ] -# deps = [ ":about_credits" ] -#} -#grit("common_resources") { -# source = "common/common_resources.grd" -#} -#grit("renderer_resources") { -# source = "renderer/resources/renderer_resources.grd" -#} -# -#group("chrome_strings") { -# deps = [ -# ":locale_settings", -# ":chromium_strings", -# ":generated_resources", -# ":google_chrome_strings", -# ] -#} -#grit("locale_settings") { -# source = "app/resources/locale_settings.grd" -#} -#grit("chromium_strings") { -# source = "app/chromium_strings.grd" -#} -#grit("generated_resources") { -# source = "app/generated_resources.grd" -#} -#grit("google_chrome_strings") { -# source = "app/google_chrome_strings.grd" -#} -# -#group("chrome_extra_resources") { -# deps = [ -# ":memory_internals_resources", -# ":net_internals_resources", -# ":signin_internals_resources", -# ":sync_internals_resources", -# ":translate_internals_resources", -# ] -# -# if (!is_ios) { -# deps += [ -# ":component_extension_resources", -# ":options_resources", -# ":quota_internals_resources", -# ":sync_file_system_internals_resources", -# ] -# } -#} -#grit("component_extension_resources") { -# source = "browser/resources/component_extension_resources.grd" -#} -#grit("memory_internals_resources") { -# source = "browser/resources/memory_internals_resources.grd" -#} -#grit("quota_internals_resources") { -# source = "browser/resources/quota_internals_resources.grd" -#} -#grit("net_internals_resources") { -# source = "browser/resources/net_internals_resources.grd" -#} -#grit("options_resources") { -# source = "browser/resources/options_resources.grd" -#} -#grit("signin_internals_resources") { -# source = "browser/resources/signin_internals_resources.grd" -#} -#grit("sync_file_system_internals_resources") { -# source = "browser/resources/sync_file_system_internals_resources.grd" -#} -#grit("sync_internals_resources") { -# source = "browser/resources/sync_internals_resources.grd" -#} -#grit("translate_internals_resources") { -# source = "browser/resources/translate_internals_resources.grd" -#} -# -## TODO(brettw) rename "app_theme_resources" or something when we don't support -## GYP any more. This name is required to match the GYP build. -#grit("theme_resources") { -# source = "app/theme/theme_resources.grd" -#} diff --git a/tools/gn/secondary/testing/BUILD.gn b/tools/gn/secondary/testing/BUILD.gn deleted file mode 100644 index 2cafa68a28..0000000000 --- a/tools/gn/secondary/testing/BUILD.gn +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -source_set("gmock_mutant") { - sources = [ - "gmock_mutant.h", # gMock helpers - ] - - deps = [ "//base" ] -} diff --git a/tools/gn/secondary/testing/gmock/BUILD.gn b/tools/gn/secondary/testing/gmock/BUILD.gn deleted file mode 100644 index e682abf58b..0000000000 --- a/tools/gn/secondary/testing/gmock/BUILD.gn +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (c) 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -config("gmock_config") { - # Gmock headers need to be able to find themselves. - include_dirs = [ "include" ] -} - -static_library("gmock") { - sources = [ - # Sources based on files in r173 of gmock. - "include/gmock/gmock-actions.h", - "include/gmock/gmock-cardinalities.h", - "include/gmock/gmock-generated-actions.h", - "include/gmock/gmock-generated-function-mockers.h", - "include/gmock/gmock-generated-matchers.h", - "include/gmock/gmock-generated-nice-strict.h", - "include/gmock/gmock-matchers.h", - "include/gmock/gmock-spec-builders.h", - "include/gmock/gmock.h", - "include/gmock/internal/gmock-generated-internal-utils.h", - "include/gmock/internal/gmock-internal-utils.h", - "include/gmock/internal/gmock-port.h", - #"src/gmock-all.cc", # Not needed by our build. - "src/gmock-cardinalities.cc", - "src/gmock-internal-utils.cc", - "src/gmock-matchers.cc", - "src/gmock-spec-builders.cc", - "src/gmock.cc", - ] - - # This project includes some stuff form gtest's guts. - include_dirs = [ "../gtest/include" ] - - direct_dependent_configs = [ - ":gmock_config", - "//testing/gtest:gtest_config", - ] -} - -static_library("gmock_main") { - sources = [ "src/gmock_main.cc" ] - deps = [ ":gmock" ] -} diff --git a/tools/gn/secondary/testing/gtest/BUILD.gn b/tools/gn/secondary/testing/gtest/BUILD.gn deleted file mode 100644 index d596279783..0000000000 --- a/tools/gn/secondary/testing/gtest/BUILD.gn +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright (c) 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -config("gtest_config") { - visibility = [ - ":*", - "//testing/gmock:*", # gmock also shares this config. - ] - - defines = [ - "UNIT_TEST", - - # In order to allow regex matches in gtest to be shared between Windows - # and other systems, we tell gtest to always use it's internal engine. - "GTEST_HAS_POSIX_RE=0", - ] - - # Gtest headers need to be able to find themselves. - include_dirs = [ "include" ] - - if (is_win) { - cflags = [ "/wd4800" ] # Unused variable warning. - } - - if (is_posix) { - defines += [ - # gtest isn't able to figure out when RTTI is disabled for gcc - # versions older than 4.3.2, and assumes it's enabled. Our Mac - # and Linux builds disable RTTI, and cannot guarantee that the - # compiler will be 4.3.2. or newer. The Mac, for example, uses - # 4.2.1 as that is the latest available on that platform. gtest - # must be instructed that RTTI is disabled here, and for any - # direct dependents that might include gtest headers. - "GTEST_HAS_RTTI=0", - ] - } - - if (is_android) { - defines += [ - # We want gtest features that use tr1::tuple, but we currently - # don't support the variadic templates used by libstdc++'s - # implementation. gtest supports this scenario by providing its - # own implementation but we must opt in to it. - "GTEST_USE_OWN_TR1_TUPLE=1", - - # GTEST_USE_OWN_TR1_TUPLE only works if GTEST_HAS_TR1_TUPLE is set. - # gtest r625 made it so that GTEST_HAS_TR1_TUPLE is set to 0 - # automatically on android, so it has to be set explicitly here. - "GTEST_HAS_TR1_TUPLE=1", - ] - } -} - -static_library("gtest") { - sources = [ - "include/gtest/gtest-death-test.h", - "include/gtest/gtest-message.h", - "include/gtest/gtest-param-test.h", - "include/gtest/gtest-printers.h", - "include/gtest/gtest-spi.h", - "include/gtest/gtest-test-part.h", - "include/gtest/gtest-typed-test.h", - "include/gtest/gtest.h", - "include/gtest/gtest_pred_impl.h", - "include/gtest/internal/gtest-death-test-internal.h", - "include/gtest/internal/gtest-filepath.h", - "include/gtest/internal/gtest-internal.h", - "include/gtest/internal/gtest-linked_ptr.h", - "include/gtest/internal/gtest-param-util-generated.h", - "include/gtest/internal/gtest-param-util.h", - "include/gtest/internal/gtest-port.h", - "include/gtest/internal/gtest-string.h", - "include/gtest/internal/gtest-tuple.h", - "include/gtest/internal/gtest-type-util.h", - #"gtest/src/gtest-all.cc", # Not needed by our build. - "src/gtest-death-test.cc", - "src/gtest-filepath.cc", - "src/gtest-internal-inl.h", - "src/gtest-port.cc", - "src/gtest-printers.cc", - "src/gtest-test-part.cc", - "src/gtest-typed-test.cc", - "src/gtest.cc", - "../multiprocess_func_list.cc", - "../multiprocess_func_list.h", - "../platform_test.h", - ] - - if (is_mac) { - sources += [ - "../gtest_mac.h", - "../gtest_mac.mm", - "../platform_test_mac.mm", - ] - } - - include_dirs = [ "." ] - - all_dependent_configs = [ ":gtest_config" ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] -} - -source_set("gtest_main") { - sources = [ "src/gtest_main.cc" ] - deps = [ ":gtest" ] -} diff --git a/tools/gn/secondary/third_party/WebKit/Source/platform/BUILD.gn b/tools/gn/secondary/third_party/WebKit/Source/platform/BUILD.gn deleted file mode 100644 index c1c0f1ed90..0000000000 --- a/tools/gn/secondary/third_party/WebKit/Source/platform/BUILD.gn +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -component("platform") { - output_name = "blink_platform" - - sources = [ - "weborigin/DatabaseIdentifier.cpp", - "weborigin/DatabaseIdentifier.h", - "weborigin/KURL.cpp", - "weborigin/KURL.h", - "weborigin/KURLHash.h", - "weborigin/KnownPorts.cpp", - "weborigin/KnownPorts.h", - "weborigin/OriginAccessEntry.cpp", - "weborigin/OriginAccessEntry.h", - "weborigin/ReferrerPolicy.h", - "weborigin/SchemeRegistry.cpp", - "weborigin/SchemeRegistry.h", - "weborigin/SecurityOrigin.cpp", - "weborigin/SecurityOrigin.h", - "weborigin/SecurityOriginCache.h", - "weborigin/SecurityOriginHash.h", - "weborigin/SecurityPolicy.cpp", - "weborigin/SecurityPolicy.h", - "weborigin/WebOriginExport.h", - ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ - "../wtf:wtf-config" - "//build/config/compiler:no_chromium_code", - ] - - include_dirs = [ "../.." ] - - defines = [ "WEBORIGIN_IMPLEMENTATION=1" ] - - deps = [ - "//third_party/WebKit/Source/wtf", - "//third_party/icu", - "//url", - ] -} - -executable("blink_platform_unittests") { - sources = [ - "weborigin/DatabaseIdentifierTest.cpp", - "weborigin/KURLTest.cpp", - "weborigin/SecurityOriginTest.cpp", - ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ - "../wtf:wtf-config" - "//build/config/compiler:no_chromium_code", - "//third_party/icu:icu_config", - ] - - deps = [ - ":platform", - "../wtf:run_all_tests", - ] - -# if (is_linux && use_tcmalloc) { -# deps += [ -# "//base:base", -# "//base/allocator:allocator", -# ], -# } - -} diff --git a/tools/gn/secondary/third_party/WebKit/Source/wtf/BUILD.gn b/tools/gn/secondary/third_party/WebKit/Source/wtf/BUILD.gn deleted file mode 100644 index ce46c6422b..0000000000 --- a/tools/gn/secondary/third_party/WebKit/Source/wtf/BUILD.gn +++ /dev/null @@ -1,364 +0,0 @@ -# Copyright 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -config("wtf-config") { - include_dirs = [ ".." ] - if (is_win) { - include_dirs += [ "os-win32" ] - defines = [ - "__STD_C", - "_CRT_SECURE_NO_DEPRECATE", - "_SCL_SECURE_NO_DEPRECATE", - "CRASH=__debugbreak", - ] -# # Chromium windows multi-dll build enables c++ exception and this -# # causes wtf generates 4291 warning due to operator new/delete -# # implementations. Disable the warning for chromium windows -# # multi-dll build. -# 'msvs_disabled_warnings': [4291], -# 'direct_dependent_settings': { -# 'msvs_disabled_warnings': [4291], -# }, - } - - if (is_linux) { # (gcc_version >= 46) { - # Disable warnings about c++0x compatibility, as some names (such as - # nullptr) conflict with upcoming c++0x types. - cflags_cc = [ "-Wno-c++0x-compat" ] - } - -# # Some warnings occur in WTF headers, so they must also be disabled -# # in targets that use WTF. -# 'msvs_disabled_warnings': [ -# # Don't complain about calling specific versions of templatized -# # functions (e.g. in RefPtrHashMap.h). -# 4344, -# # Don't complain about using "this" in an initializer list -# # (e.g. in StringImpl.h). -# 4355, -# # Disable c4267 warnings until we fix size_t to int truncations. -# 4267, -# ], - -} - -component("wtf") { - sources = [ - "ASCIICType.h", - "Alignment.h", - "ArrayBuffer.cpp", - "ArrayBuffer.h", - "ArrayBufferContents.cpp", - "ArrayBufferContents.h", - "ArrayBufferDeallocationObserver.h", - "ArrayBufferView.cpp", - "ArrayBufferView.h", - "Assertions.cpp", - "Assertions.h", - "Atomics.h", - "AutodrainedPool.h", - "BitArray.h", - "BitVector.cpp", - "BitVector.h", - "BloomFilter.h", - "ByteOrder.h", - "CPU.h", - "CheckedArithmetic.h", - "Compiler.h", - "Complex.h", - "CryptographicallyRandomNumber.cpp", - "CryptographicallyRandomNumber.h", - "CurrentTime.cpp", - "CurrentTime.h", - "DataLog.cpp", - "DataLog.h", - "DateMath.cpp", - "DateMath.h", - "DecimalNumber.cpp", - "DecimalNumber.h", - "Deque.h", - "DoublyLinkedList.h", - "DynamicAnnotations.cpp", - "DynamicAnnotations.h", - "FastAllocBase.h", - "FastMalloc.cpp", - "FastMalloc.h", - "FilePrintStream.cpp", - "FilePrintStream.h", - "Float32Array.h", - "Float64Array.h", - "Forward.h", - "Functional.h", - "GetPtr.h", - "GregorianDateTime.cpp", - "GregorianDateTime.h", - "HashCountedSet.h", - "HashFunctions.h", - "HashIterators.h", - "HashMap.h", - "HashSet.h", - "HashTable.cpp", - "HashTable.h", - "HashTableDeletedValueType.h", - "HashTraits.h", - "HexNumber.h", - "Int16Array.h", - "Int32Array.h", - "Int8Array.h", - "IntegralTypedArrayBase.h", - "LeakAnnotations.h", - "LinkedStack.h", - "ListHashSet.h", - "Locker.h", - "MainThread.cpp", - "MainThread.h", - "MallocZoneSupport.h", - "MathExtras.h", - "MessageQueue.h", - "NonCopyingSort.h", - "Noncopyable.h", - "NotFound.h", - "NullPtr.cpp", - "NullPtr.h", - "NumberOfCores.cpp", - "NumberOfCores.h", - "OwnPtr.h", - "OwnPtrCommon.h", - "PageAllocator.cpp", - "PageAllocator.h", - "ParallelJobs.h", - "ParallelJobsLibdispatch.h", - "PartitionAlloc.cpp", - "PartitionAlloc.h", - "PassOwnPtr.h", - "PassRefPtr.h", - "PassTraits.h", - "PrintStream.cpp", - "PrintStream.h", - "ProcessID.h", - "QuantizedAllocation.cpp", - "QuantizedAllocation.h", - "RefCounted.h", - "RefCountedLeakCounter.cpp", - "RefCountedLeakCounter.h", - "RefPtr.h", - "RefPtrHashMap.h", - "RetainPtr.h", - "SHA1.cpp", - "SHA1.h", - "SaturatedArithmetic.h", - "SizeLimits.cpp", - "SpinLock.h", - "StaticConstructors.h", - "StdLibExtras.h", - "StringExtras.h", - "StringHasher.h", - "TemporaryChange.h", - "ThreadFunctionInvocation.h", - "ThreadRestrictionVerifier.h", - "ThreadSafeRefCounted.h", - "ThreadSpecific.h", - "Threading.cpp", - "Threading.h", - "ThreadingPrimitives.h", - "TypeTraits.cpp", - "TypeTraits.h", - "TypedArrayBase.h", - "Uint16Array.h", - "Uint32Array.h", - "Uint8Array.h", - "UnusedParam.h", - "VMTags.h", - "Vector.h", - "VectorTraits.h", - "WTF.cpp", - "WTF.h", - "WTFExport.h", - "WTFThreadData.cpp", - "WTFThreadData.h", - "WeakPtr.h", - "dtoa.cpp", - "dtoa.h", - "dtoa/bignum-dtoa.cc", - "dtoa/bignum-dtoa.h", - "dtoa/bignum.cc", - "dtoa/bignum.h", - "dtoa/cached-powers.cc", - "dtoa/cached-powers.h", - "dtoa/diy-fp.cc", - "dtoa/diy-fp.h", - "dtoa/double-conversion.cc", - "dtoa/double-conversion.h", - "dtoa/double.h", - "dtoa/fast-dtoa.cc", - "dtoa/fast-dtoa.h", - "dtoa/fixed-dtoa.cc", - "dtoa/fixed-dtoa.h", - "dtoa/strtod.cc", - "dtoa/strtod.h", - "dtoa/utils.h", - "text/ASCIIFastPath.h", - "text/AtomicString.cpp", - "text/AtomicString.h", - "text/AtomicStringHash.h", - "text/Base64.cpp", - "text/Base64.h", - "text/CString.cpp", - "text/CString.h", - "text/IntegerToStringConversion.h", - "text/StringBuffer.h", - "text/StringBuilder.cpp", - "text/StringBuilder.h", - "text/StringConcatenate.h", - "text/StringHash.h", - "text/StringImpl.cpp", - "text/StringImpl.h", - "text/StringOperators.h", - "text/StringStatics.cpp", - "text/StringUTF8Adaptor.h", - "text/StringView.h", - "text/TextCodec.cpp", - "text/TextCodecASCIIFastPath.h", - "text/TextCodecICU.cpp", - "text/TextCodecLatin1.cpp", - "text/TextCodecUTF16.cpp", - "text/TextCodecUTF8.cpp", - "text/TextCodecUTF8.h", - "text/TextCodecUserDefined.cpp", - "text/TextEncoding.cpp", - "text/TextEncodingRegistry.cpp", - "text/TextPosition.cpp", - "text/TextPosition.h", - "text/WTFString.cpp", - "text/WTFString.h", - "unicode/CharacterNames.h", - "unicode/Collator.h", - "unicode/UTF8.cpp", - "unicode/UTF8.h", - "unicode/Unicode.h", - "unicode/icu/CollatorICU.cpp", - "unicode/icu/UnicodeIcu.h", - ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ - "//build/config/compiler:no_chromium_code", - ":wtf-config" - ] - - defines = [ "WTF_IMPLEMENTATION=1" ] - deps = [ - "//third_party/icu", - ] - - # # Disable c4267 warnings until we fix size_t to int truncations. -# 'msvs_disabled_warnings': [4127, 4355, 4510, 4512, 4610, 4706, 4068, 4267], - - ldflags = [] - if (is_android) { - ldflags += [ "-llog" ] - } - - if (is_mac) { -# 'link_settings': { -# 'libraries': [ -# '$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework', -# '$(SDKROOT)/System/Library/Frameworks/Foundation.framework', -# ] -# } - sources += [ - # mac is the only OS that uses WebKit's copy of TCMalloc. - "TCPackedCache.h", - "TCPageMap.h", - "TCSpinLock.h", - "TCSystemAlloc.cpp", - "TCSystemAlloc.h", - - "AutodrainedPoolMac.mm", - "text/AtomicStringCF.cpp", - "text/StringCF.cpp", - "text/StringImplCF.cpp", - "text/StringImplMac.mm", - "text/StringMac.mm", - ] - } - - if (is_win) { - sources += [ - "ThreadSpecificWin.cpp", - "ThreadingWin.cpp", - ] -# include_dirs -= [ -# "<(SHARED_INTERMEDIATE_DIR)/blink', -# ] - } else { - sources += [ - "ThreadIdentifierDataPthreads.cpp", - "ThreadIdentifierDataPthreads.h", - "ThreadingPthreads.cpp", - ] - } -} - -static_library("run_all_tests") { - sources = [ "testing/RunAllTests.cpp" ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ - "//build/config/compiler:no_chromium_code", - ":wtf-config", - ] - - deps = [ - "//base/test:test_support", - "//testing/gmock", - "//testing/gtest", - ":wtf", - ] - - direct_dependent_configs = [ "//testing/gtest:gtest_config" ] -} - -executable("wtf_unittests") { - sources = [ - "CheckedArithmeticTest.cpp", - "FunctionalTest.cpp", - "HashMapTest.cpp", - "HashSetTest.cpp", - "ListHashSetTest.cpp", - "MathExtrasTest.cpp", - "PartitionAllocTest.cpp", - "SHA1Test.cpp", - "SaturatedArithmeticTest.cpp", - "StringExtrasTest.cpp", - "StringHasherTest.cpp", - "TemporaryChangeTest.cpp", - "VectorTest.cpp", - "testing/WTFTestHelpers.h", - "text/CStringTest.cpp", - "text/StringBuilderTest.cpp", - "text/StringImplTest.cpp", - "text/StringOperatorsTest.cpp", - "text/WTFStringTest.cpp", - ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ - "//build/config/compiler:no_chromium_code", - "//third_party/icu:icu_config", - ":wtf-config", - ] - - deps = [ ":run_all_tests" ] - - # # Disable c4267 warnings until we fix size_t to int truncations. -# 'msvs_disabled_warnings': [4127, 4355, 4510, 4512, 4610, 4706, 4068, 4267], - -# if (is_linux && use_tcmalloc) { -# deps += [ -# "//base:base", -# "//base/allocator:allocator", -# ], -# } -} diff --git a/tools/gn/secondary/third_party/android_tools/BUILD.gn b/tools/gn/secondary/third_party/android_tools/BUILD.gn deleted file mode 100644 index 44a10d99b3..0000000000 --- a/tools/gn/secondary/third_party/android_tools/BUILD.gn +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -config("cpu_features_include") { - include_dirs = [ "ndk/sources/android/cpufeatures" ] -} - -# This is the GN version of -# //build/android/cpufeatures.gypi:cpufeatures -source_set("cpu_features") { - sources = [ "ndk/sources/android/cpufeatures/cpu-features.c" ] - direct_dependent_configs = [ ":cpu_features_include" ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] -} diff --git a/tools/gn/secondary/third_party/angle/BUILD.gn b/tools/gn/secondary/third_party/angle/BUILD.gn deleted file mode 100644 index 1dbe942e7e..0000000000 --- a/tools/gn/secondary/third_party/angle/BUILD.gn +++ /dev/null @@ -1,644 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This config is applied to internal Angle targets (not pushed to dependents). -config("internal_config") { - include_dirs = [ - "include", - "src", - ] -} - -component("translator") { - sources = [ - "src/compiler/translator/ShaderLang.cpp", - ] - - defines = [ "ANGLE_TRANSLATOR_IMPLEMENTATION" ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ - ":internal_config", - "//build/config/compiler:no_chromium_code", - ] - - deps = [ - ":translator_lib", - ] -} - -# Holds the shared includes so we only need to list them once. -source_set("includes") { - sources = [ - "include/EGL/egl.h", - "include/EGL/eglext.h", - "include/EGL/eglplatform.h", - "include/GLES2/gl2.h", - "include/GLES2/gl2ext.h", - "include/GLES2/gl2platform.h", - "include/GLES3/gl3.h", - "include/GLES3/gl3ext.h", - "include/GLES3/gl3platform.h", - "include/GLSLANG/ShaderLang.h", - "include/KHR/khrplatform.h", - ] -} - -static_library("preprocessor") { - sources = [ - "src/compiler/preprocessor/DiagnosticsBase.cpp", - "src/compiler/preprocessor/DiagnosticsBase.h", - "src/compiler/preprocessor/DirectiveHandlerBase.cpp", - "src/compiler/preprocessor/DirectiveHandlerBase.h", - "src/compiler/preprocessor/DirectiveParser.cpp", - "src/compiler/preprocessor/DirectiveParser.h", - "src/compiler/preprocessor/ExpressionParser.cpp", - "src/compiler/preprocessor/ExpressionParser.h", - "src/compiler/preprocessor/ExpressionParser.y", - "src/compiler/preprocessor/Input.cpp", - "src/compiler/preprocessor/Input.h", - "src/compiler/preprocessor/Lexer.cpp", - "src/compiler/preprocessor/Lexer.h", - "src/compiler/preprocessor/Macro.cpp", - "src/compiler/preprocessor/Macro.h", - "src/compiler/preprocessor/MacroExpander.cpp", - "src/compiler/preprocessor/MacroExpander.h", - "src/compiler/preprocessor/Preprocessor.cpp", - "src/compiler/preprocessor/Preprocessor.h", - "src/compiler/preprocessor/SourceLocation.h", - "src/compiler/preprocessor/Token.cpp", - "src/compiler/preprocessor/Token.h", - "src/compiler/preprocessor/Tokenizer.cpp", - "src/compiler/preprocessor/Tokenizer.h", - "src/compiler/preprocessor/Tokenizer.l", - "src/compiler/preprocessor/numeric_lex.h", - "src/compiler/preprocessor/pp_utils.h", - ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ - ":internal_config", - "//build/config/compiler:no_chromium_code", - ] - -} - -static_library("translator_lib") { - sources = [ - "src/common/RefCountObject.cpp", - "src/common/RefCountObject.h", - "src/common/angleutils.h", - "src/common/blocklayout.cpp", - "src/common/blocklayout.h", - "src/common/debug.cpp", - "src/common/debug.h", - "src/common/event_tracer.cpp", - "src/common/event_tracer.h", - "src/common/mathutil.cpp", - "src/common/mathutil.h", - "src/common/shadervars.h", - "src/common/utilities.cpp", - "src/common/utilities.h", - "src/common/version.h", - "src/compiler/translator/BaseTypes.h", - "src/compiler/translator/BuiltInFunctionEmulator.cpp", - "src/compiler/translator/BuiltInFunctionEmulator.h", - "src/compiler/translator/CodeGen.cpp", - "src/compiler/translator/Common.h", - "src/compiler/translator/Compiler.cpp", - "src/compiler/translator/ConstantUnion.h", - "src/compiler/translator/DetectCallDepth.cpp", - "src/compiler/translator/DetectCallDepth.h", - "src/compiler/translator/DetectDiscontinuity.cpp", - "src/compiler/translator/DetectDiscontinuity.h", - "src/compiler/translator/Diagnostics.cpp", - "src/compiler/translator/Diagnostics.h", - "src/compiler/translator/DirectiveHandler.cpp", - "src/compiler/translator/DirectiveHandler.h", - "src/compiler/translator/ExtensionBehavior.h", - "src/compiler/translator/FlagStd140Structs.cpp", - "src/compiler/translator/FlagStd140Structs.h", - "src/compiler/translator/ForLoopUnroll.cpp", - "src/compiler/translator/ForLoopUnroll.h", - "src/compiler/translator/HashNames.h", - "src/compiler/translator/InfoSink.cpp", - "src/compiler/translator/InfoSink.h", - "src/compiler/translator/Initialize.cpp", - "src/compiler/translator/Initialize.h", - "src/compiler/translator/InitializeDll.cpp", - "src/compiler/translator/InitializeDll.h", - "src/compiler/translator/InitializeGlobals.h", - "src/compiler/translator/InitializeParseContext.cpp", - "src/compiler/translator/InitializeParseContext.h", - "src/compiler/translator/InitializeVariables.cpp", - "src/compiler/translator/InitializeVariables.h", - "src/compiler/translator/IntermTraverse.cpp", - "src/compiler/translator/Intermediate.cpp", - "src/compiler/translator/LoopInfo.cpp", - "src/compiler/translator/LoopInfo.h", - "src/compiler/translator/MMap.h", - "src/compiler/translator/NodeSearch.h", - "src/compiler/translator/OutputESSL.cpp", - "src/compiler/translator/OutputESSL.h", - "src/compiler/translator/OutputGLSL.cpp", - "src/compiler/translator/OutputGLSL.h", - "src/compiler/translator/OutputGLSLBase.cpp", - "src/compiler/translator/OutputGLSLBase.h", - "src/compiler/translator/OutputHLSL.cpp", - "src/compiler/translator/OutputHLSL.h", - "src/compiler/translator/ParseContext.cpp", - "src/compiler/translator/ParseContext.h", - "src/compiler/translator/PoolAlloc.cpp", - "src/compiler/translator/PoolAlloc.h", - "src/compiler/translator/Pragma.h", - "src/compiler/translator/QualifierAlive.cpp", - "src/compiler/translator/QualifierAlive.h", - "src/compiler/translator/RemoveTree.cpp", - "src/compiler/translator/RemoveTree.h", - "src/compiler/translator/RenameFunction.h", - "src/compiler/translator/RewriteElseBlocks.cpp", - "src/compiler/translator/RewriteElseBlocks.h", - "src/compiler/translator/SearchSymbol.cpp", - "src/compiler/translator/SearchSymbol.h", - "src/compiler/translator/ShHandle.h", - "src/compiler/translator/SymbolTable.cpp", - "src/compiler/translator/SymbolTable.h", - "src/compiler/translator/TranslatorESSL.cpp", - "src/compiler/translator/TranslatorESSL.h", - "src/compiler/translator/TranslatorGLSL.cpp", - "src/compiler/translator/TranslatorGLSL.h", - "src/compiler/translator/TranslatorHLSL.cpp", - "src/compiler/translator/TranslatorHLSL.h", - "src/compiler/translator/Types.cpp", - "src/compiler/translator/Types.h", - "src/compiler/translator/UnfoldShortCircuit.cpp", - "src/compiler/translator/UnfoldShortCircuit.h", - "src/compiler/translator/UnfoldShortCircuitAST.cpp", - "src/compiler/translator/UnfoldShortCircuitAST.h", - "src/compiler/translator/ValidateLimitations.cpp", - "src/compiler/translator/ValidateLimitations.h", - "src/compiler/translator/ValidateOutputs.cpp", - "src/compiler/translator/ValidateOutputs.h", - "src/compiler/translator/VariableInfo.cpp", - "src/compiler/translator/VariableInfo.h", - "src/compiler/translator/VariablePacker.cpp", - "src/compiler/translator/VariablePacker.h", - "src/compiler/translator/VersionGLSL.cpp", - "src/compiler/translator/VersionGLSL.h", - "src/compiler/translator/compilerdebug.cpp", - "src/compiler/translator/compilerdebug.h", - "src/compiler/translator/depgraph/DependencyGraph.cpp", - "src/compiler/translator/depgraph/DependencyGraph.h", - "src/compiler/translator/depgraph/DependencyGraphBuilder.cpp", - "src/compiler/translator/depgraph/DependencyGraphBuilder.h", - "src/compiler/translator/depgraph/DependencyGraphOutput.cpp", - "src/compiler/translator/depgraph/DependencyGraphOutput.h", - "src/compiler/translator/depgraph/DependencyGraphTraverse.cpp", - "src/compiler/translator/glslang.h", - "src/compiler/translator/glslang.l", - "src/compiler/translator/glslang.y", - "src/compiler/translator/glslang_lex.cpp", - "src/compiler/translator/glslang_tab.cpp", - "src/compiler/translator/glslang_tab.h", - "src/compiler/translator/intermOut.cpp", - "src/compiler/translator/intermediate.h", - "src/compiler/translator/length_limits.h", - "src/compiler/translator/localintermediate.h", - "src/compiler/translator/osinclude.h", - "src/compiler/translator/ossource_posix.cpp", - "src/compiler/translator/ossource_win.cpp", - "src/compiler/translator/parseConst.cpp", - "src/compiler/translator/timing/RestrictFragmentShaderTiming.cpp", - "src/compiler/translator/timing/RestrictFragmentShaderTiming.h", - "src/compiler/translator/timing/RestrictVertexShaderTiming.cpp", - "src/compiler/translator/timing/RestrictVertexShaderTiming.h", - "src/compiler/translator/util.cpp", - "src/compiler/translator/util.h", - "src/third_party/compiler/ArrayBoundsClamper.cpp", - "src/third_party/compiler/ArrayBoundsClamper.h", - ] - - if (is_win) { - sources -= [ "src/compiler/translator/ossource_posix.cpp" ] - } else { - sources -= [ "src/compiler/translator/ossource_win.cpp" ] - } - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ - ":internal_config", - "//build/config/compiler:no_chromium_code", - ] - - deps = [ - ":includes", - ":preprocessor", - ] -} - -config("translator_static_config") { - defines = [ "ANGLE_TRANSLATOR_STATIC" ] -} - -static_library("translator_static") { - sources = [ - "src/compiler/translator/ShaderLang.cpp", - ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ - ":internal_config", - "//build/config/compiler:no_chromium_code", - ] - direct_dependent_configs = [ ":translator_static_config" ] - - deps = [ - ":translator_lib", - ] -} - -# TODO(GYP) this requires some changes to the script before it will work. -# https://chromium-review.googlesource.com/#/c/202048/ -if (false) { - action("commit_id") { - script = "src/commit_id.py" - - output_file = "$root_gen_dir/angle_commit.h" - outputs = [ output_file ] - - args = [ - rebase_path(".", root_build_dir), - rebase_path(output_file, root_build_dir), - ] - } -} else { - # While Angle is being updated, we copy a temporary hardcoded commit.h. This - # is copied both as commit.h and angle_commit.h. The angle roll will rename - # this file from commit.h to angle_commit.h and we don't want to make the - # udpate more complicated than necessary. - group("commit_id") { - deps = [ ":copy_angle_commit_h", ":copy_commit_h" ] - } - - hardcoded_commit = [ "//tools/gn/secondary/third_party/angle/angle_commit.h" ] - copy("copy_angle_commit_h") { - sources = hardcoded_commit - outputs = [ "$root_gen_dir/angle_commit.h" ] - } - copy("copy_commit_h") { - sources = hardcoded_commit - outputs = [ "$root_gen_dir/commit.h" ] - } -} - -if (is_win) { - angle_enable_d3d9 = true - angle_enable_d3d11 = true - - shared_library("libGLESv2") { - sources = [ - "src/common/RefCountObject.cpp", - "src/common/RefCountObject.h", - "src/common/angleutils.h", - "src/common/blocklayout.cpp", - "src/common/blocklayout.h", - "src/common/debug.cpp", - "src/common/debug.h", - "src/common/event_tracer.cpp", - "src/common/event_tracer.h", - "src/common/mathutil.cpp", - "src/common/mathutil.h", - "src/common/shadervars.h", - "src/common/utilities.cpp", - "src/common/utilities.h", - "src/common/version.h", - "src/libGLESv2/BinaryStream.h", - "src/libGLESv2/Buffer.cpp", - "src/libGLESv2/Buffer.h", - "src/libGLESv2/Context.cpp", - "src/libGLESv2/Context.h", - "src/libGLESv2/DynamicHLSL.cpp", - "src/libGLESv2/DynamicHLSL.h", - "src/libGLESv2/Fence.cpp", - "src/libGLESv2/Fence.h", - "src/libGLESv2/Float16ToFloat32.cpp", - "src/libGLESv2/Framebuffer.cpp", - "src/libGLESv2/Framebuffer.h", - "src/libGLESv2/FramebufferAttachment.cpp", - "src/libGLESv2/FramebufferAttachment.h", - "src/libGLESv2/HandleAllocator.cpp", - "src/libGLESv2/HandleAllocator.h", - "src/libGLESv2/Program.cpp", - "src/libGLESv2/Program.h", - "src/libGLESv2/ProgramBinary.cpp", - "src/libGLESv2/ProgramBinary.h", - "src/libGLESv2/Query.cpp", - "src/libGLESv2/Query.h", - "src/libGLESv2/Renderbuffer.cpp", - "src/libGLESv2/Renderbuffer.h", - "src/libGLESv2/RenderbufferProxySet.cpp", - "src/libGLESv2/RenderbufferProxySet.h", - "src/libGLESv2/ResourceManager.cpp", - "src/libGLESv2/ResourceManager.h", - "src/libGLESv2/Sampler.cpp", - "src/libGLESv2/Sampler.h", - "src/libGLESv2/Shader.cpp", - "src/libGLESv2/Shader.h", - "src/libGLESv2/Texture.cpp", - "src/libGLESv2/Texture.h", - "src/libGLESv2/TransformFeedback.cpp", - "src/libGLESv2/TransformFeedback.h", - "src/libGLESv2/Uniform.cpp", - "src/libGLESv2/Uniform.h", - "src/libGLESv2/VertexArray.cpp", - "src/libGLESv2/VertexArray.h", - "src/libGLESv2/VertexAttribute.h", - "src/libGLESv2/angletypes.cpp", - "src/libGLESv2/angletypes.h", - "src/libGLESv2/constants.h", - "src/libGLESv2/formatutils.cpp", - "src/libGLESv2/formatutils.h", - "src/libGLESv2/libGLESv2.cpp", - "src/libGLESv2/libGLESv2.def", - "src/libGLESv2/libGLESv2.rc", - "src/libGLESv2/main.cpp", - "src/libGLESv2/main.h", - "src/libGLESv2/precompiled.cpp", - "src/libGLESv2/precompiled.h", - "src/libGLESv2/queryconversions.cpp", - "src/libGLESv2/queryconversions.h", - "src/libGLESv2/renderer/BufferStorage.cpp", - "src/libGLESv2/renderer/BufferStorage.h", - "src/libGLESv2/renderer/FenceImpl.h", - "src/libGLESv2/renderer/Image.cpp", - "src/libGLESv2/renderer/Image.h", - "src/libGLESv2/renderer/IndexBuffer.cpp", - "src/libGLESv2/renderer/IndexBuffer.h", - "src/libGLESv2/renderer/IndexDataManager.cpp", - "src/libGLESv2/renderer/IndexDataManager.h", - "src/libGLESv2/renderer/IndexRangeCache.cpp", - "src/libGLESv2/renderer/IndexRangeCache.h", - "src/libGLESv2/renderer/QueryImpl.h", - "src/libGLESv2/renderer/RenderTarget.h", - "src/libGLESv2/renderer/Renderer.cpp", - "src/libGLESv2/renderer/Renderer.h", - "src/libGLESv2/renderer/ShaderExecutable.h", - "src/libGLESv2/renderer/SwapChain.h", - "src/libGLESv2/renderer/TextureStorage.cpp", - "src/libGLESv2/renderer/TextureStorage.h", - "src/libGLESv2/renderer/VertexBuffer.cpp", - "src/libGLESv2/renderer/VertexBuffer.h", - "src/libGLESv2/renderer/VertexDataManager.cpp", - "src/libGLESv2/renderer/VertexDataManager.h", - "src/libGLESv2/renderer/copyimage.cpp", - "src/libGLESv2/renderer/copyimage.h", - "src/libGLESv2/renderer/copyvertex.h", - "src/libGLESv2/renderer/generatemip.h", - "src/libGLESv2/renderer/imageformats.h", - "src/libGLESv2/renderer/loadimage.cpp", - "src/libGLESv2/renderer/loadimage.h", - "src/libGLESv2/renderer/loadimageSSE2.cpp", - "src/libGLESv2/renderer/vertexconversion.h", - "src/libGLESv2/resource.h", - "src/libGLESv2/validationES.cpp", - "src/libGLESv2/validationES.h", - "src/libGLESv2/validationES2.cpp", - "src/libGLESv2/validationES2.h", - "src/libGLESv2/validationES3.cpp", - "src/libGLESv2/validationES3.h", - "src/third_party/murmurhash/MurmurHash3.cpp", - "src/third_party/murmurhash/MurmurHash3.h", - "src/third_party/systeminfo/SystemInfo.cpp", - "src/third_party/systeminfo/SystemInfo.h", - ] - - defines = [ - "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " + - "TEXT(\"d3dcompiler_46.dll\"), TEXT(\"d3dcompiler_43.dll\") }", - "GL_APICALL=", - "GL_GLEXT_PROTOTYPES=", - "EGLAPI=", - ] - libs = [] - - # Shared D3dD sources. - if (angle_enable_d3d9 || angle_enable_d3d11) { - sources += [ - "src/libGLESv2/renderer/d3d/HLSLCompiler.cpp", - "src/libGLESv2/renderer/d3d/HLSLCompiler.h", - ] - } - - if (angle_enable_d3d9) { - sources += [ - "src/libGLESv2/renderer/d3d9/Blit9.cpp", - "src/libGLESv2/renderer/d3d9/Blit9.h", - "src/libGLESv2/renderer/d3d9/BufferStorage9.cpp", - "src/libGLESv2/renderer/d3d9/BufferStorage9.h", - "src/libGLESv2/renderer/d3d9/Fence9.cpp", - "src/libGLESv2/renderer/d3d9/Fence9.h", - "src/libGLESv2/renderer/d3d9/Image9.cpp", - "src/libGLESv2/renderer/d3d9/Image9.h", - "src/libGLESv2/renderer/d3d9/IndexBuffer9.cpp", - "src/libGLESv2/renderer/d3d9/IndexBuffer9.h", - "src/libGLESv2/renderer/d3d9/Query9.cpp", - "src/libGLESv2/renderer/d3d9/Query9.h", - "src/libGLESv2/renderer/d3d9/RenderTarget9.cpp", - "src/libGLESv2/renderer/d3d9/RenderTarget9.h", - "src/libGLESv2/renderer/d3d9/Renderer9.cpp", - "src/libGLESv2/renderer/d3d9/Renderer9.h", - "src/libGLESv2/renderer/d3d9/ShaderCache.h", - "src/libGLESv2/renderer/d3d9/ShaderExecutable9.cpp", - "src/libGLESv2/renderer/d3d9/ShaderExecutable9.h", - "src/libGLESv2/renderer/d3d9/SwapChain9.cpp", - "src/libGLESv2/renderer/d3d9/SwapChain9.h", - "src/libGLESv2/renderer/d3d9/TextureStorage9.cpp", - "src/libGLESv2/renderer/d3d9/TextureStorage9.h", - "src/libGLESv2/renderer/d3d9/VertexBuffer9.cpp", - "src/libGLESv2/renderer/d3d9/VertexBuffer9.h", - "src/libGLESv2/renderer/d3d9/VertexDeclarationCache.cpp", - "src/libGLESv2/renderer/d3d9/VertexDeclarationCache.h", - "src/libGLESv2/renderer/d3d9/formatutils9.cpp", - "src/libGLESv2/renderer/d3d9/formatutils9.h", - "src/libGLESv2/renderer/d3d9/renderer9_utils.cpp", - "src/libGLESv2/renderer/d3d9/renderer9_utils.h", - "src/libGLESv2/renderer/d3d9/shaders/compiled/componentmaskps.h", - "src/libGLESv2/renderer/d3d9/shaders/compiled/flipyvs.h", - "src/libGLESv2/renderer/d3d9/shaders/compiled/luminanceps.h", - "src/libGLESv2/renderer/d3d9/shaders/compiled/passthroughps.h", - "src/libGLESv2/renderer/d3d9/shaders/compiled/standardvs.h", - ] - - defines += [ "ANGLE_ENABLE_D3D9" ] - libs += [ "d3d9.lib" ] - } - - if (angle_enable_d3d11) { - sources += [ - "src/libGLESv2/renderer/d3d11/Blit11.cpp", - "src/libGLESv2/renderer/d3d11/Blit11.h", - "src/libGLESv2/renderer/d3d11/BufferStorage11.cpp", - "src/libGLESv2/renderer/d3d11/BufferStorage11.h", - "src/libGLESv2/renderer/d3d11/Clear11.cpp", - "src/libGLESv2/renderer/d3d11/Clear11.h", - "src/libGLESv2/renderer/d3d11/Fence11.cpp", - "src/libGLESv2/renderer/d3d11/Fence11.h", - "src/libGLESv2/renderer/d3d11/Image11.cpp", - "src/libGLESv2/renderer/d3d11/Image11.h", - "src/libGLESv2/renderer/d3d11/IndexBuffer11.cpp", - "src/libGLESv2/renderer/d3d11/IndexBuffer11.h", - "src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp", - "src/libGLESv2/renderer/d3d11/InputLayoutCache.h", - "src/libGLESv2/renderer/d3d11/PixelTransfer11.cpp", - "src/libGLESv2/renderer/d3d11/PixelTransfer11.h", - "src/libGLESv2/renderer/d3d11/Query11.cpp", - "src/libGLESv2/renderer/d3d11/Query11.h", - "src/libGLESv2/renderer/d3d11/RenderStateCache.cpp", - "src/libGLESv2/renderer/d3d11/RenderStateCache.h", - "src/libGLESv2/renderer/d3d11/RenderTarget11.cpp", - "src/libGLESv2/renderer/d3d11/RenderTarget11.h", - "src/libGLESv2/renderer/d3d11/Renderer11.cpp", - "src/libGLESv2/renderer/d3d11/Renderer11.h", - "src/libGLESv2/renderer/d3d11/ShaderExecutable11.cpp", - "src/libGLESv2/renderer/d3d11/ShaderExecutable11.h", - "src/libGLESv2/renderer/d3d11/SwapChain11.cpp", - "src/libGLESv2/renderer/d3d11/SwapChain11.h", - "src/libGLESv2/renderer/d3d11/TextureStorage11.cpp", - "src/libGLESv2/renderer/d3d11/TextureStorage11.h", - "src/libGLESv2/renderer/d3d11/VertexBuffer11.cpp", - "src/libGLESv2/renderer/d3d11/VertexBuffer11.h", - "src/libGLESv2/renderer/d3d11/formatutils11.cpp", - "src/libGLESv2/renderer/d3d11/formatutils11.h", - "src/libGLESv2/renderer/d3d11/renderer11_utils.cpp", - "src/libGLESv2/renderer/d3d11/renderer11_utils.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_gs.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4f.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4i.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_vs.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/clearfloat11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/clearfloat11vs.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/clearsint11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/clearsint11vs.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/clearuint11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/clearuint11vs.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthrough2d11vs.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthrough3d11gs.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthrough3d11vs.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughdepth2d11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlum2d11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlum3d11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2d11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2di11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2dui11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3d11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3di11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3dui11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2d11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2di11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2dui11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3d11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3di11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3dui11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2d11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2di11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2dui11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3d11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3di11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3dui11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2d11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2di11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2dui11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3d11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3di11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3dui11ps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlef2darrayps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlef2dps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlef3dps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlei2darrayps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlei2dps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlei3dps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/swizzleui2darrayps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/swizzleui2dps.h", - "src/libGLESv2/renderer/d3d11/shaders/compiled/swizzleui3dps.h", - ] - - defines += [ "ANGLE_ENABLE_D3D11" ] - libs += [ "dxguid.lib" ] - } - - if (is_debug) { - defines += [ "ANGLE_ENABLE_PERF" ] - libs += [ "d3d9.lib" ] - } - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ - ":internal_config", - "//build/config/compiler:no_chromium_code", - ] - - include_dirs = [ "src/libGLESv2" ] - - deps = [ - ":commit_id", - ":includes", - ":translator", - #":copy_compiler_dll", TODO(GYP) - ] - } - - shared_library("libEGL") { - sources = [ - "src/common/RefCountObject.cpp", - "src/common/RefCountObject.h", - "src/common/angleutils.h", - "src/common/blocklayout.cpp", - "src/common/blocklayout.h", - "src/common/debug.cpp", - "src/common/debug.h", - "src/common/event_tracer.cpp", - "src/common/event_tracer.h", - "src/common/mathutil.cpp", - "src/common/mathutil.h", - "src/common/shadervars.h", - "src/common/utilities.cpp", - "src/common/utilities.h", - "src/common/version.h", - "src/libEGL/Config.cpp", - "src/libEGL/Config.h", - "src/libEGL/Display.cpp", - "src/libEGL/Display.h", - "src/libEGL/Surface.cpp", - "src/libEGL/Surface.h", - "src/libEGL/libEGL.cpp", - "src/libEGL/libEGL.def", - "src/libEGL/libEGL.rc", - "src/libEGL/main.cpp", - "src/libEGL/main.h", - "src/libEGL/resource.h", - ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ - ":internal_config", - "//build/config/compiler:no_chromium_code", - ] - - if (is_debug) { - defines = [ "ANGLE_ENABLE_PERF" ] - } - - include_dirs = [ "src/libGLESv2" ] - libs = [ "d3d9.lib" ] - - deps = [ - ":commit_id", - ":includes", - ":libGLESv2", - ] - } -} # is_win diff --git a/tools/gn/secondary/third_party/angle/angle_commit.h b/tools/gn/secondary/third_party/angle/angle_commit.h deleted file mode 100644 index 20045d3026..0000000000 --- a/tools/gn/secondary/third_party/angle/angle_commit.h +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#define ANGLE_COMMIT_HASH "dummy_gn_cid" -#define ANGLE_COMMIT_HASH_SIZE 12 -#define ANGLE_COMMIT_DATE "0000-00-00 00:00:00 +0000" - diff --git a/tools/gn/secondary/third_party/flac/BUILD.gn b/tools/gn/secondary/third_party/flac/BUILD.gn deleted file mode 100644 index 53a2b05077..0000000000 --- a/tools/gn/secondary/third_party/flac/BUILD.gn +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -config("flac_config") { - defines = [ "FLAC__NO_DLL" ] -} - -static_library("flac") { - sources = [ - "include/FLAC/all.h", - "include/FLAC/assert.h", - "include/FLAC/callback.h", - "include/FLAC/export.h", - "include/FLAC/format.h", - "include/FLAC/metadata.h", - "include/FLAC/ordinals.h", - "include/FLAC/stream_decoder.h", - "include/FLAC/stream_encoder.h", - "include/share/alloc.h", - "src/libFLAC/alloc.c", - "src/libFLAC/bitmath.c", - "src/libFLAC/bitreader.c", - "src/libFLAC/bitwriter.c", - "src/libFLAC/cpu.c", - "src/libFLAC/crc.c", - "src/libFLAC/fixed.c", - "src/libFLAC/float.c", - "src/libFLAC/format.c", - "src/libFLAC/lpc.c", - "src/libFLAC/md5.c", - "src/libFLAC/memory.c", - "src/libFLAC/stream_decoder.c", - "src/libFLAC/stream_encoder.c", - "src/libFLAC/stream_encoder_framing.c", - "src/libFLAC/window.c", - "src/libFLAC/include/private/all.h", - "src/libFLAC/include/private/bitmath.h", - "src/libFLAC/include/private/bitreader.h", - "src/libFLAC/include/private/bitwriter.h", - "src/libFLAC/include/private/cpu.h", - "src/libFLAC/include/private/crc.h", - "src/libFLAC/include/private/fixed.h", - "src/libFLAC/include/private/float.h", - "src/libFLAC/include/private/format.h", - "src/libFLAC/include/private/lpc.h", - "src/libFLAC/include/private/md5.h", - "src/libFLAC/include/private/memory.h", - "src/libFLAC/include/private/metadata.h", - "src/libFLAC/include/private/stream_encoder_framing.h", - "src/libFLAC/include/private/window.h", - "src/libFLAC/include/protected/all.h", - "src/libFLAC/include/protected/stream_decoder.h", - "src/libFLAC/include/protected/stream_encoder.h", - ] - - defines = [ - "FLAC__OVERFLOW_DETECT", - "VERSION=\"1.2.1\"", - ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - direct_dependent_configs = [ ":flac_config" ] - - include_dirs = [ - "include", - "src/libFLAC/include", - ] - - if (is_clang) { - # libflac converts between FLAC__StreamDecoderState and - # FLAC__StreamDecoderInitStatus a lot in stream_decoder.c. - cflags = [ "-Wno-conversion" ] - } -} diff --git a/tools/gn/secondary/third_party/freetype/BUILD.gn b/tools/gn/secondary/third_party/freetype/BUILD.gn deleted file mode 100644 index ee70c4e89c..0000000000 --- a/tools/gn/secondary/third_party/freetype/BUILD.gn +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(is_android, "This library is only used on Android") - -config("freetype_config") { - include_dirs = [ "include" ] -} - -source_set("freetype") { - sources = [ - # The following files are not sorted alphabetically, but in the - # same order as in Android.mk to ease maintenance. - "src/base/ftbbox.c", - "src/base/ftbitmap.c", - "src/base/ftfstype.c", - "src/base/ftglyph.c", - "src/base/ftlcdfil.c", - "src/base/ftstroke.c", - "src/base/fttype1.c", - "src/base/ftxf86.c", - "src/base/ftbase.c", - "src/base/ftsystem.c", - "src/base/ftinit.c", - "src/base/ftgasp.c", - "src/raster/raster.c", - "src/sfnt/sfnt.c", - "src/smooth/smooth.c", - "src/autofit/autofit.c", - "src/truetype/truetype.c", - "src/cff/cff.c", - "src/psnames/psnames.c", - "src/pshinter/pshinter.c", - ] - - defines = [ - "FT2_BUILD_LIBRARY", - "DARWIN_NO_CARBON", - ] - - include_dirs = [ - "build", - ] - - direct_dependent_configs = [ ":freetype_config" ] - - deps = [ - "//third_party/libpng", - "//third_party/zlib", - ] -} diff --git a/tools/gn/secondary/third_party/icu/BUILD.gn b/tools/gn/secondary/third_party/icu/BUILD.gn deleted file mode 100644 index df268cb145..0000000000 --- a/tools/gn/secondary/third_party/icu/BUILD.gn +++ /dev/null @@ -1,444 +0,0 @@ -# Copyright (c) 2012 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Meta target that includes both icuuc and icui18n. Most targets want both. -# You can depend on the individually if you need to. -group("icu") { - deps = [ - ":icui18n", - ":icuuc", - ] -} - -# Shared config used by ICU and all dependents. -config("icu_config") { - defines = [ - "U_USING_ICU_NAMESPACE=0", - ] - - if (component_mode != "shared_library") { - defines += [ "U_STATIC_IMPLEMENTATION" ] - } - - include_dirs = [ - "source/common", - "source/i18n", - ] -} - -# Config used only by ICU code. -config("icu_code") { - if (is_win) { - # Disable some compiler warnings. - cflags = [ - "/wd4005", # Macro redefinition. - "/wd4068", # Unknown pragmas. - "/wd4267", # Conversion from size_t on 64-bits. - "/wd4996", # Deprecated functions. - ] - } else if (is_linux) { - cflags = [ - # Since ICU wants to internally use its own deprecated APIs, don't - # complain about it. - "-Wno-deprecated-declarations", - "-Wno-unused-function", - ] - } else if (is_clang) { - cflags = [ - "-Wno-deprecated-declarations", - "-Wno-logical-op-parentheses", - "-Wno-tautological-compare", - "-Wno-switch", - ] - } -} - -component("icui18n") { - sources = [ - "source/i18n/anytrans.cpp", - "source/i18n/astro.cpp", - "source/i18n/basictz.cpp", - "source/i18n/bms.cpp", - "source/i18n/bmsearch.cpp", - "source/i18n/bocsu.c", - "source/i18n/brktrans.cpp", - "source/i18n/buddhcal.cpp", - "source/i18n/calendar.cpp", - "source/i18n/casetrn.cpp", - "source/i18n/cecal.cpp", - "source/i18n/chnsecal.cpp", - "source/i18n/choicfmt.cpp", - "source/i18n/coleitr.cpp", - "source/i18n/coll.cpp", - "source/i18n/colldata.cpp", - "source/i18n/coptccal.cpp", - "source/i18n/cpdtrans.cpp", - "source/i18n/csdetect.cpp", - "source/i18n/csmatch.cpp", - "source/i18n/csr2022.cpp", - "source/i18n/csrecog.cpp", - "source/i18n/csrmbcs.cpp", - "source/i18n/csrsbcs.cpp", - "source/i18n/csrucode.cpp", - "source/i18n/csrutf8.cpp", - "source/i18n/curramt.cpp", - "source/i18n/currfmt.cpp", - "source/i18n/currpinf.cpp", - "source/i18n/currunit.cpp", - "source/i18n/datefmt.cpp", - "source/i18n/dcfmtsym.cpp", - "source/i18n/decContext.c", - "source/i18n/decNumber.c", - "source/i18n/decimfmt.cpp", - "source/i18n/digitlst.cpp", - "source/i18n/dtfmtsym.cpp", - "source/i18n/dtitvfmt.cpp", - "source/i18n/dtitvinf.cpp", - "source/i18n/dtptngen.cpp", - "source/i18n/dtrule.cpp", - "source/i18n/esctrn.cpp", - "source/i18n/ethpccal.cpp", - "source/i18n/fmtable.cpp", - "source/i18n/fmtable_cnv.cpp", - "source/i18n/format.cpp", - "source/i18n/fphdlimp.cpp", - "source/i18n/fpositer.cpp", - "source/i18n/funcrepl.cpp", - "source/i18n/gregocal.cpp", - "source/i18n/gregoimp.cpp", - "source/i18n/hebrwcal.cpp", - "source/i18n/indiancal.cpp", - "source/i18n/inputext.cpp", - "source/i18n/islamcal.cpp", - "source/i18n/japancal.cpp", - "source/i18n/locdspnm.cpp", - "source/i18n/measfmt.cpp", - "source/i18n/measure.cpp", - "source/i18n/msgfmt.cpp", - "source/i18n/name2uni.cpp", - "source/i18n/nfrs.cpp", - "source/i18n/nfrule.cpp", - "source/i18n/nfsubs.cpp", - "source/i18n/nortrans.cpp", - "source/i18n/nultrans.cpp", - "source/i18n/numfmt.cpp", - "source/i18n/numsys.cpp", - "source/i18n/olsontz.cpp", - "source/i18n/persncal.cpp", - "source/i18n/plurfmt.cpp", - "source/i18n/plurrule.cpp", - "source/i18n/quant.cpp", - "source/i18n/rbnf.cpp", - "source/i18n/rbt.cpp", - "source/i18n/rbt_data.cpp", - "source/i18n/rbt_pars.cpp", - "source/i18n/rbt_rule.cpp", - "source/i18n/rbt_set.cpp", - "source/i18n/rbtz.cpp", - "source/i18n/regexcmp.cpp", - "source/i18n/regexst.cpp", - "source/i18n/regextxt.cpp", - "source/i18n/reldtfmt.cpp", - "source/i18n/rematch.cpp", - "source/i18n/remtrans.cpp", - "source/i18n/repattrn.cpp", - "source/i18n/search.cpp", - "source/i18n/selfmt.cpp", - "source/i18n/simpletz.cpp", - "source/i18n/smpdtfmt.cpp", - "source/i18n/sortkey.cpp", - "source/i18n/strmatch.cpp", - "source/i18n/strrepl.cpp", - "source/i18n/stsearch.cpp", - "source/i18n/taiwncal.cpp", - "source/i18n/tblcoll.cpp", - "source/i18n/timezone.cpp", - "source/i18n/titletrn.cpp", - "source/i18n/tmunit.cpp", - "source/i18n/tmutamt.cpp", - "source/i18n/tmutfmt.cpp", - "source/i18n/tolowtrn.cpp", - "source/i18n/toupptrn.cpp", - "source/i18n/translit.cpp", - "source/i18n/transreg.cpp", - "source/i18n/tridpars.cpp", - "source/i18n/tzrule.cpp", - "source/i18n/tztrans.cpp", - "source/i18n/ucal.cpp", - "source/i18n/ucln_in.c", - "source/i18n/ucol.cpp", - "source/i18n/ucol_bld.cpp", - "source/i18n/ucol_cnt.cpp", - "source/i18n/ucol_elm.cpp", - "source/i18n/ucol_res.cpp", - "source/i18n/ucol_sit.cpp", - "source/i18n/ucol_tok.cpp", - "source/i18n/ucol_wgt.cpp", - "source/i18n/ucoleitr.cpp", - "source/i18n/ucsdet.cpp", - "source/i18n/ucurr.cpp", - "source/i18n/udat.cpp", - "source/i18n/udatpg.cpp", - "source/i18n/ulocdata.c", - "source/i18n/umsg.cpp", - "source/i18n/unesctrn.cpp", - "source/i18n/uni2name.cpp", - "source/i18n/unum.cpp", - "source/i18n/uregex.cpp", - "source/i18n/uregexc.cpp", - "source/i18n/usearch.cpp", - "source/i18n/uspoof.cpp", - "source/i18n/uspoof_build.cpp", - "source/i18n/uspoof_conf.cpp", - "source/i18n/uspoof_impl.cpp", - "source/i18n/uspoof_wsconf.cpp", - "source/i18n/utmscale.c", - "source/i18n/utrans.cpp", - "source/i18n/vtzone.cpp", - "source/i18n/vzone.cpp", - "source/i18n/windtfmt.cpp", - "source/i18n/winnmfmt.cpp", - "source/i18n/wintzimpl.cpp", - "source/i18n/zonemeta.cpp", - "source/i18n/zrule.cpp", - "source/i18n/zstrfmt.cpp", - "source/i18n/ztrans.cpp", - ] - defines = [ - "U_I18N_IMPLEMENTATION", - ] - deps = [ - ":icuuc", - ] - - # ICU uses RTTI, replace the default "no rtti" config. - configs -= [ - "//build/config/compiler:no_rtti", # ICU uses RTTI. - "//build/config/compiler:chromium_code", - ] - configs += [ - "//build/config/compiler:rtti", - "//build/config/compiler:no_chromium_code", - ] - - configs += [ ":icu_code" ] - direct_dependent_configs = [ ":icu_config" ] - - if (is_clang) { - # uspoof.h has a U_NAMESPACE_USE macro. That's a bug, - # the header should use U_NAMESPACE_BEGIN instead. - # http://bugs.icu-project.org/trac/ticket/9054 - configs -= [ "//build/config/clang:extra_warnings" ] - - cflags = [ - "-Wno-header-hygiene", - # Looks like a real issue, see http://crbug.com/114660 - "-Wno-return-type-c-linkage", - ] - } -} - -component("icuuc") { - sources = [ - "source/common/bmpset.cpp", - "source/common/brkeng.cpp", - "source/common/brkiter.cpp", - "source/common/bytestream.cpp", - "source/common/caniter.cpp", - "source/common/chariter.cpp", - "source/common/charstr.cpp", - "source/common/cmemory.c", - "source/common/cstring.c", - "source/common/cwchar.c", - "source/common/dictbe.cpp", - "source/common/dtintrv.cpp", - "source/common/errorcode.cpp", - "source/common/filterednormalizer2.cpp", - "source/common/icudataver.c", - "source/common/icuplug.c", - "source/common/locavailable.cpp", - "source/common/locbased.cpp", - "source/common/locdispnames.cpp", - "source/common/locid.cpp", - "source/common/loclikely.cpp", - "source/common/locmap.c", - "source/common/locresdata.cpp", - "source/common/locutil.cpp", - "source/common/mutex.cpp", - "source/common/normalizer2.cpp", - "source/common/normalizer2impl.cpp", - "source/common/normlzr.cpp", - "source/common/parsepos.cpp", - "source/common/propname.cpp", - "source/common/propsvec.c", - "source/common/punycode.c", - "source/common/putil.c", - "source/common/rbbi.cpp", - "source/common/rbbidata.cpp", - "source/common/rbbinode.cpp", - "source/common/rbbirb.cpp", - "source/common/rbbiscan.cpp", - "source/common/rbbisetb.cpp", - "source/common/rbbistbl.cpp", - "source/common/rbbitblb.cpp", - "source/common/resbund.cpp", - "source/common/resbund_cnv.cpp", - "source/common/ruleiter.cpp", - "source/common/schriter.cpp", - "source/common/serv.cpp", - "source/common/servlk.cpp", - "source/common/servlkf.cpp", - "source/common/servls.cpp", - "source/common/servnotf.cpp", - "source/common/servrbf.cpp", - "source/common/servslkf.cpp", - "source/common/stringpiece.cpp", - "source/common/triedict.cpp", - "source/common/uarrsort.c", - "source/common/ubidi.c", - "source/common/ubidi_props.c", - "source/common/ubidiln.c", - "source/common/ubidiwrt.c", - "source/common/ubrk.cpp", - "source/common/ucase.c", - "source/common/ucasemap.c", - "source/common/ucat.c", - "source/common/uchar.c", - "source/common/uchriter.cpp", - "source/common/ucln_cmn.c", - "source/common/ucmndata.c", - "source/common/ucnv.c", - "source/common/ucnv2022.c", - "source/common/ucnv_bld.c", - "source/common/ucnv_cb.c", - "source/common/ucnv_cnv.c", - "source/common/ucnv_err.c", - "source/common/ucnv_ext.c", - "source/common/ucnv_io.c", - "source/common/ucnv_lmb.c", - "source/common/ucnv_set.c", - "source/common/ucnv_u16.c", - "source/common/ucnv_u32.c", - "source/common/ucnv_u7.c", - "source/common/ucnv_u8.c", - "source/common/ucnvbocu.c", - "source/common/ucnvdisp.c", - "source/common/ucnvhz.c", - "source/common/ucnvisci.c", - "source/common/ucnvlat1.c", - "source/common/ucnvmbcs.c", - "source/common/ucnvscsu.c", - "source/common/ucnvsel.cpp", - "source/common/ucol_swp.cpp", - "source/common/udata.cpp", - "source/common/udatamem.c", - "source/common/udataswp.c", - "source/common/uenum.c", - "source/common/uhash.c", - "source/common/uhash_us.cpp", - "source/common/uidna.cpp", - "source/common/uinit.c", - "source/common/uinvchar.c", - "source/common/uiter.cpp", - "source/common/ulist.c", - "source/common/uloc.c", - "source/common/uloc_tag.c", - "source/common/umapfile.c", - "source/common/umath.c", - "source/common/umutex.c", - "source/common/unames.c", - "source/common/unifilt.cpp", - "source/common/unifunct.cpp", - "source/common/uniset.cpp", - "source/common/uniset_props.cpp", - "source/common/unisetspan.cpp", - "source/common/unistr.cpp", - "source/common/unistr_case.cpp", - "source/common/unistr_cnv.cpp", - "source/common/unistr_props.cpp", - "source/common/unorm.cpp", - "source/common/unorm_it.c", - "source/common/unormcmp.cpp", - "source/common/uobject.cpp", - "source/common/uprops.cpp", - "source/common/ures_cnv.c", - "source/common/uresbund.c", - "source/common/uresdata.c", - "source/common/usc_impl.c", - "source/common/uscript.c", - "source/common/uset.cpp", - "source/common/uset_props.cpp", - "source/common/usetiter.cpp", - "source/common/ushape.c", - "source/common/usprep.cpp", - "source/common/ustack.cpp", - "source/common/ustr_cnv.c", - "source/common/ustr_wcs.c", - "source/common/ustrcase.c", - "source/common/ustrenum.cpp", - "source/common/ustrfmt.c", - "source/common/ustring.c", - "source/common/ustrtrns.c", - "source/common/utext.cpp", - "source/common/utf_impl.c", - "source/common/util.cpp", - "source/common/util_props.cpp", - "source/common/utrace.c", - "source/common/utrie.c", - "source/common/utrie2.cpp", - "source/common/utrie2_builder.c", - "source/common/uts46.cpp", - "source/common/utypes.c", - "source/common/uvector.cpp", - "source/common/uvectr32.cpp", - "source/common/uvectr64.cpp", - "source/common/wintz.c", - "source/stubdata/stubdata.c", - ] - defines = [ - "U_COMMON_IMPLEMENTATION", - ] - deps = [ - ":icudata", - ] - configs += [ ":icu_code" ] - - configs -= [ - "//build/config/compiler:no_rtti", # ICU uses RTTI. - "//build/config/compiler:chromium_code", - ] - configs += [ - "//build/config/compiler:rtti", - "//build/config/compiler:no_chromium_code", - ] - - direct_dependent_configs = [ ":icu_config" ] - - if (!is_win) { - sources -= [ "source/stubdata/stubdata.c" ] - } -} - -if (is_win) { - # On Windows the target DLL is pre-built so just use a copy rule. - copy("icudata") { - sources = [ "windows/icudt.dll" ] - outputs = [ "$root_out_dir/icudt.dll" ] - } -} else { - source_set("icudata") { - sources = [ - # These are hand-generated, but will do for now. The linux version is an - # identical copy of the (mac) icudt46l_dat.S file, modulo removal of the - # .private_extern and .const directives and with no leading underscore on - # the icudt46_dat symbol. - "android/icudt46l_dat.S", - "linux/icudt46l_dat.S", - "mac/icudt46l_dat.S", - ] - defines = [ "U_HIDE_DATA_SYMBOL" ] - - # TODO(brettw) support use_system_icu and icu_use_data_file_flag. - } -} diff --git a/tools/gn/secondary/third_party/leveldatabase/BUILD.gn b/tools/gn/secondary/third_party/leveldatabase/BUILD.gn deleted file mode 100644 index 4fe2c7a76a..0000000000 --- a/tools/gn/secondary/third_party/leveldatabase/BUILD.gn +++ /dev/null @@ -1,338 +0,0 @@ -# Copyright (c) 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Snappy is a compression library we use. -# TODO(brettw) It's not clear why this needs to be parameterized. -use_snappy = true - -defines = [ "LEVELDB_PLATFORM_CHROMIUM=1" ] - -config("leveldatabase_config") { - include_dirs = [ - ".", - "src", - "src/include", - ] - if (is_win) { - include_dirs += [ "src/port/win" ] - } -} - -static_library("leveldatabase") { - sources = [ - "env_chromium.cc", - "env_chromium.h", - "env_chromium_stdio.cc", - "env_chromium_stdio.h", - "env_idb.h", - "port/port_chromium.cc", - "port/port_chromium.h", - "src/db/builder.cc", - "src/db/builder.h", - "src/db/db_impl.cc", - "src/db/db_impl.h", - "src/db/db_iter.cc", - "src/db/db_iter.h", - "src/db/filename.cc", - "src/db/filename.h", - "src/db/dbformat.cc", - "src/db/dbformat.h", - "src/db/log_format.h", - "src/db/log_reader.cc", - "src/db/log_reader.h", - "src/db/log_writer.cc", - "src/db/log_writer.h", - "src/db/memtable.cc", - "src/db/memtable.h", - "src/db/repair.cc", - "src/db/skiplist.h", - "src/db/snapshot.h", - "src/db/table_cache.cc", - "src/db/table_cache.h", - "src/db/version_edit.cc", - "src/db/version_edit.h", - "src/db/version_set.cc", - "src/db/version_set.h", - "src/db/write_batch.cc", - "src/db/write_batch_internal.h", - "src/helpers/memenv/memenv.cc", - "src/helpers/memenv/memenv.h", - "src/include/leveldb/cache.h", - "src/include/leveldb/comparator.h", - "src/include/leveldb/db.h", - "src/include/leveldb/env.h", - "src/include/leveldb/filter_policy.h", - "src/include/leveldb/iterator.h", - "src/include/leveldb/options.h", - "src/include/leveldb/slice.h", - "src/include/leveldb/status.h", - "src/include/leveldb/table.h", - "src/include/leveldb/table_builder.h", - "src/include/leveldb/write_batch.h", - "src/port/port.h", - "src/port/port_example.h", - #"src/port/port_posix.cc", # We use the chromium port instead of this. - #"src/port/port_posix.h", - "src/table/block.cc", - "src/table/block.h", - "src/table/block_builder.cc", - "src/table/block_builder.h", - "src/table/filter_block.cc", - "src/table/filter_block.h", - "src/table/format.cc", - "src/table/format.h", - "src/table/iterator.cc", - "src/table/iterator_wrapper.h", - "src/table/merger.cc", - "src/table/merger.h", - "src/table/table.cc", - "src/table/table_builder.cc", - "src/table/two_level_iterator.cc", - "src/table/two_level_iterator.h", - "src/util/arena.cc", - "src/util/arena.h", - "src/util/bloom.cc", - "src/util/cache.cc", - "src/util/coding.cc", - "src/util/coding.h", - "src/util/comparator.cc", - "src/util/crc32c.cc", - "src/util/crc32c.h", - "src/util/env.cc", - "src/util/filter_policy.cc", - "src/util/hash.cc", - "src/util/hash.h", - "src/util/logging.cc", - "src/util/logging.h", - "src/util/mutexlock.h", - "src/util/options.cc", - "src/util/random.h", - "src/util/status.cc", - ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - - direct_dependent_configs = [ ":leveldatabase_config" ] - - deps = [ - "//base", - "//base/third_party/dynamic_annotations", - "//third_party/re2", - ] - - if (use_snappy) { - defines += [ "USE_SNAPPY=1" ] - deps += [ "//third_party/snappy" ] - } -} - -if (!is_android) { - test("env_chromium_unittests") { - sources = [ - "env_chromium_unittest.cc", - ] - deps = [ - ":leveldatabase", - "//base/test:test_support", - "//testing/gtest", - ] - } - - static_library("leveldb_testutil") { - sources = [ - "src/util/histogram.cc", - "src/util/histogram.h", - "src/util/testharness.cc", - "src/util/testharness.h", - "src/util/testutil.cc", - "src/util/testutil.h", - ] - - forward_dependent_configs_from = [ ":leveldatabase" ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - - deps = [ - ":leveldatabase", - "//base", - ] - } - - test("leveldb_arena_test") { - sources = [ - "src/util/arena_test.cc", - ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - ":leveldb_testutil", - ] - } - - test("leveldb_bloom_test") { - sources = [ - "src/util/bloom_test.cc", - ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - ":leveldb_testutil", - ] - } - - test("leveldb_cache_test") { - sources = [ - "src/util/cache_test.cc", - ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - ":leveldb_testutil", - ] - } - - test("leveldb_corruption_test") { - sources = [ - "src/db/corruption_test.cc", - ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - ":leveldb_testutil", - ] - } - - test("leveldb_crc32c_test") { - sources = [ - "src/util/crc32c_test.cc" - ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - ":leveldb_testutil", - ] - } - - test("leveldb_db_bench") { - sources = [ - "src/db/db_bench.cc", - ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - ":leveldb_testutil", - ] - } - - test("leveldb_db_test") { - sources = [ - "src/db/db_test.cc", - ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - ":leveldb_testutil", - ] - } - - test("leveldb_dbformat_test") { - sources = [ - "src/db/dbformat_test.cc", - ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - ":leveldb_testutil", - ] - } - - test("leveldb_env_test") { - sources = [ - "src/util/env_test.cc", - ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - ":leveldb_testutil", - ] - } - - test("leveldb_filename_test") { - sources = [ - "src/db/filename_test.cc", - ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - ":leveldb_testutil", - ] - } - - test("leveldb_filter_block_test") { - sources = [ - "src/table/filter_block_test.cc", - ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - ":leveldb_testutil", - ] - } - - test("leveldb_log_test") { - sources = [ - "src/db/log_test.cc", - ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - ":leveldb_testutil", - ] - } - - test("leveldb_skiplist_test") { - sources = [ - "src/db/skiplist_test.cc", - ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - ":leveldb_testutil", - ] - } - - test("leveldb_table_test") { - sources = [ - "src/table/table_test.cc", - ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - ":leveldb_testutil", - ] - } - - test("leveldb_version_edit_test") { - sources = [ - "src/db/version_edit_test.cc", - ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - ":leveldb_testutil", - ] - } - - test("leveldb_write_batch_test") { - sources = [ - "src/db/write_batch_test.cc", - ] - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - ":leveldb_testutil", - ] - } -} diff --git a/tools/gn/secondary/third_party/libjpeg_turbo/BUILD.gn b/tools/gn/secondary/third_party/libjpeg_turbo/BUILD.gn deleted file mode 100644 index f594fbecb5..0000000000 --- a/tools/gn/secondary/third_party/libjpeg_turbo/BUILD.gn +++ /dev/null @@ -1,216 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Do not use the targets in this file unless you need a certain libjpeg -# implementation. Use the meta target //third_party:jpeg instead. - -if (cpu_arch == "arm") { - import("//build/config/arm.gni") -} - -if (cpu_arch == "x86" || cpu_arch == "x64") { - -import("//third_party/yasm/yasm_assemble.gni") - -yasm_assemble("simd_asm") { - defines = [] - - if (cpu_arch == "x86") { - sources = [ - "simd/jccolmmx.asm", - "simd/jccolss2.asm", - "simd/jcgrammx.asm", - "simd/jcgrass2.asm", - "simd/jcqnt3dn.asm", - "simd/jcqntmmx.asm", - "simd/jcqnts2f.asm", - "simd/jcqnts2i.asm", - "simd/jcqntsse.asm", - "simd/jcsammmx.asm", - "simd/jcsamss2.asm", - "simd/jdcolmmx.asm", - "simd/jdcolss2.asm", - "simd/jdmermmx.asm", - "simd/jdmerss2.asm", - "simd/jdsammmx.asm", - "simd/jdsamss2.asm", - "simd/jf3dnflt.asm", - "simd/jfmmxfst.asm", - "simd/jfmmxint.asm", - "simd/jfss2fst.asm", - "simd/jfss2int.asm", - "simd/jfsseflt.asm", - "simd/ji3dnflt.asm", - "simd/jimmxfst.asm", - "simd/jimmxint.asm", - "simd/jimmxred.asm", - "simd/jiss2flt.asm", - "simd/jiss2fst.asm", - "simd/jiss2int.asm", - "simd/jiss2red.asm", - "simd/jisseflt.asm", - "simd/jsimdcpu.asm", - ] - defines += [ - "__x86__", - ] - } else if (cpu_arch == "x64") { - sources = [ - "simd/jccolss2-64.asm", - "simd/jcgrass2-64.asm", - "simd/jcqnts2f-64.asm", - "simd/jcqnts2i-64.asm", - "simd/jcsamss2-64.asm", - "simd/jdcolss2-64.asm", - "simd/jdmerss2-64.asm", - "simd/jdsamss2-64.asm", - "simd/jfss2fst-64.asm", - "simd/jfss2int-64.asm", - "simd/jfsseflt-64.asm", - "simd/jiss2flt-64.asm", - "simd/jiss2fst-64.asm", - "simd/jiss2int-64.asm", - "simd/jiss2red-64.asm", - ] - defines += [ - "__x86_64__", - ] - } - - if (is_win) { - defines += [ - "MSVC", - ] - include_dirs = [ "win" ] - if (cpu_arch == "x86") { - defines += [ - "WIN32", - ] - } else { - defines += [ - "WIN64", - ] - } - } else if (is_mac) { - defines += [ - "MACHO", - ] - include_dirs = [ "mac" ] - } else if (is_linux) { - defines += [ - "ELF", - ] - include_dirs = [ "linux" ] - } -} - -} - -source_set("simd") { - if (cpu_arch == "x86") { - deps = [ ":simd_asm" ] - sources = [ - "simd/jsimd_i386.c", - ] - } else if (cpu_arch == "x64") { - deps = [ ":simd_asm" ] - sources = [ - "simd/jsimd_x86_64.c", - ] - } else if (cpu_arch == "arm" && arm_version >= 7 && - (arm_use_neon || arm_optionally_use_neon)) { - sources = [ - "simd/jsimd_arm.c", - "simd/jsimd_arm_neon.S", - ] - } else { - sources = [ "jsimd_none.c" ] - } -} - -config("libjpeg_config") { - include_dirs = [ "." ] -} - -source_set("libjpeg") { - sources = [ - "jcapimin.c", - "jcapistd.c", - "jccoefct.c", - "jccolor.c", - "jcdctmgr.c", - "jchuff.c", - "jchuff.h", - "jcinit.c", - "jcmainct.c", - "jcmarker.c", - "jcmaster.c", - "jcomapi.c", - "jconfig.h", - "jcparam.c", - "jcphuff.c", - "jcprepct.c", - "jcsample.c", - "jdapimin.c", - "jdapistd.c", - "jdatadst.c", - "jdatasrc.c", - "jdcoefct.c", - "jdcolor.c", - "jdct.h", - "jddctmgr.c", - "jdhuff.c", - "jdhuff.h", - "jdinput.c", - "jdmainct.c", - "jdmarker.c", - "jdmaster.c", - "jdmerge.c", - "jdphuff.c", - "jdpostct.c", - "jdsample.c", - "jerror.c", - "jerror.h", - "jfdctflt.c", - "jfdctfst.c", - "jfdctint.c", - "jidctflt.c", - "jidctfst.c", - "jidctint.c", - "jidctred.c", - "jinclude.h", - "jmemmgr.c", - "jmemnobs.c", - "jmemsys.h", - "jmorecfg.h", - "jpegint.h", - "jpeglib.h", - "jpeglibmangler.h", - "jquant1.c", - "jquant2.c", - "jutils.c", - "jversion.h", - ] - - defines = [ - "WITH_SIMD", - "MOTION_JPEG_SUPPORTED", - "NO_GETENV", - ] - - configs += [ ":libjpeg_config" ] - - direct_dependent_configs = [ ":libjpeg_config" ] - - # MemorySanitizer doesn't support assembly code, so keep it disabled in - # MSan builds for now. - # TODO: Enable on Linux when .asm files are recognized. - if (is_msan || is_linux) { - sources += [ "jsimd_none.c" ] - } else { - deps = [ ":simd" ] - } - - # TODO(GYP): Compile the .asm files with YASM as GYP does. -} diff --git a/tools/gn/secondary/third_party/nss/BUILD.gn b/tools/gn/secondary/third_party/nss/BUILD.gn deleted file mode 100644 index 00261e98e9..0000000000 --- a/tools/gn/secondary/third_party/nss/BUILD.gn +++ /dev/null @@ -1,1159 +0,0 @@ -# Copyright (c) 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("//build/config/linux/pkg_config.gni") - -if (is_linux) { - # This is a dependency on NSS with no libssl. On Linux we use a built-in SSL - # library but the system NSS libraries. Non-Linux platforms using NSS use the - # hermetic one in //third_party/nss. - # - # Generally you should depend on //crypto:platform instead of using this - # config since that will properly pick up NSS or OpenSSL depending on - # platform and build config. - pkg_config("system_nss_no_ssl_config") { - packages = [ "nss" ] - extra_args = [ "-v", "-lssl3" ] - } -} else { - include_nss_root_certs = is_ios - include_nss_libpkix = is_ios - - config("nspr_config") { - defines = [ "NO_NSPR_10_SUPPORT" ] - include_dirs = [ - "nspr/pr/include", - "nspr/lib/ds", - "nspr/lib/libc/include", - ] - - if (component_mode != "shared_library") { - defines += [ "NSPR_STATIC" ] - } - } - - component("nspr") { - output_name = "crnspr" - sources = [ - "nspr/lib/ds/plarena.c", - "nspr/lib/ds/plarena.h", - "nspr/lib/ds/plarenas.h", - "nspr/lib/ds/plhash.c", - "nspr/lib/ds/plhash.h", - "nspr/lib/libc/include/plbase64.h", - "nspr/lib/libc/include/plerror.h", - "nspr/lib/libc/include/plgetopt.h", - "nspr/lib/libc/include/plstr.h", - "nspr/lib/libc/src/base64.c", - "nspr/lib/libc/src/plerror.c", - "nspr/lib/libc/src/plgetopt.c", - "nspr/lib/libc/src/strcase.c", - "nspr/lib/libc/src/strcat.c", - "nspr/lib/libc/src/strchr.c", - "nspr/lib/libc/src/strcmp.c", - "nspr/lib/libc/src/strcpy.c", - "nspr/lib/libc/src/strdup.c", - "nspr/lib/libc/src/strlen.c", - "nspr/lib/libc/src/strpbrk.c", - "nspr/lib/libc/src/strstr.c", - "nspr/lib/libc/src/strtok.c", - "nspr/pr/include/md/prosdep.h", - "nspr/pr/include/md/_darwin.cfg", - "nspr/pr/include/md/_darwin.h", - "nspr/pr/include/md/_pcos.h", - "nspr/pr/include/md/_pth.h", - "nspr/pr/include/md/_unixos.h", - "nspr/pr/include/md/_unix_errors.h", - "nspr/pr/include/md/_win32_errors.h", - "nspr/pr/include/md/_win95.cfg", - "nspr/pr/include/md/_win95.h", - "nspr/pr/include/nspr.h", - "nspr/pr/include/obsolete/pralarm.h", - "nspr/pr/include/obsolete/probslet.h", - "nspr/pr/include/obsolete/protypes.h", - "nspr/pr/include/obsolete/prsem.h", - "nspr/pr/include/pratom.h", - "nspr/pr/include/prbit.h", - "nspr/pr/include/prclist.h", - "nspr/pr/include/prcmon.h", - "nspr/pr/include/prcountr.h", - "nspr/pr/include/prcpucfg.h", - "nspr/pr/include/prcvar.h", - "nspr/pr/include/prdtoa.h", - "nspr/pr/include/prenv.h", - "nspr/pr/include/prerr.h", - "nspr/pr/include/prerror.h", - "nspr/pr/include/prinet.h", - "nspr/pr/include/prinit.h", - "nspr/pr/include/prinrval.h", - "nspr/pr/include/prio.h", - "nspr/pr/include/pripcsem.h", - "nspr/pr/include/private/pprio.h", - "nspr/pr/include/private/pprmwait.h", - "nspr/pr/include/private/pprthred.h", - "nspr/pr/include/private/primpl.h", - "nspr/pr/include/private/prpriv.h", - "nspr/pr/include/prlink.h", - "nspr/pr/include/prlock.h", - "nspr/pr/include/prlog.h", - "nspr/pr/include/prlong.h", - "nspr/pr/include/prmem.h", - "nspr/pr/include/prmon.h", - "nspr/pr/include/prmwait.h", - "nspr/pr/include/prnetdb.h", - "nspr/pr/include/prolock.h", - "nspr/pr/include/prpdce.h", - "nspr/pr/include/prprf.h", - "nspr/pr/include/prproces.h", - "nspr/pr/include/prrng.h", - "nspr/pr/include/prrwlock.h", - "nspr/pr/include/prshm.h", - "nspr/pr/include/prshma.h", - "nspr/pr/include/prsystem.h", - "nspr/pr/include/prthread.h", - "nspr/pr/include/prtime.h", - "nspr/pr/include/prtpool.h", - "nspr/pr/include/prtrace.h", - "nspr/pr/include/prtypes.h", - "nspr/pr/include/prvrsion.h", - "nspr/pr/include/prwin16.h", - "nspr/pr/src/io/prdir.c", - "nspr/pr/src/io/prfdcach.c", - "nspr/pr/src/io/prfile.c", - "nspr/pr/src/io/prio.c", - "nspr/pr/src/io/priometh.c", - "nspr/pr/src/io/pripv6.c", - "nspr/pr/src/io/prlayer.c", - "nspr/pr/src/io/prlog.c", - "nspr/pr/src/io/prmapopt.c", - "nspr/pr/src/io/prmmap.c", - "nspr/pr/src/io/prmwait.c", - "nspr/pr/src/io/prpolevt.c", - "nspr/pr/src/io/prprf.c", - "nspr/pr/src/io/prscanf.c", - "nspr/pr/src/io/prsocket.c", - "nspr/pr/src/io/prstdio.c", - "nspr/pr/src/linking/prlink.c", - "nspr/pr/src/malloc/prmalloc.c", - "nspr/pr/src/malloc/prmem.c", - "nspr/pr/src/md/prosdep.c", - "nspr/pr/src/md/unix/darwin.c", - "nspr/pr/src/md/unix/os_Darwin.s", - "nspr/pr/src/md/unix/unix.c", - "nspr/pr/src/md/unix/unix_errors.c", - "nspr/pr/src/md/unix/uxproces.c", - "nspr/pr/src/md/unix/uxrng.c", - "nspr/pr/src/md/unix/uxshm.c", - "nspr/pr/src/md/unix/uxwrap.c", - "nspr/pr/src/md/windows/ntgc.c", - "nspr/pr/src/md/windows/ntinrval.c", - "nspr/pr/src/md/windows/ntmisc.c", - "nspr/pr/src/md/windows/ntsec.c", - "nspr/pr/src/md/windows/ntsem.c", - "nspr/pr/src/md/windows/w32ipcsem.c", - "nspr/pr/src/md/windows/w32poll.c", - "nspr/pr/src/md/windows/w32rng.c", - "nspr/pr/src/md/windows/w32shm.c", - "nspr/pr/src/md/windows/w95cv.c", - "nspr/pr/src/md/windows/w95dllmain.c", - "nspr/pr/src/md/windows/w95io.c", - "nspr/pr/src/md/windows/w95sock.c", - "nspr/pr/src/md/windows/w95thred.c", - "nspr/pr/src/md/windows/win32_errors.c", - "nspr/pr/src/memory/prseg.c", - "nspr/pr/src/memory/prshm.c", - "nspr/pr/src/memory/prshma.c", - "nspr/pr/src/misc/pralarm.c", - "nspr/pr/src/misc/pratom.c", - "nspr/pr/src/misc/praton.c", - "nspr/pr/src/misc/prcountr.c", - "nspr/pr/src/misc/prdtoa.c", - "nspr/pr/src/misc/prenv.c", - "nspr/pr/src/misc/prerr.c", - "nspr/pr/src/misc/prerror.c", - "nspr/pr/src/misc/prerrortable.c", - "nspr/pr/src/misc/prinit.c", - "nspr/pr/src/misc/prinrval.c", - "nspr/pr/src/misc/pripc.c", - "nspr/pr/src/misc/pripcsem.c", - "nspr/pr/src/misc/prlog2.c", - "nspr/pr/src/misc/prlong.c", - "nspr/pr/src/misc/prnetdb.c", - "nspr/pr/src/misc/prolock.c", - "nspr/pr/src/misc/prrng.c", - "nspr/pr/src/misc/prsystem.c", - "nspr/pr/src/misc/prthinfo.c", - "nspr/pr/src/misc/prtime.c", - "nspr/pr/src/misc/prtpool.c", - "nspr/pr/src/misc/prtrace.c", - "nspr/pr/src/pthreads/ptio.c", - "nspr/pr/src/pthreads/ptmisc.c", - "nspr/pr/src/pthreads/ptsynch.c", - "nspr/pr/src/pthreads/ptthread.c", - "nspr/pr/src/threads/combined/prucpu.c", - "nspr/pr/src/threads/combined/prucv.c", - "nspr/pr/src/threads/combined/prulock.c", - "nspr/pr/src/threads/combined/prustack.c", - "nspr/pr/src/threads/combined/pruthr.c", - "nspr/pr/src/threads/prcmon.c", - "nspr/pr/src/threads/prcthr.c", - "nspr/pr/src/threads/prdump.c", - "nspr/pr/src/threads/prmon.c", - "nspr/pr/src/threads/prrwlock.c", - "nspr/pr/src/threads/prsem.c", - "nspr/pr/src/threads/prtpd.c", - ] - - direct_dependent_configs = [ ":nspr_config" ] - - configs -= [ - "//build/config/compiler:chromium_code", - ] - if (is_win) { - configs -= [ - "//build/config/win:unicode", # Requires 8-bit mode. - "//build/config/win:lean_and_mean", # Won"t compile with lean and mean. - ] - } - configs += [ "//build/config/compiler:no_chromium_code" ] - - cflags = [] - defines = [ - "_NSPR_BUILD", - "FORCE_PR_LOG", - ] - - include_dirs = [ - "nspr/pr/include/private", - ] - - if (is_win) { - cflags = [ - "/wd4554", # Check precidence. - "/wd4267", # Conversion from size_t to "type". - ] - defines += [ - "XP_PC", - "WIN32", - "WIN95", - "_PR_GLOBAL_THREADS_ONLY", - "_CRT_SECURE_NO_WARNINGS", - ] - } else { - sources -= [ - "nspr/pr/src/md/windows/ntgc.c", - "nspr/pr/src/md/windows/ntinrval.c", - "nspr/pr/src/md/windows/ntmisc.c", - "nspr/pr/src/md/windows/ntsec.c", - "nspr/pr/src/md/windows/ntsem.c", - "nspr/pr/src/md/windows/w32ipcsem.c", - "nspr/pr/src/md/windows/w32poll.c", - "nspr/pr/src/md/windows/w32rng.c", - "nspr/pr/src/md/windows/w32shm.c", - "nspr/pr/src/md/windows/w95cv.c", - "nspr/pr/src/md/windows/w95dllmain.c", - "nspr/pr/src/md/windows/w95io.c", - "nspr/pr/src/md/windows/w95sock.c", - "nspr/pr/src/md/windows/w95thred.c", - "nspr/pr/src/md/windows/win32_errors.c", - "nspr/pr/src/threads/combined/prucpu.c", - "nspr/pr/src/threads/combined/prucv.c", - "nspr/pr/src/threads/combined/prulock.c", - "nspr/pr/src/threads/combined/prustack.c", - "nspr/pr/src/threads/combined/pruthr.c", - ] - } - - if (!is_posix) { - sources -= [ - "nspr/pr/src/md/unix/darwin.c", - "nspr/pr/src/md/unix/os_Darwin.s", - "nspr/pr/src/md/unix/unix.c", - "nspr/pr/src/md/unix/unix_errors.c", - "nspr/pr/src/md/unix/uxproces.c", - "nspr/pr/src/md/unix/uxrng.c", - "nspr/pr/src/md/unix/uxshm.c", - "nspr/pr/src/md/unix/uxwrap.c", - "nspr/pr/src/pthreads/ptio.c", - "nspr/pr/src/pthreads/ptmisc.c", - "nspr/pr/src/pthreads/ptsynch.c", - "nspr/pr/src/pthreads/ptthread.c", - ] - } - - if (cpu_arch == "x86") { - defines += [ "_X86_" ] - } else if (cpu_arch == "x64") { - defines += [ "_AMD64_" ] - } - - if (is_mac || is_ios) { - sources -= [ - "nspr/pr/src/io/prdir.c", - "nspr/pr/src/io/prfile.c", - "nspr/pr/src/io/prio.c", - "nspr/pr/src/io/prsocket.c", - "nspr/pr/src/misc/pripcsem.c", - "nspr/pr/src/threads/prcthr.c", - "nspr/pr/src/threads/prdump.c", - "nspr/pr/src/threads/prmon.c", - "nspr/pr/src/threads/prsem.c", - ] - defines += [ - "XP_UNIX", - "DARWIN", - "XP_MACOSX", - "_PR_PTHREADS", - "HAVE_BSD_FLOCK", - "HAVE_DLADDR", - "HAVE_LCHOWN", - "HAVE_SOCKLEN_T", - "HAVE_STRERROR", - ] - } - - if (is_mac) { - defines += [ - "HAVE_CRT_EXTERNS_H", - ] - libs = [ - "CoreFoundation.framework", - "CoreServices.framework", - ] - } - - if (is_clang) { - cflags += [ - # nspr uses a bunch of deprecated functions (NSLinkModule etc) in - # prlink.c on mac. - "-Wno-deprecated-declarations", - # nspr passes "const char*" through "void*". - "-Wno-incompatible-pointer-types", - # nspr passes "int*" through "unsigned int*". - "-Wno-pointer-sign", - - "-Wno-incompatible-pointer-types", - "-Wno-pointer-sign", - ] - } - } - - component("nss") { - output_name = "crnss" - sources = [ - # Ensure at least one object file is produced, so that MSVC does not - # warn when creating the static/shared library. See the note for - # the "nssckbi" target for why the "nss" target was split as such. - "nss/lib/nss/nssver.c", - ] - - deps = [ ":nss_static" ] - - if (include_nss_root_certs) { - deps += [ ":nssckbi" ] - } - - if (component_mode == "shared_library") { - if (is_mac) { - ldflags = [ "-all_load" ] - } else if (is_win) { - # Pass the def file to the linker. - ldflags = [ rebase_path("nss/exports_win.def", root_build_dir) ] - } - } - - forward_dependent_configs_from = deps - } - - config("nssckbi_config") { - include_dirs = [ "nss/lib/ckfw/builtins" ] - } - - # This is really more of a pseudo-target to work around the fact that - # a single static_library target cannot contain two object files of the - # same name (hash.o / hash.obj). Logically, this is part of the - # "nss_static" target. By separating it out, it creates a possible - # circular dependency between "nss_static" and "nssckbi" when - # "exclude_nss_root_certs" is not specified, as "nss_static" depends on - # the "builtinsC_GetFunctionList" exported by this target. This is an - # artifact of how NSS is being statically built, which is not an - # officially supported configuration - normally, "nssckbi.dll/so" would - # depend on libnss3.dll/so, and the higher layer caller would instruct - # libnss3.dll to dynamically load nssckbi.dll, breaking the circle. - # - # TODO(rsleevi): http://crbug.com/128134 - Break the circular dependency - # without requiring nssckbi to be built as a shared library. - source_set("nssckbi") { - visibility = ":nss" # This target is internal implementation detail. - - sources = [ - "nss/lib/ckfw/builtins/anchor.c", - "nss/lib/ckfw/builtins/bfind.c", - "nss/lib/ckfw/builtins/binst.c", - "nss/lib/ckfw/builtins/bobject.c", - "nss/lib/ckfw/builtins/bsession.c", - "nss/lib/ckfw/builtins/bslot.c", - "nss/lib/ckfw/builtins/btoken.c", - "nss/lib/ckfw/builtins/builtins.h", - "nss/lib/ckfw/builtins/certdata.c", - "nss/lib/ckfw/builtins/ckbiver.c", - "nss/lib/ckfw/builtins/constants.c", - "nss/lib/ckfw/builtins/nssckbi.h", - "nss/lib/ckfw/ck.h", - "nss/lib/ckfw/ckfw.h", - "nss/lib/ckfw/ckfwm.h", - "nss/lib/ckfw/ckfwtm.h", - "nss/lib/ckfw/ckmd.h", - "nss/lib/ckfw/ckt.h", - "nss/lib/ckfw/crypto.c", - "nss/lib/ckfw/find.c", - "nss/lib/ckfw/hash.c", - "nss/lib/ckfw/instance.c", - "nss/lib/ckfw/mechanism.c", - "nss/lib/ckfw/mutex.c", - "nss/lib/ckfw/nssck.api", - "nss/lib/ckfw/nssckepv.h", - "nss/lib/ckfw/nssckft.h", - "nss/lib/ckfw/nssckfw.h", - "nss/lib/ckfw/nssckfwc.h", - "nss/lib/ckfw/nssckfwt.h", - "nss/lib/ckfw/nssckg.h", - "nss/lib/ckfw/nssckmdt.h", - "nss/lib/ckfw/nssckt.h", - "nss/lib/ckfw/object.c", - "nss/lib/ckfw/session.c", - "nss/lib/ckfw/sessobj.c", - "nss/lib/ckfw/slot.c", - "nss/lib/ckfw/token.c", - "nss/lib/ckfw/wrap.c", - ] - - configs -= [ - "//build/config/compiler:chromium_code" - ] - - if (is_win) { - configs -= [ - "//build/config/win:unicode", # Requires 8-bit mode. - ] - } - configs += [ "//build/config/compiler:no_chromium_code" ] - - include_dirs = [ "nss/lib/ckfw" ] - direct_dependent_configs = [ ":nssckbi_config" ] - - deps = [ - ":nss_static", - ] - forward_dependent_configs_from = deps - } - - config("nss_static_config") { - defines = [ - "NSS_STATIC", - "NSS_USE_STATIC_LIBS", - "USE_UTIL_DIRECTLY", - ] - if (is_win) { - defines += [ "_WINDOWS" ] - } - include_dirs = [ - "nspr/pr/include", - "nspr/lib/ds", - "nspr/lib/libc/include", - "nss/lib/base", - "nss/lib/certdb", - "nss/lib/certhigh", - "nss/lib/cryptohi", - "nss/lib/dev", - "nss/lib/freebl", - "nss/lib/freebl/ecl", - "nss/lib/nss", - "nss/lib/pk11wrap", - "nss/lib/pkcs7", - "nss/lib/pki", - "nss/lib/smime", - "nss/lib/softoken", - "nss/lib/util", - ] - } - - source_set("nss_static") { - visibility = [ ":*" ] # Internal implementation detail. - - sources = [ - "nss/lib/base/arena.c", - "nss/lib/base/base.h", - "nss/lib/base/baset.h", - "nss/lib/base/error.c", - "nss/lib/base/errorval.c", - "nss/lib/base/hash.c", - "nss/lib/base/hashops.c", - "nss/lib/base/item.c", - "nss/lib/base/libc.c", - "nss/lib/base/list.c", - "nss/lib/base/nssbase.h", - "nss/lib/base/nssbaset.h", - "nss/lib/base/nssutf8.c", - "nss/lib/base/tracker.c", - "nss/lib/certdb/alg1485.c", - "nss/lib/certdb/cert.h", - "nss/lib/certdb/certdb.c", - "nss/lib/certdb/certdb.h", - "nss/lib/certdb/certi.h", - "nss/lib/certdb/certt.h", - "nss/lib/certdb/certv3.c", - "nss/lib/certdb/certxutl.c", - "nss/lib/certdb/certxutl.h", - "nss/lib/certdb/crl.c", - "nss/lib/certdb/genname.c", - "nss/lib/certdb/genname.h", - "nss/lib/certdb/polcyxtn.c", - "nss/lib/certdb/secname.c", - "nss/lib/certdb/stanpcertdb.c", - "nss/lib/certdb/xauthkid.c", - "nss/lib/certdb/xbsconst.c", - "nss/lib/certdb/xconst.c", - "nss/lib/certdb/xconst.h", - "nss/lib/certhigh/certhigh.c", - "nss/lib/certhigh/certhtml.c", - "nss/lib/certhigh/certreq.c", - "nss/lib/certhigh/certvfy.c", - "nss/lib/certhigh/crlv2.c", - "nss/lib/certhigh/ocsp.c", - "nss/lib/certhigh/ocsp.h", - "nss/lib/certhigh/ocspi.h", - "nss/lib/certhigh/ocspsig.c", - "nss/lib/certhigh/ocspt.h", - "nss/lib/certhigh/ocspti.h", - "nss/lib/certhigh/xcrldist.c", - "nss/lib/cryptohi/cryptohi.h", - "nss/lib/cryptohi/cryptoht.h", - "nss/lib/cryptohi/dsautil.c", - "nss/lib/cryptohi/key.h", - "nss/lib/cryptohi/keyhi.h", - "nss/lib/cryptohi/keyi.h", - "nss/lib/cryptohi/keyt.h", - "nss/lib/cryptohi/keythi.h", - "nss/lib/cryptohi/sechash.c", - "nss/lib/cryptohi/sechash.h", - "nss/lib/cryptohi/seckey.c", - "nss/lib/cryptohi/secsign.c", - "nss/lib/cryptohi/secvfy.c", - "nss/lib/dev/ckhelper.c", - "nss/lib/dev/ckhelper.h", - "nss/lib/dev/dev.h", - "nss/lib/dev/devm.h", - "nss/lib/dev/devslot.c", - "nss/lib/dev/devt.h", - "nss/lib/dev/devtm.h", - "nss/lib/dev/devtoken.c", - "nss/lib/dev/devutil.c", - "nss/lib/dev/nssdev.h", - "nss/lib/dev/nssdevt.h", - "nss/lib/freebl/aeskeywrap.c", - "nss/lib/freebl/alg2268.c", - "nss/lib/freebl/alghmac.c", - "nss/lib/freebl/alghmac.h", - "nss/lib/freebl/arcfive.c", - "nss/lib/freebl/arcfour.c", - "nss/lib/freebl/blapi.h", - "nss/lib/freebl/blapii.h", - "nss/lib/freebl/blapit.h", - "nss/lib/freebl/build_config_mac.h", - "nss/lib/freebl/camellia.c", - "nss/lib/freebl/camellia.h", - "nss/lib/freebl/chacha20/chacha20.c", - "nss/lib/freebl/chacha20/chacha20.h", - "nss/lib/freebl/chacha20/chacha20_vec.c", - "nss/lib/freebl/chacha20poly1305.c", - "nss/lib/freebl/chacha20poly1305.h", - "nss/lib/freebl/ctr.c", - "nss/lib/freebl/ctr.h", - "nss/lib/freebl/cts.c", - "nss/lib/freebl/cts.h", - "nss/lib/freebl/des.c", - "nss/lib/freebl/des.h", - "nss/lib/freebl/desblapi.c", - "nss/lib/freebl/dh.c", - "nss/lib/freebl/drbg.c", - "nss/lib/freebl/dsa.c", - "nss/lib/freebl/ec.c", - "nss/lib/freebl/ec.h", - "nss/lib/freebl/ecdecode.c", - "nss/lib/freebl/ecl/ec2.h", - "nss/lib/freebl/ecl/ecl-curve.h", - "nss/lib/freebl/ecl/ecl-exp.h", - "nss/lib/freebl/ecl/ecl-priv.h", - "nss/lib/freebl/ecl/ecl.c", - "nss/lib/freebl/ecl/ecl.h", - "nss/lib/freebl/ecl/ecl_curve.c", - "nss/lib/freebl/ecl/ecl_gf.c", - "nss/lib/freebl/ecl/ecl_mult.c", - "nss/lib/freebl/ecl/ecp.h", - "nss/lib/freebl/ecl/ecp_256.c", - "nss/lib/freebl/ecl/ecp_256_32.c", - "nss/lib/freebl/ecl/ecp_384.c", - "nss/lib/freebl/ecl/ecp_521.c", - "nss/lib/freebl/ecl/ecp_aff.c", - "nss/lib/freebl/ecl/ecp_jac.c", - "nss/lib/freebl/ecl/ecp_jm.c", - "nss/lib/freebl/ecl/ecp_mont.c", - "nss/lib/freebl/ecl/ec_naf.c", - "nss/lib/freebl/gcm.c", - "nss/lib/freebl/gcm.h", - "nss/lib/freebl/hmacct.c", - "nss/lib/freebl/hmacct.h", - "nss/lib/freebl/jpake.c", - "nss/lib/freebl/md2.c", - "nss/lib/freebl/md5.c", - "nss/lib/freebl/mpi/logtab.h", - "nss/lib/freebl/mpi/mpcpucache.c", - "nss/lib/freebl/mpi/mpi-config.h", - "nss/lib/freebl/mpi/mpi-priv.h", - "nss/lib/freebl/mpi/mpi.c", - "nss/lib/freebl/mpi/mpi.h", - "nss/lib/freebl/mpi/mpi_amd64.c", - "nss/lib/freebl/mpi/mpi_arm.c", - "nss/lib/freebl/mpi/mpi_arm_mac.c", - "nss/lib/freebl/mpi/mpi_x86_asm.c", - "nss/lib/freebl/mpi/mplogic.c", - "nss/lib/freebl/mpi/mplogic.h", - "nss/lib/freebl/mpi/mpmontg.c", - "nss/lib/freebl/mpi/mpprime.c", - "nss/lib/freebl/mpi/mpprime.h", - "nss/lib/freebl/mpi/mp_gf2m-priv.h", - "nss/lib/freebl/mpi/mp_gf2m.c", - "nss/lib/freebl/mpi/mp_gf2m.h", - "nss/lib/freebl/mpi/primes.c", - "nss/lib/freebl/poly1305/poly1305-donna-x64-sse2-incremental-source.c", - "nss/lib/freebl/poly1305/poly1305.c", - "nss/lib/freebl/poly1305/poly1305.h", - "nss/lib/freebl/pqg.c", - "nss/lib/freebl/pqg.h", - "nss/lib/freebl/rawhash.c", - "nss/lib/freebl/rijndael.c", - "nss/lib/freebl/rijndael.h", - "nss/lib/freebl/rijndael32.tab", - "nss/lib/freebl/rsa.c", - "nss/lib/freebl/rsapkcs.c", - "nss/lib/freebl/secmpi.h", - "nss/lib/freebl/secrng.h", - "nss/lib/freebl/seed.c", - "nss/lib/freebl/seed.h", - "nss/lib/freebl/sha256.h", - "nss/lib/freebl/sha512.c", - "nss/lib/freebl/sha_fast.c", - "nss/lib/freebl/sha_fast.h", - "nss/lib/freebl/shsign.h", - "nss/lib/freebl/shvfy.c", - "nss/lib/freebl/sysrand.c", - "nss/lib/freebl/tlsprfalg.c", - "nss/lib/freebl/unix_rand.c", - "nss/lib/freebl/win_rand.c", - "nss/lib/nss/nss.h", - "nss/lib/nss/nssinit.c", - "nss/lib/nss/nssrenam.h", - "nss/lib/nss/utilwrap.c", - "nss/lib/pk11wrap/debug_module.c", - "nss/lib/pk11wrap/dev3hack.c", - "nss/lib/pk11wrap/dev3hack.h", - "nss/lib/pk11wrap/pk11akey.c", - "nss/lib/pk11wrap/pk11auth.c", - "nss/lib/pk11wrap/pk11cert.c", - "nss/lib/pk11wrap/pk11cxt.c", - "nss/lib/pk11wrap/pk11err.c", - "nss/lib/pk11wrap/pk11func.h", - "nss/lib/pk11wrap/pk11kea.c", - "nss/lib/pk11wrap/pk11list.c", - "nss/lib/pk11wrap/pk11load.c", - "nss/lib/pk11wrap/pk11mech.c", - "nss/lib/pk11wrap/pk11merge.c", - "nss/lib/pk11wrap/pk11nobj.c", - "nss/lib/pk11wrap/pk11obj.c", - "nss/lib/pk11wrap/pk11pars.c", - "nss/lib/pk11wrap/pk11pbe.c", - "nss/lib/pk11wrap/pk11pk12.c", - "nss/lib/pk11wrap/pk11pqg.c", - "nss/lib/pk11wrap/pk11pqg.h", - "nss/lib/pk11wrap/pk11priv.h", - "nss/lib/pk11wrap/pk11pub.h", - "nss/lib/pk11wrap/pk11sdr.c", - "nss/lib/pk11wrap/pk11sdr.h", - "nss/lib/pk11wrap/pk11skey.c", - "nss/lib/pk11wrap/pk11slot.c", - "nss/lib/pk11wrap/pk11util.c", - "nss/lib/pk11wrap/secmod.h", - "nss/lib/pk11wrap/secmodi.h", - "nss/lib/pk11wrap/secmodt.h", - "nss/lib/pk11wrap/secmodti.h", - "nss/lib/pk11wrap/secpkcs5.h", - "nss/lib/pkcs7/certread.c", - "nss/lib/pkcs7/p7common.c", - "nss/lib/pkcs7/p7create.c", - "nss/lib/pkcs7/p7decode.c", - "nss/lib/pkcs7/p7encode.c", - "nss/lib/pkcs7/p7local.c", - "nss/lib/pkcs7/p7local.h", - "nss/lib/pkcs7/pkcs7t.h", - "nss/lib/pkcs7/secmime.c", - "nss/lib/pkcs7/secmime.h", - "nss/lib/pkcs7/secpkcs7.h", - "nss/lib/pki/asymmkey.c", - "nss/lib/pki/certdecode.c", - "nss/lib/pki/certificate.c", - "nss/lib/pki/cryptocontext.c", - "nss/lib/pki/nsspki.h", - "nss/lib/pki/nsspkit.h", - "nss/lib/pki/pki.h", - "nss/lib/pki/pki3hack.c", - "nss/lib/pki/pki3hack.h", - "nss/lib/pki/pkibase.c", - "nss/lib/pki/pkim.h", - "nss/lib/pki/pkistore.c", - "nss/lib/pki/pkistore.h", - "nss/lib/pki/pkit.h", - "nss/lib/pki/pkitm.h", - "nss/lib/pki/symmkey.c", - "nss/lib/pki/tdcache.c", - "nss/lib/pki/trustdomain.c", - "nss/lib/smime/cms.h", - "nss/lib/smime/cmslocal.h", - "nss/lib/smime/cmsreclist.h", - "nss/lib/smime/cmst.h", - "nss/lib/smime/smime.h", - "nss/lib/softoken/fipsaudt.c", - "nss/lib/softoken/fipstest.c", - "nss/lib/softoken/fipstokn.c", - "nss/lib/softoken/jpakesftk.c", - "nss/lib/softoken/lgglue.c", - "nss/lib/softoken/lgglue.h", - "nss/lib/softoken/lowkey.c", - "nss/lib/softoken/lowkeyi.h", - "nss/lib/softoken/lowkeyti.h", - "nss/lib/softoken/lowpbe.c", - "nss/lib/softoken/lowpbe.h", - "nss/lib/softoken/padbuf.c", - "nss/lib/softoken/pkcs11.c", - "nss/lib/softoken/pkcs11c.c", - "nss/lib/softoken/pkcs11i.h", - "nss/lib/softoken/pkcs11ni.h", - "nss/lib/softoken/pkcs11u.c", - "nss/lib/softoken/sdb.c", - "nss/lib/softoken/sdb.h", - "nss/lib/softoken/sftkdb.c", - "nss/lib/softoken/sftkdb.h", - "nss/lib/softoken/sftkdbt.h", - "nss/lib/softoken/sftkdbti.h", - "nss/lib/softoken/sftkhmac.c", - "nss/lib/softoken/sftkpars.c", - "nss/lib/softoken/sftkpars.h", - "nss/lib/softoken/sftkpwd.c", - "nss/lib/softoken/softkver.c", - "nss/lib/softoken/softkver.h", - "nss/lib/softoken/softoken.h", - "nss/lib/softoken/softoknt.h", - "nss/lib/softoken/tlsprf.c", - "nss/lib/ssl/sslerr.h", - "nss/lib/util/SECerrs.h", - "nss/lib/util/base64.h", - "nss/lib/util/ciferfam.h", - "nss/lib/util/derdec.c", - "nss/lib/util/derenc.c", - "nss/lib/util/dersubr.c", - "nss/lib/util/dertime.c", - "nss/lib/util/errstrs.c", - "nss/lib/util/hasht.h", - "nss/lib/util/nssb64.h", - "nss/lib/util/nssb64d.c", - "nss/lib/util/nssb64e.c", - "nss/lib/util/nssb64t.h", - "nss/lib/util/nssilckt.h", - "nss/lib/util/nssilock.c", - "nss/lib/util/nssilock.h", - "nss/lib/util/nsslocks.h", - "nss/lib/util/nssrwlk.c", - "nss/lib/util/nssrwlk.h", - "nss/lib/util/nssrwlkt.h", - "nss/lib/util/nssutil.h", - "nss/lib/util/oidstring.c", - "nss/lib/util/pkcs11.h", - "nss/lib/util/pkcs11f.h", - "nss/lib/util/pkcs11n.h", - "nss/lib/util/pkcs11p.h", - "nss/lib/util/pkcs11t.h", - "nss/lib/util/pkcs11u.h", - "nss/lib/util/portreg.c", - "nss/lib/util/portreg.h", - "nss/lib/util/quickder.c", - "nss/lib/util/secalgid.c", - "nss/lib/util/secasn1.h", - "nss/lib/util/secasn1d.c", - "nss/lib/util/secasn1e.c", - "nss/lib/util/secasn1t.h", - "nss/lib/util/secasn1u.c", - "nss/lib/util/seccomon.h", - "nss/lib/util/secder.h", - "nss/lib/util/secdert.h", - "nss/lib/util/secdig.c", - "nss/lib/util/secdig.h", - "nss/lib/util/secdigt.h", - "nss/lib/util/secerr.h", - "nss/lib/util/secitem.c", - "nss/lib/util/secitem.h", - "nss/lib/util/secoid.c", - "nss/lib/util/secoid.h", - "nss/lib/util/secoidt.h", - "nss/lib/util/secport.c", - "nss/lib/util/secport.h", - "nss/lib/util/sectime.c", - "nss/lib/util/templates.c", - "nss/lib/util/utf8.c", - "nss/lib/util/utilmod.c", - "nss/lib/util/utilmodt.h", - "nss/lib/util/utilpars.c", - "nss/lib/util/utilpars.h", - "nss/lib/util/utilparst.h", - "nss/lib/util/utilrename.h", - ] - - sources -= [ - # mpi_arm.c is included by mpi_arm_mac.c. - # NOTE: mpi_arm.c can be used directly on Linux. mpi_arm.c will need - # to be excluded conditionally if we start to build NSS on Linux. - "nss/lib/freebl/mpi/mpi_arm.c", - # primes.c is included by mpprime.c. - "nss/lib/freebl/mpi/primes.c", - # unix_rand.c and win_rand.c are included by sysrand.c. - "nss/lib/freebl/unix_rand.c", - "nss/lib/freebl/win_rand.c", - # debug_module.c is included by pk11load.c. - "nss/lib/pk11wrap/debug_module.c", - ] - - configs -= [ - "//build/config/compiler:chromium_code" - ] - if (is_win) { - configs -= [ - "//build/config/win:unicode", # Requires 8-bit mode. - ] - } - configs += [ "//build/config/compiler:no_chromium_code" ] - direct_dependent_configs = [ ":nss_static_config" ] - - cflags = [] - - # Only need the defines and includes not in nss_static_config. - defines = [ - "MP_API_COMPATIBLE", - "NSS_DISABLE_DBM", - "RIJNDAEL_INCLUDE_TABLES", - "SHLIB_VERSION=\"3\"", - "SOFTOKEN_SHLIB_VERSION=\"3\"", - ] - include_dirs = [ - "nss/lib/freebl/mpi", - "nss/lib/ssl", - ] - - if (is_win) { - cflags += [ - "/wd4101", # Unreferenced local variable. - "/wd4267", # Conversion from size_t to "type". - ] - } - - if (include_nss_libpkix) { - sources += [ - "nss/lib/certhigh/certvfypkix.c", - "nss/lib/certhigh/certvfypkixprint.c", - "nss/lib/libpkix/include/pkix.h", - "nss/lib/libpkix/include/pkix_certsel.h", - "nss/lib/libpkix/include/pkix_certstore.h", - "nss/lib/libpkix/include/pkix_checker.h", - "nss/lib/libpkix/include/pkix_crlsel.h", - "nss/lib/libpkix/include/pkix_errorstrings.h", - "nss/lib/libpkix/include/pkix_params.h", - "nss/lib/libpkix/include/pkix_pl_pki.h", - "nss/lib/libpkix/include/pkix_pl_system.h", - "nss/lib/libpkix/include/pkix_results.h", - "nss/lib/libpkix/include/pkix_revchecker.h", - "nss/lib/libpkix/include/pkix_sample_modules.h", - "nss/lib/libpkix/include/pkix_util.h", - "nss/lib/libpkix/include/pkixt.h", - "nss/lib/libpkix/pkix/certsel/pkix_certselector.c", - "nss/lib/libpkix/pkix/certsel/pkix_certselector.h", - "nss/lib/libpkix/pkix/certsel/pkix_comcertselparams.c", - "nss/lib/libpkix/pkix/certsel/pkix_comcertselparams.h", - "nss/lib/libpkix/pkix/checker/pkix_basicconstraintschecker.c", - "nss/lib/libpkix/pkix/checker/pkix_basicconstraintschecker.h", - "nss/lib/libpkix/pkix/checker/pkix_certchainchecker.c", - "nss/lib/libpkix/pkix/checker/pkix_certchainchecker.h", - "nss/lib/libpkix/pkix/checker/pkix_crlchecker.c", - "nss/lib/libpkix/pkix/checker/pkix_crlchecker.h", - "nss/lib/libpkix/pkix/checker/pkix_ekuchecker.c", - "nss/lib/libpkix/pkix/checker/pkix_ekuchecker.h", - "nss/lib/libpkix/pkix/checker/pkix_expirationchecker.c", - "nss/lib/libpkix/pkix/checker/pkix_expirationchecker.h", - "nss/lib/libpkix/pkix/checker/pkix_namechainingchecker.c", - "nss/lib/libpkix/pkix/checker/pkix_namechainingchecker.h", - "nss/lib/libpkix/pkix/checker/pkix_nameconstraintschecker.c", - "nss/lib/libpkix/pkix/checker/pkix_nameconstraintschecker.h", - "nss/lib/libpkix/pkix/checker/pkix_ocspchecker.c", - "nss/lib/libpkix/pkix/checker/pkix_ocspchecker.h", - "nss/lib/libpkix/pkix/checker/pkix_policychecker.c", - "nss/lib/libpkix/pkix/checker/pkix_policychecker.h", - "nss/lib/libpkix/pkix/checker/pkix_revocationchecker.c", - "nss/lib/libpkix/pkix/checker/pkix_revocationchecker.h", - "nss/lib/libpkix/pkix/checker/pkix_revocationmethod.c", - "nss/lib/libpkix/pkix/checker/pkix_revocationmethod.h", - "nss/lib/libpkix/pkix/checker/pkix_signaturechecker.c", - "nss/lib/libpkix/pkix/checker/pkix_signaturechecker.h", - "nss/lib/libpkix/pkix/checker/pkix_targetcertchecker.c", - "nss/lib/libpkix/pkix/checker/pkix_targetcertchecker.h", - "nss/lib/libpkix/pkix/crlsel/pkix_comcrlselparams.c", - "nss/lib/libpkix/pkix/crlsel/pkix_comcrlselparams.h", - "nss/lib/libpkix/pkix/crlsel/pkix_crlselector.c", - "nss/lib/libpkix/pkix/crlsel/pkix_crlselector.h", - "nss/lib/libpkix/pkix/params/pkix_procparams.c", - "nss/lib/libpkix/pkix/params/pkix_procparams.h", - "nss/lib/libpkix/pkix/params/pkix_resourcelimits.c", - "nss/lib/libpkix/pkix/params/pkix_resourcelimits.h", - "nss/lib/libpkix/pkix/params/pkix_trustanchor.c", - "nss/lib/libpkix/pkix/params/pkix_trustanchor.h", - "nss/lib/libpkix/pkix/params/pkix_valparams.c", - "nss/lib/libpkix/pkix/params/pkix_valparams.h", - "nss/lib/libpkix/pkix/results/pkix_buildresult.c", - "nss/lib/libpkix/pkix/results/pkix_buildresult.h", - "nss/lib/libpkix/pkix/results/pkix_policynode.c", - "nss/lib/libpkix/pkix/results/pkix_policynode.h", - "nss/lib/libpkix/pkix/results/pkix_valresult.c", - "nss/lib/libpkix/pkix/results/pkix_valresult.h", - "nss/lib/libpkix/pkix/results/pkix_verifynode.c", - "nss/lib/libpkix/pkix/results/pkix_verifynode.h", - "nss/lib/libpkix/pkix/store/pkix_store.c", - "nss/lib/libpkix/pkix/store/pkix_store.h", - "nss/lib/libpkix/pkix/top/pkix_build.c", - "nss/lib/libpkix/pkix/top/pkix_build.h", - "nss/lib/libpkix/pkix/top/pkix_lifecycle.c", - "nss/lib/libpkix/pkix/top/pkix_lifecycle.h", - "nss/lib/libpkix/pkix/top/pkix_validate.c", - "nss/lib/libpkix/pkix/top/pkix_validate.h", - "nss/lib/libpkix/pkix/util/pkix_error.c", - "nss/lib/libpkix/pkix/util/pkix_error.h", - "nss/lib/libpkix/pkix/util/pkix_errpaths.c", - "nss/lib/libpkix/pkix/util/pkix_list.c", - "nss/lib/libpkix/pkix/util/pkix_list.h", - "nss/lib/libpkix/pkix/util/pkix_logger.c", - "nss/lib/libpkix/pkix/util/pkix_logger.h", - "nss/lib/libpkix/pkix/util/pkix_tools.c", - "nss/lib/libpkix/pkix/util/pkix_tools.h", - "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_aiamgr.c", - "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_aiamgr.h", - "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_colcertstore.c", - "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_colcertstore.h", - "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c", - "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.h", - "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpdefaultclient.c", - "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpdefaultclient.h", - "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_nsscontext.c", - "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_nsscontext.h", - "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_pk11certstore.c", - "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_pk11certstore.h", - "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_socket.c", - "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_socket.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_basicconstraints.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_basicconstraints.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_cert.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_cert.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicyinfo.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicyinfo.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicymap.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicymap.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicyqualifier.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicyqualifier.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crl.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crl.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crldp.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crldp.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crlentry.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crlentry.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_date.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_date.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_generalname.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_generalname.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_infoaccess.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_infoaccess.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_nameconstraints.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_nameconstraints.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocspcertid.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocspcertid.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocsprequest.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocsprequest.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocspresponse.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocspresponse.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_publickey.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_publickey.h", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_x500name.c", - "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_x500name.h", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_bigint.c", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_bigint.h", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_bytearray.c", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_bytearray.h", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_common.c", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_common.h", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_error.c", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_hashtable.c", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_hashtable.h", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_lifecycle.c", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_lifecycle.h", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_mem.c", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_mem.h", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_monitorlock.c", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_monitorlock.h", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_mutex.c", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_mutex.h", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_object.c", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_object.h", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.c", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.h", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_primhash.c", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_primhash.h", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_rwlock.c", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_rwlock.h", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_string.c", - "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_string.h", - ] - - # Disable the LDAP code in libpkix. - defines += [ "NSS_PKIX_NO_LDAP" ] - - include_dirs += [ - "nss/lib/libpkix/include", - "nss/lib/libpkix/pkix/certsel", - "nss/lib/libpkix/pkix/checker", - "nss/lib/libpkix/pkix/crlsel", - "nss/lib/libpkix/pkix/params", - "nss/lib/libpkix/pkix/results", - "nss/lib/libpkix/pkix/store", - "nss/lib/libpkix/pkix/top", - "nss/lib/libpkix/pkix/util", - "nss/lib/libpkix/pkix_pl_nss/module", - "nss/lib/libpkix/pkix_pl_nss/pki", - "nss/lib/libpkix/pkix_pl_nss/system", - ] - } else { - defines += [ "NSS_DISABLE_LIBPKIX" ] - } - - if (!include_nss_root_certs) { - defines += [ "NSS_DISABLE_ROOT_CERTS" ] - } - - if (cpu_arch == "x64" && !is_win) { - sources -= [ - "nss/lib/freebl/chacha20/chacha20.c", - "nss/lib/freebl/poly1305/poly1305.c", - ] - } else { - sources -= [ - "nss/lib/freebl/chacha20/chacha20_vec.c", - "nss/lib/freebl/poly1305/poly1305-donna-x64-sse2-incremental-source.c", - ] - } - - if (is_mac || is_ios) { - sources -= [ - "nss/lib/freebl/mpi/mpi_amd64.c", - ] - cflags += [ - "-include", - rebase_path("//third_party/nss/nss/lib/freebl/build_config_mac.h", - root_build_dir), - ] - defines += [ - "XP_UNIX", - "DARWIN", - "HAVE_STRERROR", - "HAVE_BSD_FLOCK", - "SHLIB_SUFFIX=\"dylib\"", - "SHLIB_PREFIX=\"lib\"", - "SOFTOKEN_LIB_NAME=\"libsoftokn3.dylib\"", - ] - - configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] - } else { - # Not Mac/iOS. - sources -= [ "nss/lib/freebl/mpi/mpi_arm_mac.c" ] - } - - if (is_win) { - defines += [ - "SHLIB_SUFFIX=\"dll\"", - "SHLIB_PREFIX=\"\"", - "SOFTOKEN_LIB_NAME=\"softokn3.dll\"", - "XP_PC", - "WIN32", - "WIN95", - ] - - if (cpu_arch == "x86") { - sources -= [ "nss/lib/freebl/mpi/mpi_amd64.c" ] - defines += [ - "NSS_X86_OR_X64", - "NSS_X86", - "_X86_", - "MP_ASSEMBLY_MULTIPLY", - "MP_ASSEMBLY_SQUARE", - "MP_ASSEMBLY_DIV_2DX1D", - "MP_USE_UINT_DIGIT", - "MP_NO_MP_WORD", - "USE_HW_AES", - "INTEL_GCM", - ] - } else if (cpu_arch == "x64") { - sources -= [ "nss/lib/freebl/mpi/mpi_x86_asm.c" ] - defines += [ - "NSS_USE_64", - "NSS_X86_OR_X64", - "NSS_X64", - "_AMD64_", - "MP_CHAR_STORE_SLOW", - "MP_IS_LITTLE_ENDIAN", - "WIN64", - ] - } - } else { - # Not Windows. - sources -= [ - # mpi_x86_asm.c contains MSVC inline assembly code. - "nss/lib/freebl/mpi/mpi_x86_asm.c", - ] - } - - if (is_clang) { - cflags += [ - # nss doesn"t explicitly cast between different enum types. - "-Wno-conversion", - # nss passes "const char*" through "void*". - "-Wno-incompatible-pointer-types", - # nss prefers `a && b || c` over `(a && b) || c`. - "-Wno-logical-op-parentheses", - # nss doesn"t use exhaustive switches on enums - "-Wno-switch", - # nss has some `unsigned < 0` checks. - "-Wno-tautological-compare", - ] - } - - deps = [ - ":nspr", - "//third_party/sqlite", - ] - - forward_dependent_configs_from = [ ":nspr" ] - } -} # Windows/Mac/iOS. - diff --git a/tools/gn/secondary/third_party/ots/BUILD.gn b/tools/gn/secondary/third_party/ots/BUILD.gn deleted file mode 100644 index 513dce6472..0000000000 --- a/tools/gn/secondary/third_party/ots/BUILD.gn +++ /dev/null @@ -1,90 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -config("ots_config") { - include_dirs = [ "include" ] -} - -source_set("ots") { - sources = [ - "include/ots-memory-stream.h", - "include/opentype-sanitiser.h", - "src/cff.cc", - "src/cff.h", - "src/cff_type2_charstring.cc", - "src/cff_type2_charstring.h", - "src/cmap.cc", - "src/cmap.h", - "src/cvt.cc", - "src/cvt.h", - "src/fpgm.cc", - "src/fpgm.h", - "src/gasp.cc", - "src/gasp.h", - "src/gdef.cc", - "src/gdef.h", - "src/glyf.cc", - "src/glyf.h", - "src/gpos.cc", - "src/gpos.h", - "src/gsub.cc", - "src/gsub.h", - "src/hdmx.cc", - "src/hdmx.h", - "src/head.cc", - "src/head.h", - "src/hhea.cc", - "src/hhea.h", - "src/hmtx.cc", - "src/hmtx.h", - "src/kern.cc", - "src/kern.h", - "src/layout.cc", - "src/layout.h", - "src/loca.cc", - "src/loca.h", - "src/ltsh.cc", - "src/ltsh.h", - "src/maxp.cc", - "src/maxp.h", - "src/math.cc", - "src/math_.h", - "src/metrics.cc", - "src/metrics.h", - "src/name.cc", - "src/name.h", - "src/os2.cc", - "src/os2.h", - "src/ots.cc", - "src/ots.h", - "src/post.cc", - "src/post.h", - "src/prep.cc", - "src/prep.h", - "src/vdmx.cc", - "src/vdmx.h", - "src/vhea.cc", - "src/vhea.h", - "src/vmtx.cc", - "src/vmtx.h", - "src/vorg.cc", - "src/vorg.h", - "src/woff2.cc", - "src/woff2.h", - ] - - direct_dependent_configs = [ ":ots_config" ] - - deps = [ - "//third_party/brotli", - "//third_party/zlib", - ] - - if (is_win) { - cflags = [ - "/wd4267", # Conversion from size_t to 'type'. - "/wd4334", # 32-bit shift implicitly converted to 64-bits. - ] - } -} diff --git a/tools/gn/secondary/third_party/sfntly/BUILD.gn b/tools/gn/secondary/third_party/sfntly/BUILD.gn deleted file mode 100644 index b2972f9f02..0000000000 --- a/tools/gn/secondary/third_party/sfntly/BUILD.gn +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright (c) 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -static_library("sfntly") { - sources = [ - "cpp/src/sfntly/data/byte_array.cc", - "cpp/src/sfntly/data/byte_array.h", - "cpp/src/sfntly/data/font_data.cc", - "cpp/src/sfntly/data/font_data.h", - "cpp/src/sfntly/data/font_input_stream.cc", - "cpp/src/sfntly/data/font_input_stream.h", - "cpp/src/sfntly/data/font_output_stream.cc", - "cpp/src/sfntly/data/font_output_stream.h", - "cpp/src/sfntly/data/growable_memory_byte_array.cc", - "cpp/src/sfntly/data/growable_memory_byte_array.h", - "cpp/src/sfntly/data/memory_byte_array.cc", - "cpp/src/sfntly/data/memory_byte_array.h", - "cpp/src/sfntly/data/readable_font_data.cc", - "cpp/src/sfntly/data/readable_font_data.h", - "cpp/src/sfntly/data/writable_font_data.cc", - "cpp/src/sfntly/data/writable_font_data.h", - "cpp/src/sfntly/font.cc", - "cpp/src/sfntly/font.h", - "cpp/src/sfntly/font_factory.cc", - "cpp/src/sfntly/font_factory.h", - "cpp/src/sfntly/math/fixed1616.h", - "cpp/src/sfntly/math/font_math.h", - "cpp/src/sfntly/port/atomic.h", - "cpp/src/sfntly/port/config.h", - "cpp/src/sfntly/port/endian.h", - "cpp/src/sfntly/port/exception_type.h", - "cpp/src/sfntly/port/file_input_stream.cc", - "cpp/src/sfntly/port/file_input_stream.h", - "cpp/src/sfntly/port/input_stream.h", - "cpp/src/sfntly/port/lock.cc", - "cpp/src/sfntly/port/lock.h", - "cpp/src/sfntly/port/memory_input_stream.cc", - "cpp/src/sfntly/port/memory_input_stream.h", - "cpp/src/sfntly/port/memory_output_stream.cc", - "cpp/src/sfntly/port/memory_output_stream.h", - "cpp/src/sfntly/port/output_stream.h", - "cpp/src/sfntly/port/refcount.h", - "cpp/src/sfntly/port/type.h", - "cpp/src/sfntly/table/bitmap/big_glyph_metrics.cc", - "cpp/src/sfntly/table/bitmap/big_glyph_metrics.h", - "cpp/src/sfntly/table/bitmap/bitmap_glyph.cc", - "cpp/src/sfntly/table/bitmap/bitmap_glyph.h", - "cpp/src/sfntly/table/bitmap/bitmap_glyph_info.cc", - "cpp/src/sfntly/table/bitmap/bitmap_glyph_info.h", - "cpp/src/sfntly/table/bitmap/bitmap_size_table.cc", - "cpp/src/sfntly/table/bitmap/bitmap_size_table.h", - "cpp/src/sfntly/table/bitmap/composite_bitmap_glyph.cc", - "cpp/src/sfntly/table/bitmap/composite_bitmap_glyph.h", - "cpp/src/sfntly/table/bitmap/ebdt_table.cc", - "cpp/src/sfntly/table/bitmap/ebdt_table.h", - "cpp/src/sfntly/table/bitmap/eblc_table.cc", - "cpp/src/sfntly/table/bitmap/eblc_table.h", - "cpp/src/sfntly/table/bitmap/ebsc_table.cc", - "cpp/src/sfntly/table/bitmap/ebsc_table.h", - "cpp/src/sfntly/table/bitmap/glyph_metrics.cc", - "cpp/src/sfntly/table/bitmap/glyph_metrics.h", - "cpp/src/sfntly/table/bitmap/index_sub_table.cc", - "cpp/src/sfntly/table/bitmap/index_sub_table.h", - "cpp/src/sfntly/table/bitmap/index_sub_table_format1.cc", - "cpp/src/sfntly/table/bitmap/index_sub_table_format1.h", - "cpp/src/sfntly/table/bitmap/index_sub_table_format2.cc", - "cpp/src/sfntly/table/bitmap/index_sub_table_format2.h", - "cpp/src/sfntly/table/bitmap/index_sub_table_format3.cc", - "cpp/src/sfntly/table/bitmap/index_sub_table_format3.h", - "cpp/src/sfntly/table/bitmap/index_sub_table_format4.cc", - "cpp/src/sfntly/table/bitmap/index_sub_table_format4.h", - "cpp/src/sfntly/table/bitmap/index_sub_table_format5.cc", - "cpp/src/sfntly/table/bitmap/index_sub_table_format5.h", - "cpp/src/sfntly/table/bitmap/simple_bitmap_glyph.cc", - "cpp/src/sfntly/table/bitmap/simple_bitmap_glyph.h", - "cpp/src/sfntly/table/bitmap/small_glyph_metrics.cc", - "cpp/src/sfntly/table/bitmap/small_glyph_metrics.h", - "cpp/src/sfntly/table/byte_array_table_builder.cc", - "cpp/src/sfntly/table/byte_array_table_builder.h", - "cpp/src/sfntly/table/core/cmap_table.cc", - "cpp/src/sfntly/table/core/cmap_table.h", - "cpp/src/sfntly/table/core/font_header_table.cc", - "cpp/src/sfntly/table/core/font_header_table.h", - "cpp/src/sfntly/table/core/horizontal_device_metrics_table.cc", - "cpp/src/sfntly/table/core/horizontal_device_metrics_table.h", - "cpp/src/sfntly/table/core/horizontal_header_table.cc", - "cpp/src/sfntly/table/core/horizontal_header_table.h", - "cpp/src/sfntly/table/core/horizontal_metrics_table.cc", - "cpp/src/sfntly/table/core/horizontal_metrics_table.h", - "cpp/src/sfntly/table/core/maximum_profile_table.cc", - "cpp/src/sfntly/table/core/maximum_profile_table.h", - "cpp/src/sfntly/table/core/name_table.cc", - "cpp/src/sfntly/table/core/name_table.h", - "cpp/src/sfntly/table/core/os2_table.cc", - "cpp/src/sfntly/table/core/os2_table.h", - "cpp/src/sfntly/table/font_data_table.cc", - "cpp/src/sfntly/table/font_data_table.h", - "cpp/src/sfntly/table/generic_table_builder.cc", - "cpp/src/sfntly/table/generic_table_builder.h", - "cpp/src/sfntly/table/header.cc", - "cpp/src/sfntly/table/header.h", - "cpp/src/sfntly/table/subtable.cc", - "cpp/src/sfntly/table/subtable.h", - "cpp/src/sfntly/table/subtable_container_table.h", - "cpp/src/sfntly/table/table.cc", - "cpp/src/sfntly/table/table.h", - "cpp/src/sfntly/table/table_based_table_builder.cc", - "cpp/src/sfntly/table/table_based_table_builder.h", - "cpp/src/sfntly/table/truetype/glyph_table.cc", - "cpp/src/sfntly/table/truetype/glyph_table.h", - "cpp/src/sfntly/table/truetype/loca_table.cc", - "cpp/src/sfntly/table/truetype/loca_table.h", - "cpp/src/sfntly/tag.cc", - "cpp/src/sfntly/tag.h", - "cpp/src/sample/chromium/font_subsetter.cc", - "cpp/src/sample/chromium/font_subsetter.h", - "cpp/src/sample/chromium/subsetter_impl.cc", - "cpp/src/sample/chromium/subsetter_impl.h", - ] - - defines = [ "SFNTLY_NO_EXCEPTION" ] - include_dirs = [ "cpp/src" ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - - deps = [ "//third_party/icu:icuuc" ] -} diff --git a/tools/gn/secondary/third_party/speex/BUILD.gn b/tools/gn/secondary/third_party/speex/BUILD.gn deleted file mode 100644 index 59d581662c..0000000000 --- a/tools/gn/secondary/third_party/speex/BUILD.gn +++ /dev/null @@ -1,90 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -config("speex_config") { - # Clients expect <speex/speex.h> to be a system header. - include_dirs = [ "include" ] -} - -static_library("speex") { - sources = [ - "libspeex/arch.h", - "libspeex/bits.c", - "libspeex/cb_search.c", - "libspeex/cb_search.h", - "libspeex/exc_10_16_table.c", - "libspeex/exc_10_32_table.c", - "libspeex/exc_20_32_table.c", - "libspeex/exc_5_256_table.c", - "libspeex/exc_5_64_table.c", - "libspeex/exc_8_128_table.c", - "libspeex/filters.c", - "libspeex/filters.h", - "libspeex/gain_table.c", - "libspeex/gain_table_lbr.c", - "libspeex/hexc_10_32_table.c", - "libspeex/hexc_table.c", - "libspeex/high_lsp_tables.c", - "libspeex/lpc.c", - "libspeex/lpc.h", - "libspeex/lsp.c", - "libspeex/lsp.h", - "libspeex/lsp_tables_nb.c", - "libspeex/ltp.c", - "libspeex/ltp.h", - "libspeex/math_approx.h", - "libspeex/modes.c", - "libspeex/modes.h", - "libspeex/modes_wb.c", - "libspeex/nb_celp.c", - "libspeex/nb_celp.h", - "libspeex/os_support.h", - "libspeex/pseudofloat.h", - "libspeex/quant_lsp.c", - "libspeex/quant_lsp.h", - "libspeex/sb_celp.c", - "libspeex/sb_celp.h", - "libspeex/speex.c", - "libspeex/speex_callbacks.c", - "libspeex/speex_header.c", - "libspeex/stack_alloc.h", - "libspeex/stereo.c", - "libspeex/vbr.c", - "libspeex/vbr.h", - "libspeex/vq.c", - "libspeex/vq.h", - "libspeex/window.c", - "include/speex/speex.h", - "include/speex/speex_bits.h", - "include/speex/speex_buffer.h", - "include/speex/speex_callbacks.h", - "include/speex/speex_echo.h", - "include/speex/speex_header.h", - "include/speex/speex_jitter.h", - "include/speex/speex_preprocess.h", - "include/speex/speex_resampler.h", - "include/speex/speex_stereo.h", - "include/speex/speex_types.h", - ] - defines = [ - "FLOATING_POINT", - "EXPORT=", - "USE_ALLOCA", - "inline=__inline", - ] - include_dirs = [ - "libspeex", - ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - direct_dependent_configs = [ ":speex_config" ] - - if (is_win) { - cflags = [ - "/wd4244", # Possible loss of data in conversion. - "/wd4305", # Truncation in conversion. - ] - } -} diff --git a/tools/gn/secondary/third_party/trace-viewer/BUILD.gn b/tools/gn/secondary/third_party/trace-viewer/BUILD.gn deleted file mode 100644 index 9245cbc3b9..0000000000 --- a/tools/gn/secondary/third_party/trace-viewer/BUILD.gn +++ /dev/null @@ -1,320 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -tracing_html_files = [ - "trace_viewer/about_tracing/profiling_view.html", - "trace_viewer/tracing/record_selection_dialog.html", - "trace_viewer/tracing/sampling_summary_side_panel.html", - "trace_viewer/tracing/time_summary_side_panel.html", - "trace_viewer/tracing/input_latency_side_panel.html", - "trace_viewer/tracing/timeline_view.html", - "trace_viewer/tracing/analysis/cpu_slice_view.html", - "trace_viewer/tracing/analysis/thread_time_slice_view.html", - "trace_viewer/tracing/find_control.html", - "third_party/tvcm/src/tvcm/unittest/html_test_results.html", - "third_party/tvcm/src/tvcm/unittest/interactive_test_runner.html", - "third_party/tvcm/src/tvcm/unittest/module_test_case_runner.html", - "third_party/tvcm/src/tvcm/ui/chart_base.html", - "third_party/tvcm/src/tvcm/ui/mouse_mode_selector.html", - "third_party/tvcm/src/tvcm/ui/overlay.html", - "third_party/tvcm/src/tvcm/ui/quad_stack_view.html", - "trace_viewer/cc/picture_debugger.html", -] -tracing_css_files = [ - "trace_viewer/about_tracing/common.css", - "trace_viewer/cc/layer_picker.css", - "trace_viewer/cc/layer_tree_host_impl_view.css", - "trace_viewer/cc/layer_tree_quad_stack_view.css", - "trace_viewer/cc/layer_view.css", - "trace_viewer/cc/picture_debugger.css", - "trace_viewer/cc/picture_ops_chart_summary_view.css", - "trace_viewer/cc/picture_ops_chart_view.css", - "trace_viewer/cc/picture_ops_list_view.css", - "trace_viewer/cc/picture_view.css", - "trace_viewer/cc/raster_task_slice_view.css", - "trace_viewer/gpu/state_view.css", - "trace_viewer/system_stats/system_stats_instance_track.css", - "trace_viewer/system_stats/system_stats_snapshot_view.css", - "trace_viewer/tcmalloc/heap_instance_track.css", - "trace_viewer/tcmalloc/tcmalloc_instance_view.css", - "trace_viewer/tcmalloc/tcmalloc_snapshot_view.css", - "trace_viewer/tracing/analysis/analysis_link.css", - "trace_viewer/tracing/analysis/analysis_results.css", - "trace_viewer/tracing/analysis/analysis_view.css", - "trace_viewer/tracing/analysis/analyze_slices.css", - "trace_viewer/tracing/analysis/default_object_view.css", - "trace_viewer/tracing/analysis/generic_object_view.css", - "trace_viewer/tracing/timeline_track_view.css", - "trace_viewer/tracing/timeline_view.css", - "trace_viewer/tracing/timeline_view_side_panel.css", - "trace_viewer/tracing/tracks/counter_track.css", - "trace_viewer/tracing/tracks/drawing_container.css", - "trace_viewer/tracing/tracks/heading_track.css", - "trace_viewer/tracing/tracks/object_instance_track.css", - "trace_viewer/tracing/tracks/process_track_base.css", - "trace_viewer/tracing/tracks/ruler_track.css", - "trace_viewer/tracing/tracks/slice_track.css", - "trace_viewer/tracing/tracks/spacing_track.css", - "trace_viewer/tracing/tracks/stacked_bars_track.css", - "trace_viewer/tracing/tracks/thread_track.css", - "trace_viewer/tracing/tracks/trace_model_track.css", - "trace_viewer/tracing/tracks/track.css", - "third_party/tvcm/src/tvcm/unittest/common.css", - "third_party/tvcm/src/tvcm/ui/common.css", - "third_party/tvcm/src/tvcm/ui/bar_chart.css", - "third_party/tvcm/src/tvcm/ui/drag_handle.css", - "third_party/tvcm/src/tvcm/ui/info_bar.css", - "third_party/tvcm/src/tvcm/ui/line_chart.css", - "third_party/tvcm/src/tvcm/ui/list_and_associated_view.css", - "third_party/tvcm/src/tvcm/ui/list_view.css", - "third_party/tvcm/src/tvcm/ui/mouse_mode_selector.css", - "third_party/tvcm/src/tvcm/ui/pie_chart.css", - "third_party/tvcm/src/tvcm/ui/quad_stack_view.css", - "third_party/tvcm/src/tvcm/ui/sortable_table.css", - "third_party/tvcm/src/tvcm/ui/sunburst_chart.css", - "third_party/tvcm/src/tvcm/ui/tool_button.css", -] -tracing_js_files = [ - "trace_viewer/about_tracing/__init__.js", - "trace_viewer/about_tracing/features.js", - "trace_viewer/about_tracing/mock_request_handler.js", - "trace_viewer/about_tracing/profiling_view.js", - "trace_viewer/about_tracing/tracing_ui_client.js", - "trace_viewer/cc/__init__.js", - "trace_viewer/cc/constants.js", - "trace_viewer/cc/debug_colors.js", - "trace_viewer/cc/layer_impl.js", - "trace_viewer/cc/layer_picker.js", - "trace_viewer/cc/layer_tree_host_impl.js", - "trace_viewer/cc/layer_tree_host_impl_view.js", - "trace_viewer/cc/layer_tree_impl.js", - "trace_viewer/cc/layer_tree_quad_stack_view.js", - "trace_viewer/cc/layer_view.js", - "trace_viewer/cc/picture.js", - "trace_viewer/cc/picture_as_image_data.js", - "trace_viewer/cc/picture_debugger.js", - "trace_viewer/cc/picture_ops_chart_summary_view.js", - "trace_viewer/cc/picture_ops_chart_view.js", - "trace_viewer/cc/picture_ops_list_view.js", - "trace_viewer/cc/picture_view.js", - "trace_viewer/cc/raster_task_slice_view.js", - "trace_viewer/cc/region.js", - "trace_viewer/cc/render_pass.js", - "trace_viewer/cc/selection.js", - "trace_viewer/cc/tile.js", - "trace_viewer/cc/tile_coverage_rect.js", - "trace_viewer/cc/tile_view.js", - "trace_viewer/cc/util.js", - "trace_viewer/gpu/__init__.js", - "trace_viewer/gpu/state.js", - "trace_viewer/gpu/state_view.js", - "trace_viewer/system_stats/__init__.js", - "trace_viewer/system_stats/system_stats_instance_track.js", - "trace_viewer/system_stats/system_stats_snapshot.js", - "trace_viewer/system_stats/system_stats_snapshot_view.js", - "trace_viewer/tcmalloc/__init__.js", - "trace_viewer/tcmalloc/heap.js", - "trace_viewer/tcmalloc/heap_instance_track.js", - "trace_viewer/tcmalloc/tcmalloc_instance_view.js", - "trace_viewer/tcmalloc/tcmalloc_snapshot_view.js", - "trace_viewer/tracing/analysis/analysis_link.js", - "trace_viewer/tracing/analysis/analysis_results.js", - "trace_viewer/tracing/analysis/analysis_view.js", - "trace_viewer/tracing/analysis/analyze_counters.js", - "trace_viewer/tracing/analysis/analyze_selection.js", - "trace_viewer/tracing/analysis/analyze_slices.js", - "trace_viewer/tracing/analysis/cpu_slice_view.js", - "trace_viewer/tracing/analysis/default_object_view.js", - "trace_viewer/tracing/analysis/generic_object_view.js", - "trace_viewer/tracing/analysis/object_instance_view.js", - "trace_viewer/tracing/analysis/object_snapshot_view.js", - "trace_viewer/tracing/analysis/slice_view.js", - "trace_viewer/tracing/analysis/stub_analysis_results.js", - "trace_viewer/tracing/analysis/stub_analysis_table.js", - "trace_viewer/tracing/analysis/thread_time_slice_view.js", - "trace_viewer/tracing/analysis/util.js", - "trace_viewer/tracing/color_scheme.js", - "trace_viewer/tracing/constants.js", - "trace_viewer/tracing/draw_helpers.js", - "trace_viewer/tracing/elided_cache.js", - "trace_viewer/tracing/fast_rect_renderer.js", - "trace_viewer/tracing/filter.js", - "trace_viewer/tracing/find_control.js", - "trace_viewer/tracing/importer/__init__.js", - "trace_viewer/tracing/importer/gzip_importer.js", - "trace_viewer/tracing/importer/importer.js", - "trace_viewer/tracing/importer/simple_line_reader.js", - "trace_viewer/tracing/importer/linux_perf/android_parser.js", - "trace_viewer/tracing/importer/linux_perf/bus_parser.js", - "trace_viewer/tracing/importer/linux_perf/clock_parser.js", - "trace_viewer/tracing/importer/linux_perf/cpufreq_parser.js", - "trace_viewer/tracing/importer/linux_perf/disk_parser.js", - "trace_viewer/tracing/importer/linux_perf/drm_parser.js", - "trace_viewer/tracing/importer/linux_perf/exynos_parser.js", - "trace_viewer/tracing/importer/linux_perf/gesture_parser.js", - "trace_viewer/tracing/importer/linux_perf/i915_parser.js", - "trace_viewer/tracing/importer/linux_perf/kfunc_parser.js", - "trace_viewer/tracing/importer/linux_perf/mali_parser.js", - "trace_viewer/tracing/importer/linux_perf/parser.js", - "trace_viewer/tracing/importer/linux_perf/power_parser.js", - "trace_viewer/tracing/importer/linux_perf/sched_parser.js", - "trace_viewer/tracing/importer/linux_perf/sync_parser.js", - "trace_viewer/tracing/importer/linux_perf/workqueue_parser.js", - "trace_viewer/tracing/importer/linux_perf_importer.js", - "trace_viewer/tracing/importer/task.js", - "trace_viewer/tracing/importer/timeline_stream_importer.js", - "trace_viewer/tracing/importer/trace2html_importer.js", - "trace_viewer/tracing/importer/trace_event_importer.js", - "trace_viewer/tracing/importer/etw/parser.js", - "trace_viewer/tracing/importer/etw/eventtrace_parser.js", - "trace_viewer/tracing/importer/etw/process_parser.js", - "trace_viewer/tracing/importer/etw/thread_parser.js", - "trace_viewer/tracing/importer/etw_importer.js", - "trace_viewer/tracing/importer/v8/codemap.js", - "trace_viewer/tracing/importer/v8/log_reader.js", - "trace_viewer/tracing/importer/v8/splaytree.js", - "trace_viewer/tracing/importer/v8_log_importer.js", - "trace_viewer/tracing/importer/zip_importer.js", - "trace_viewer/tracing/record_selection_dialog.js", - "trace_viewer/tracing/sampling_summary_side_panel.js", - "trace_viewer/tracing/selection.js", - "trace_viewer/tracing/standalone_timeline_view.js", - "trace_viewer/tracing/test_utils.js", - "trace_viewer/tracing/time_summary_side_panel.js", - "trace_viewer/tracing/input_latency_side_panel.js", - "trace_viewer/tracing/timeline_display_transform.js", - "trace_viewer/tracing/timeline_display_transform_animations.js", - "trace_viewer/tracing/timeline_interest_range.js", - "trace_viewer/tracing/timeline_track_view.js", - "trace_viewer/tracing/timeline_view.js", - "trace_viewer/tracing/timeline_view_side_panel.js", - "trace_viewer/tracing/timeline_viewport.js", - "trace_viewer/tracing/timing_tool.js", - "trace_viewer/tracing/trace_model.js", - "trace_viewer/tracing/trace_model/async_slice.js", - "trace_viewer/tracing/trace_model/async_slice_group.js", - "trace_viewer/tracing/trace_model/counter.js", - "trace_viewer/tracing/trace_model/counter_sample.js", - "trace_viewer/tracing/trace_model/counter_series.js", - "trace_viewer/tracing/trace_model/cpu.js", - "trace_viewer/tracing/trace_model/event.js", - "trace_viewer/tracing/trace_model/flow_event.js", - "trace_viewer/tracing/trace_model/instant_event.js", - "trace_viewer/tracing/trace_model/kernel.js", - "trace_viewer/tracing/trace_model/object_collection.js", - "trace_viewer/tracing/trace_model/object_instance.js", - "trace_viewer/tracing/trace_model/object_snapshot.js", - "trace_viewer/tracing/trace_model/process.js", - "trace_viewer/tracing/trace_model/process_base.js", - "trace_viewer/tracing/trace_model/sample.js", - "trace_viewer/tracing/trace_model/stack_frame.js", - "trace_viewer/tracing/trace_model/slice.js", - "trace_viewer/tracing/trace_model/slice_group.js", - "trace_viewer/tracing/trace_model/thread.js", - "trace_viewer/tracing/trace_model/time_to_object_instance_map.js", - "trace_viewer/tracing/trace_model/timed_event.js", - "trace_viewer/tracing/trace_model_settings.js", - "trace_viewer/tracing/tracks/async_slice_group_track.js", - "trace_viewer/tracing/tracks/container_track.js", - "trace_viewer/tracing/tracks/counter_track.js", - "trace_viewer/tracing/tracks/cpu_track.js", - "trace_viewer/tracing/tracks/drawing_container.js", - "trace_viewer/tracing/tracks/heading_track.js", - "trace_viewer/tracing/tracks/kernel_track.js", - "trace_viewer/tracing/tracks/object_instance_track.js", - "trace_viewer/tracing/tracks/process_track.js", - "trace_viewer/tracing/tracks/process_track_base.js", - "trace_viewer/tracing/tracks/ruler_track.js", - "trace_viewer/tracing/tracks/slice_group_track.js", - "trace_viewer/tracing/tracks/slice_track.js", - "trace_viewer/tracing/tracks/spacing_track.js", - "trace_viewer/tracing/tracks/stacked_bars_track.js", - "trace_viewer/tracing/tracks/thread_track.js", - "trace_viewer/tracing/tracks/trace_model_track.js", - "trace_viewer/tracing/tracks/track.js", - "third_party/tvcm/src/tvcm/__init__.js", - "third_party/tvcm/src/tvcm/base64.js", - "third_party/tvcm/src/tvcm/bbox2.js", - "third_party/tvcm/src/tvcm/color.js", - "third_party/tvcm/src/tvcm/event_target.js", - "third_party/tvcm/src/tvcm/events.js", - "third_party/tvcm/src/tvcm/gl_matrix.js", - "third_party/tvcm/src/tvcm/guid.js", - "third_party/tvcm/src/tvcm/interval_tree.js", - "third_party/tvcm/src/tvcm/iteration_helpers.js", - "third_party/tvcm/src/tvcm/key_event_manager.js", - "third_party/tvcm/src/tvcm/measuring_stick.js", - "third_party/tvcm/src/tvcm/polymer.js", - "third_party/tvcm/src/tvcm/promise.js", - "third_party/tvcm/src/tvcm/properties.js", - "third_party/tvcm/src/tvcm/quad.js", - "third_party/tvcm/src/tvcm/raf.js", - "third_party/tvcm/src/tvcm/range.js", - "third_party/tvcm/src/tvcm/rect.js", - "third_party/tvcm/src/tvcm/settings.js", - "third_party/tvcm/src/tvcm/sorted_array_utils.js", - "third_party/tvcm/src/tvcm/statistics.js", - "third_party/tvcm/src/tvcm/unittest/__init__.js", - "third_party/tvcm/src/tvcm/unittest/assertions.js", - "third_party/tvcm/src/tvcm/unittest/constants.js", - "third_party/tvcm/src/tvcm/unittest/html_test_results.js", - "third_party/tvcm/src/tvcm/unittest/interactive_test_runner.js", - "third_party/tvcm/src/tvcm/unittest/suite_loader.js", - "third_party/tvcm/src/tvcm/unittest/test_case.js", - "third_party/tvcm/src/tvcm/unittest/test_error.js", - "third_party/tvcm/src/tvcm/unittest/test_runner.js", - "third_party/tvcm/src/tvcm/unittest/test_suite.js", - "third_party/tvcm/src/tvcm/unittest/text_test_results.js", - "third_party/tvcm/src/tvcm/utils.js", - "third_party/tvcm/src/tvcm/ui/__init__.js", - "third_party/tvcm/src/tvcm/ui/animation.js", - "third_party/tvcm/src/tvcm/ui/animation_controller.js", - "third_party/tvcm/src/tvcm/ui/bar_chart.js", - "third_party/tvcm/src/tvcm/ui/camera.js", - "third_party/tvcm/src/tvcm/ui/chart_base.js", - "third_party/tvcm/src/tvcm/ui/color_scheme.js", - "third_party/tvcm/src/tvcm/ui/container_that_decorates_its_children.js", - "third_party/tvcm/src/tvcm/ui/d3.js", - "third_party/tvcm/src/tvcm/ui/dom_helpers.js", - "third_party/tvcm/src/tvcm/ui/drag_handle.js", - "third_party/tvcm/src/tvcm/ui/info_bar.js", - "third_party/tvcm/src/tvcm/ui/line_chart.js", - "third_party/tvcm/src/tvcm/ui/list_and_associated_view.js", - "third_party/tvcm/src/tvcm/ui/list_view.js", - "third_party/tvcm/src/tvcm/ui/mouse_mode_selector.js", - "third_party/tvcm/src/tvcm/ui/mouse_tracker.js", - "third_party/tvcm/src/tvcm/ui/overlay.js", - "third_party/tvcm/src/tvcm/ui/pie_chart.js", - "third_party/tvcm/src/tvcm/ui/quad_stack_view.js", - "third_party/tvcm/src/tvcm/ui/sortable_table.js", - "third_party/tvcm/src/tvcm/ui/sunburst_chart.js", -] -tracing_img_files = [ - "trace_viewer/images/checkerboard.png", - "trace_viewer/images/collapse.png", - "trace_viewer/images/expand.png", - "third_party/tvcm/src/tvcm/images/chrome-left.png", - "third_party/tvcm/src/tvcm/images/chrome-right.png", - "third_party/tvcm/src/tvcm/images/chrome-mid.png", - "third_party/tvcm/src/tvcm/images/ui-states.png", -] - -# TODO: ideally this would go into the target_gen_dir, but this requires some -# changes to the scripts that process them. -output_resource_dir = "$root_gen_dir/content/browser/tracing" - -action("generate_about_tracing") { - script = "trace_viewer/build/generate_about_tracing_contents" - - source_prereqs = tracing_html_files + tracing_css_files + tracing_js_files + - tracing_img_files - outputs = [ - "$output_resource_dir/about_tracing.js", - "$output_resource_dir/about_tracing.html", - ] - - args = [ - "--outdir", rebase_path(output_resource_dir, root_build_dir), - ] -} diff --git a/tools/gn/secondary/tools/grit/grit_rule.gni b/tools/gn/secondary/tools/grit/grit_rule.gni deleted file mode 100644 index 6dc0a4b455..0000000000 --- a/tools/gn/secondary/tools/grit/grit_rule.gni +++ /dev/null @@ -1,153 +0,0 @@ -# Copyright (c) 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Instantiate grit. This will produce a script target to run grit, and a -# static library that compiles the .cc files. -# -# Parameters -# -# source -# Path to .grd file. -# -# grit_flags (optional) -# List of strings containing extra command-line flags to pass to Grit. -# -# deps (optional) -# visibility (optional) -# Normal meaning. -# -# Example -# -# grit("my_resources") { -# source = "myfile.grd" # source is required. -# grit_flags = [ "-E", "foo=bar" ] # Optional extra flags. -# # You can also put deps here if the grit source depends on generated -# # files. -# } -import ("//build/config/features.gni") -import ("//build/config/ui.gni") - -grit_defines = [] - -if (is_chromeos) { - grit_defines += [ - "-D", "chromeos", - "-D", "scale_factors=2x" - ] -} - -if (is_desktop_linux) { - grit_defines += [ "-D", "desktop_linux" ] -} - -if (is_android) { - grit_defines += [ - "-t", "android", - "-E", "ANDROID_JAVA_TAGGED_ONLY=true", - ] -} - -if (enable_extensions) { - grit_defines += [ "-D", "enable_extensions" ] -} -if (enable_plugins) { - grit_defines += [ "-D", "enable_plugins" ] -} - -# TODO(GYP) the rest of the grit_defines from the gyp build. - -grit_resource_id_file = "//tools/gritsettings/resource_ids" -grit_info_script = "//tools/grit/grit_info.py" - -template("grit") { - assert(defined(invoker.source), - "\"source\" must be defined for the grit template $target_name") - assert(!defined(invoker.sources) && !defined(invoker.outputs), - "Neither \"sources\" nor \"outputs\" can be defined for the grit " + - "template $target_name") - - # These are all passed as arguments to the script so have to be relative to - # the build directory. - resource_ids = - rebase_path(grit_resource_id_file, root_build_dir) - output_dir = rebase_path(target_gen_dir, root_build_dir) - source_path = rebase_path(invoker.source, root_build_dir) - - if (defined(invoker.grit_flags)) { - grit_flags = invoker.grit_flags - } else { - grit_flags = [] # These are optional so default to empty list. - } - - grit_inputs_build_rel = exec_script(grit_info_script, - [ "--inputs", source_path, "-f", resource_ids] + grit_flags, "list lines") - # The inputs are relative to the current (build) directory, rebase to - # the current one. - grit_inputs = rebase_path(grit_inputs_build_rel, ".", root_build_dir) + [ - grit_resource_id_file, - ] - - grit_outputs_build_rel = exec_script(grit_info_script, - [ "--outputs", "$output_dir", source_path, "-f", resource_ids ] + - grit_flags, - "list lines") - - # The inputs are relative to the current (build) directory, rebase to - # the current one. - grit_outputs = rebase_path(grit_outputs_build_rel, ".", root_build_dir) - - # The config and the action below get this visibility son only the generated - # source set can depend on them. The variable "target_name" will get - # overwritten inside the innter classes so we need to compute it here. - target_visibility = ":$target_name" - - # The current grit setup makes an file in $target_gen_dir/grit/foo.h that - # the source code expects to include via "grit/foo.h". It would be nice to - # change this to including absolute paths relative to the root gen directory - # (like "mycomponent/foo.h"). This config sets up the include path. - grit_config = target_name + "_grit_config" - config(grit_config) { - include_dirs = [ target_gen_dir ] - visibility = target_visibility - } - - grit_custom_target = target_name + "_grit" - action(grit_custom_target) { - script = "//tools/grit/grit.py" - source_prereqs = grit_inputs - outputs = grit_outputs - - args = [ - "-i", source_path, "build", - "-f", resource_ids, - "-o", output_dir, - ] + grit_defines + grit_flags - - visibility = target_visibility - - if (defined(invoker.deps)) { - deps = invoker.deps - } - } - - # This is the thing that people actually link with, it must be named the - # same as the argument the template was invoked with. - source_set(target_name) { - # Since we generate a file, we need to be run before the targets that - # depend on us. - sources = grit_outputs - - # Deps set on the template invocation will go on the grit script running - # target rather than this library. - deps = [ ":$grit_custom_target" ] - direct_dependent_configs = [ ":$grit_config" ] - - if (defined(invoker.visibility)) { - visibility = invoker.visibility - } - if (defined(invoker.output_name)) { - output_name = invoker.output_name - } - } -} diff --git a/tools/gn/secondary/ui/BUILD.gn b/tools/gn/secondary/ui/BUILD.gn deleted file mode 100644 index 4a7595faed..0000000000 --- a/tools/gn/secondary/ui/BUILD.gn +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -component("ui") { - # TODO(brettw) do this target, this current stuff is only to make Chrome - # link. - - configs += "//build/config/linux:x11" - } -} diff --git a/tools/idl_parser/idl_lexer.py b/tools/idl_parser/idl_lexer.py index d7311df1ca..9c320d6e3c 100755 --- a/tools/idl_parser/idl_lexer.py +++ b/tools/idl_parser/idl_lexer.py @@ -67,6 +67,7 @@ class IDLLexer(object): 'attribute' : 'ATTRIBUTE', 'boolean' : 'BOOLEAN', 'byte' : 'BYTE', + 'ByteString' : 'BYTESTRING', 'callback' : 'CALLBACK', 'const' : 'CONST', 'creator' : 'CREATOR', @@ -94,7 +95,9 @@ class IDLLexer(object): 'or' : 'OR', 'partial' : 'PARTIAL', 'readonly' : 'READONLY', + 'RegExp' : 'REGEXP', 'sequence' : 'SEQUENCE', + 'serializer' : 'SERIALIZER', 'setter': 'SETTER', 'short' : 'SHORT', 'static' : 'STATIC', diff --git a/tools/idl_parser/idl_node.py b/tools/idl_parser/idl_node.py index 83aefa52ad..e50fc4e1ba 100755 --- a/tools/idl_parser/idl_node.py +++ b/tools/idl_parser/idl_node.py @@ -201,7 +201,7 @@ class IDLNode(object): child._parent = self self._children.append(child) continue - raise RuntimeError('Adding child of type .\n' % type(child).__name__) + raise RuntimeError('Adding child of type %s.\n' % type(child).__name__) # diff --git a/tools/idl_parser/idl_parser.py b/tools/idl_parser/idl_parser.py index 401dc4b320..fabe2daa00 100755 --- a/tools/idl_parser/idl_parser.py +++ b/tools/idl_parser/idl_parser.py @@ -12,7 +12,7 @@ # on WebIDL. # # WebIDL, and WebIDL grammar can be found at: -# http://dev.w3.org/2006/webapi/WebIDL/ +# http://heycam.github.io/webidl/ # PLY can be found at: # http://www.dabeaz.com/ply/ # @@ -144,7 +144,7 @@ def TokenTypeName(t): # http://www.dabeaz.com/ply/ # # The parser is based on the WebIDL standard. See: -# http://www.w3.org/TR/WebIDL/#idl-grammar +# http://heycam.github.io/webidl/#idl-grammar # # The various productions are annotated so that the WHOLE number greater than # zero in the comment denotes the matching WebIDL grammar definition. @@ -183,7 +183,7 @@ class IDLParser(object): # #The parser is based on the WebIDL standard. See: -# http://www.w3.org/TR/WebIDL/#idl-grammar +# http://heycam.github.io/webidl/#idl-grammar # # [1] def p_Definitions(self, p): @@ -193,7 +193,7 @@ class IDLParser(object): p[2].AddChildren(p[1]) p[0] = ListFromConcat(p[2], p[3]) - # [2] Add INLINE definition + # [2] def p_Definition(self, p): """Definition : CallbackOrInterface | Partial @@ -229,13 +229,13 @@ class IDLParser(object): """Interface : INTERFACE identifier Inheritance '{' InterfaceMembers '}' ';'""" p[0] = self.BuildNamed('Interface', p, 2, ListFromConcat(p[3], p[5])) - # [6] Error recovery for PARTIAL + # [6] def p_Partial(self, p): """Partial : PARTIAL PartialDefinition""" p[2].AddChildren(self.BuildTrue('Partial')) p[0] = p[2] - # [6.1] Error recovery for Enums + # [6.1] Error recovery for Partial def p_PartialError(self, p): """Partial : PARTIAL error""" p[0] = self.BuildError(p, 'Partial') @@ -262,7 +262,7 @@ class IDLParser(object): # [10] def p_InterfaceMember(self, p): """InterfaceMember : Const - | AttributeOrOperation""" + | AttributeOrOperationOrIterator""" p[0] = p[1] # [11] @@ -353,47 +353,54 @@ class IDLParser(object): # [21] def p_EnumValueList(self, p): - """EnumValueList : ExtendedAttributeList string EnumValues""" + """EnumValueList : ExtendedAttributeList string EnumValueListComma""" enum = self.BuildNamed('EnumItem', p, 2, p[1]) p[0] = ListFromConcat(enum, p[3]) # [22] - def p_EnumValues(self, p): - """EnumValues : ',' ExtendedAttributeList string EnumValues - |""" + def p_EnumValueListComma(self, p): + """EnumValueListComma : ',' EnumValueListString + |""" if len(p) > 1: - enum = self.BuildNamed('EnumItem', p, 3, p[2]) - p[0] = ListFromConcat(enum, p[4]) + p[0] = p[2] # [23] + def p_EnumValueListString(self, p): + """EnumValueListString : ExtendedAttributeList string EnumValueListComma + |""" + if len(p) > 1: + enum = self.BuildNamed('EnumItem', p, 2, p[1]) + p[0] = ListFromConcat(enum, p[3]) + + # [24] def p_CallbackRest(self, p): """CallbackRest : identifier '=' ReturnType '(' ArgumentList ')' ';'""" arguments = self.BuildProduction('Arguments', p, 4, p[5]) p[0] = self.BuildNamed('Callback', p, 1, ListFromConcat(p[3], arguments)) - # [24] + # [25] def p_Typedef(self, p): """Typedef : TYPEDEF ExtendedAttributeListNoComments Type identifier ';'""" p[0] = self.BuildNamed('Typedef', p, 4, ListFromConcat(p[2], p[3])) - # [24.1] Error recovery for Typedefs + # [25.1] Error recovery for Typedefs def p_TypedefError(self, p): """Typedef : TYPEDEF error ';'""" p[0] = self.BuildError(p, 'Typedef') - # [25] + # [26] def p_ImplementsStatement(self, p): """ImplementsStatement : identifier IMPLEMENTS identifier ';'""" name = self.BuildAttribute('REFERENCE', p[3]) p[0] = self.BuildNamed('Implements', p, 1, name) - # [26] + # [27] def p_Const(self, p): """Const : CONST ConstType identifier '=' ConstValue ';'""" value = self.BuildProduction('Value', p, 5, p[5]) p[0] = self.BuildNamed('Const', p, 3, ListFromConcat(p[2], value)) - # [27] + # [28] def p_ConstValue(self, p): """ConstValue : BooleanLiteral | FloatLiteral @@ -405,20 +412,20 @@ class IDLParser(object): else: p[0] = p[1] - # [27.1] Add definition for NULL + # [28.1] Add definition for NULL def p_null(self, p): """null : NULL""" p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'NULL'), self.BuildAttribute('NAME', 'NULL')) - # [28] + # [29] def p_BooleanLiteral(self, p): """BooleanLiteral : TRUE | FALSE""" value = self.BuildAttribute('VALUE', Boolean(p[1] == 'true')) p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'boolean'), value) - # [29] + # [30] def p_FloatLiteral(self, p): """FloatLiteral : float | '-' INFINITY @@ -431,77 +438,82 @@ class IDLParser(object): p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'float'), self.BuildAttribute('VALUE', val)) - # [30] - def p_AttributeOrOperation(self, p): - """AttributeOrOperation : STRINGIFIER StringifierAttributeOrOperation - | StaticAttribute - | Attribute - | Operation""" - if len(p) > 2: - p[0] = p[2] - else: - p[0] = p[1] + # [31] Removed unsupported: Serializer, Stringifier + def p_AttributeOrOperationOrIterator(self, p): + """AttributeOrOperationOrIterator : StaticMember + | Attribute + | OperationOrIterator""" + p[0] = p[1] - # [31] - def p_StringifierAttributeOrOperation(self, p): - """StringifierAttributeOrOperation : Attribute - | OperationRest - | ';'""" - if p[1] == ';': - p[0] = self.BuildAttribute('STRINGIFIER', Boolean(True)) - else: - p[0] = ListFromConcat(self.BuildAttribute('STRINGIFIER', p[1]), p[1]) + # [32-37] NOT IMPLEMENTED (Serializer) + # [38-39] FIXME: NOT IMPLEMENTED (Stringifier) http://crbug.com/306606 - # [31.1] FIXME: temporary production as part of moving |static| into - # base parser - def p_StaticAttribute(self, p): - """StaticAttribute : STATIC Attribute""" + # [40] + def p_StaticMember(self, p): + """StaticMember : STATIC StaticMemberRest""" p[2].AddChildren(self.BuildTrue('STATIC')) p[0] = p[2] - # [32] + # [41] + def p_StaticMemberRest(self, p): + """StaticMemberRest : AttributeRest + | ReturnType OperationRest""" + if len(p) == 2: + p[0] = p[1] + else: + p[2].AddChildren(p[1]) + p[0] = p[2] + + # [42] def p_Attribute(self, p): - """Attribute : Inherit ReadOnly ATTRIBUTE Type identifier ';'""" - p[0] = self.BuildNamed('Attribute', p, 5, - ListFromConcat(p[1], p[2], p[4])) + """Attribute : Inherit AttributeRest""" + p[2].AddChildren(ListFromConcat(p[1])) + p[0] = p[2] - # [33] + # [43] + def p_AttributeRest(self, p): + """AttributeRest : ReadOnly ATTRIBUTE Type identifier ';'""" + p[0] = self.BuildNamed('Attribute', p, 4, + ListFromConcat(p[1], p[3])) + + # [44] def p_Inherit(self, p): """Inherit : INHERIT |""" if len(p) > 1: p[0] = self.BuildTrue('INHERIT') - # [34] + # [45] def p_ReadOnly(self, p): """ReadOnly : READONLY - |""" + |""" if len(p) > 1: p[0] = self.BuildTrue('READONLY') - # [35] - def p_Operation(self, p): - """Operation : Qualifiers OperationRest""" - p[2].AddChildren(p[1]) - p[0] = p[2] - - # [36] - def p_Qualifiers(self, p): - """Qualifiers : STATIC - | Specials""" - if p[1] == 'static': - p[0] = self.BuildTrue('STATIC') + # [46] + def p_OperationOrIterator(self, p): + """OperationOrIterator : ReturnType OperationOrIteratorRest + | SpecialOperation""" + if len(p) == 3: + p[2].AddChildren(p[1]) + p[0] = p[2] else: p[0] = p[1] - # [37] + # [47] + def p_SpecialOperation(self, p): + """SpecialOperation : Special Specials ReturnType OperationRest""" + p[4].AddChildren(ListFromConcat(p[1], p[2], p[3])) + p[0] = p[4] + + # [48] def p_Specials(self, p): """Specials : Special Specials | """ if len(p) > 1: p[0] = ListFromConcat(p[1], p[2]) - # [38] + # [49] def p_Special(self, p): """Special : GETTER | SETTER @@ -510,14 +522,20 @@ class IDLParser(object): | LEGACYCALLER""" p[0] = self.BuildTrue(p[1].upper()) + # [50] Removed unsupported: IteratorRest + def p_OperationOrIteratorRest(self, p): + """OperationOrIteratorRest : OperationRest""" + p[0] = p[1] + + # [51-53] NOT IMPLEMENTED (IteratorRest) - # [39] + # [54] def p_OperationRest(self, p): - """OperationRest : ReturnType OptionalIdentifier '(' ArgumentList ')' ';'""" - arguments = self.BuildProduction('Arguments', p, 3, p[4]) - p[0] = self.BuildNamed('Operation', p, 2, ListFromConcat(p[1], arguments)) + """OperationRest : OptionalIdentifier '(' ArgumentList ')' ';'""" + arguments = self.BuildProduction('Arguments', p, 2, p[3]) + p[0] = self.BuildNamed('Operation', p, 1, arguments) - # [40] + # [55] def p_OptionalIdentifier(self, p): """OptionalIdentifier : identifier |""" @@ -526,33 +544,32 @@ class IDLParser(object): else: p[0] = '_unnamed_' - # [41] + # [56] def p_ArgumentList(self, p): """ArgumentList : Argument Arguments |""" if len(p) > 1: p[0] = ListFromConcat(p[1], p[2]) - # [41.1] ArgumentList error recovery + # [56.1] ArgumentList error recovery def p_ArgumentListError(self, p): """ArgumentList : error """ p[0] = self.BuildError(p, 'ArgumentList') - # [42] + # [57] def p_Arguments(self, p): """Arguments : ',' Argument Arguments |""" if len(p) > 1: p[0] = ListFromConcat(p[2], p[3]) - # [43] + # [58] def p_Argument(self, p): """Argument : ExtendedAttributeList OptionalOrRequiredArgument""" p[2].AddChildren(p[1]) p[0] = p[2] - - # [44] + # [59] def p_OptionalOrRequiredArgument(self, p): """OptionalOrRequiredArgument : OPTIONAL Type ArgumentName Default | Type Ellipsis ArgumentName""" @@ -563,13 +580,13 @@ class IDLParser(object): arg = self.BuildNamed('Argument', p, 3, ListFromConcat(p[1], p[2])) p[0] = arg - # [45] + # [60] def p_ArgumentName(self, p): """ArgumentName : ArgumentNameKeyword | identifier""" p[0] = p[1] - # [46] + # [61] def p_Ellipsis(self, p): """Ellipsis : ELLIPSIS |""" @@ -577,23 +594,23 @@ class IDLParser(object): p[0] = self.BuildNamed('Argument', p, 1) p[0].AddChildren(self.BuildTrue('ELLIPSIS')) - # [47] + # [62] def p_ExceptionMember(self, p): """ExceptionMember : Const | ExceptionField""" p[0] = p[1] - # [48] + # [63] def p_ExceptionField(self, p): """ExceptionField : Type identifier ';'""" p[0] = self.BuildNamed('ExceptionField', p, 2, p[1]) - # [48.1] Error recovery for ExceptionMembers + # [63.1] Error recovery for ExceptionMembers def p_ExceptionFieldError(self, p): """ExceptionField : error""" p[0] = self.BuildError(p, 'ExceptionField') - # [49] No comment version for mid statement attributes. + # [64] No comment version for mid statement attributes. def p_ExtendedAttributeListNoComments(self, p): """ExtendedAttributeListNoComments : '[' ExtendedAttribute ExtendedAttributes ']' | """ @@ -601,7 +618,7 @@ class IDLParser(object): items = ListFromConcat(p[2], p[3]) p[0] = self.BuildProduction('ExtAttributes', p, 1, items) - # [49.1] Add optional comment field for start of statements. + # [64.1] Add optional comment field for start of statements. def p_ExtendedAttributeList(self, p): """ExtendedAttributeList : Comments '[' ExtendedAttribute ExtendedAttributes ']' | Comments """ @@ -612,7 +629,7 @@ class IDLParser(object): else: p[0] = p[1] - # [50] + # [65] def p_ExtendedAttributes(self, p): """ExtendedAttributes : ',' ExtendedAttribute ExtendedAttributes |""" @@ -624,8 +641,8 @@ class IDLParser(object): # [ identifier = identifier ] # [ identifier ( ArgumentList )] # [ identifier = identifier ( ArgumentList )] - # [51] map directly to 74-77 - # [52-54, 56] are unsupported + # [66] map directly to [91-93, 95] + # [67-69, 71] are unsupported def p_ExtendedAttribute(self, p): """ExtendedAttribute : ExtendedAttributeNoArgs | ExtendedAttributeArgList @@ -633,7 +650,7 @@ class IDLParser(object): | ExtendedAttributeNamedArgList""" p[0] = p[1] - # [55] + # [70] def p_ArgumentNameKeyword(self, p): """ArgumentNameKeyword : ATTRIBUTE | CALLBACK @@ -648,6 +665,7 @@ class IDLParser(object): | INHERIT | LEGACYCALLER | PARTIAL + | SERIALIZER | SETTER | STATIC | STRINGIFIER @@ -655,7 +673,7 @@ class IDLParser(object): | UNRESTRICTED""" p[0] = p[1] - # [57] + # [72] def p_Type(self, p): """Type : SingleType | UnionType TypeSuffix""" @@ -664,7 +682,7 @@ class IDLParser(object): else: p[0] = self.BuildProduction('Type', p, 1, ListFromConcat(p[1], p[2])) - # [58] + # [73] def p_SingleType(self, p): """SingleType : NonAnyType | ANY TypeSuffixStartingWithArray""" @@ -673,21 +691,24 @@ class IDLParser(object): else: p[0] = ListFromConcat(self.BuildProduction('Any', p, 1), p[2]) - # [59] + # [74] def p_UnionType(self, p): """UnionType : '(' UnionMemberType OR UnionMemberType UnionMemberTypes ')'""" - # [60] + # [75] def p_UnionMemberType(self, p): """UnionMemberType : NonAnyType | UnionType TypeSuffix | ANY '[' ']' TypeSuffix""" - # [61] + # [76] def p_UnionMemberTypes(self, p): """UnionMemberTypes : OR UnionMemberType UnionMemberTypes |""" - # [62] Moved DATE, DOMSTRING, OBJECT to PrimitiveType + # [77] Moved BYTESTRING, DOMSTRING, OBJECT, DATE, REGEXP to PrimitiveType + # Moving all built-in types into PrimitiveType makes it easier to + # differentiate between them and 'identifier', since p[1] would be a string in + # both cases. def p_NonAnyType(self, p): """NonAnyType : PrimitiveType TypeSuffix | identifier TypeSuffix @@ -703,7 +724,7 @@ class IDLParser(object): p[0] = self.BuildProduction('Sequence', p, 1, ListFromConcat(p[3], p[5])) - # [63] + # [78] def p_ConstType(self, p): """ConstType : PrimitiveType Null | identifier Null""" @@ -714,23 +735,25 @@ class IDLParser(object): p[0] = p[1] - # [64] + # [79] Added BYTESTRING, DOMSTRING, OBJECT, DATE, REGEXP def p_PrimitiveType(self, p): """PrimitiveType : UnsignedIntegerType | UnrestrictedFloatType | BOOLEAN | BYTE | OCTET + | BYTESTRING | DOMSTRING + | OBJECT | DATE - | OBJECT""" + | REGEXP""" if type(p[1]) == str: p[0] = self.BuildNamed('PrimitiveType', p, 1) else: p[0] = p[1] - # [65] + # [80] def p_UnrestrictedFloatType(self, p): """UnrestrictedFloatType : UNRESTRICTED FloatType | FloatType""" @@ -742,13 +765,13 @@ class IDLParser(object): p[0] = typeref - # [66] + # [81] def p_FloatType(self, p): """FloatType : FLOAT | DOUBLE""" p[0] = p[1] - # [67] + # [82] def p_UnsignedIntegerType(self, p): """UnsignedIntegerType : UNSIGNED IntegerType | IntegerType""" @@ -757,7 +780,7 @@ class IDLParser(object): else: p[0] = 'unsigned ' + p[2] - # [68] + # [83] def p_IntegerType(self, p): """IntegerType : SHORT | LONG OptionalLong""" @@ -766,7 +789,7 @@ class IDLParser(object): else: p[0] = p[1] + p[2] - # [69] + # [84] def p_OptionalLong(self, p): """OptionalLong : LONG | """ @@ -776,7 +799,7 @@ class IDLParser(object): p[0] = '' - # [70] Add support for sized array + # [85] Add support for sized array def p_TypeSuffix(self, p): """TypeSuffix : '[' integer ']' TypeSuffix | '[' ']' TypeSuffix @@ -792,21 +815,21 @@ class IDLParser(object): p[0] = ListFromConcat(self.BuildTrue('NULLABLE'), p[2]) - # [71] + # [86] def p_TypeSuffixStartingWithArray(self, p): """TypeSuffixStartingWithArray : '[' ']' TypeSuffix | """ if len(p) > 1: p[0] = self.BuildProduction('Array', p, 0, p[3]) - # [72] + # [87] def p_Null(self, p): """Null : '?' |""" if len(p) > 1: p[0] = self.BuildTrue('NULLABLE') - # [73] + # [88] def p_ReturnType(self, p): """ReturnType : Type | VOID""" @@ -816,30 +839,36 @@ class IDLParser(object): else: p[0] = p[1] - # [74] + # [89-90] NOT IMPLEMENTED (IdentifierList) + + # [91] def p_ExtendedAttributeNoArgs(self, p): """ExtendedAttributeNoArgs : identifier""" p[0] = self.BuildNamed('ExtAttribute', p, 1) - # [75] + # [92] def p_ExtendedAttributeArgList(self, p): """ExtendedAttributeArgList : identifier '(' ArgumentList ')'""" arguments = self.BuildProduction('Arguments', p, 2, p[3]) p[0] = self.BuildNamed('ExtAttribute', p, 1, arguments) - # [76] + # [93] def p_ExtendedAttributeIdent(self, p): """ExtendedAttributeIdent : identifier '=' identifier""" value = self.BuildAttribute('VALUE', p[3]) p[0] = self.BuildNamed('ExtAttribute', p, 1, value) - # [77] + # [94] NOT IMPLEMENTED (ExtendedAttributeIdentList) + + # [95] def p_ExtendedAttributeNamedArgList(self, p): """ExtendedAttributeNamedArgList : identifier '=' identifier '(' ArgumentList ')'""" args = self.BuildProduction('Arguments', p, 4, p[5]) value = self.BuildNamed('Call', p, 3, args) p[0] = self.BuildNamed('ExtAttribute', p, 1, value) + # [96] NOT IMPLEMENTED (ExtendedAttributeTypePair) + # # Parser Errors # diff --git a/tools/idl_parser/idl_ppapi_lexer.py b/tools/idl_parser/idl_ppapi_lexer.py index 9e834863c8..3d5d39e058 100755 --- a/tools/idl_parser/idl_ppapi_lexer.py +++ b/tools/idl_parser/idl_ppapi_lexer.py @@ -58,8 +58,9 @@ class IDLPPAPILexer(IDLLexer): self._AddKeywords(['mem_t', 'str_t', 'cstr_t', 'interface_t']) # Remove JS types - self._DelKeywords(['boolean', 'byte', 'Date', 'DOMString', 'double', - 'float', 'long', 'object', 'octet', 'short', 'unsigned']) + self._DelKeywords(['boolean', 'byte', 'ByteString', 'Date', 'DOMString', + 'double', 'float', 'long', 'object', 'octet', 'RegExp', + 'short', 'unsigned']) # If run by itself, attempt to build the lexer diff --git a/tools/idl_parser/idl_ppapi_parser.py b/tools/idl_parser/idl_ppapi_parser.py index c02e42c818..639a8415ba 100755 --- a/tools/idl_parser/idl_ppapi_parser.py +++ b/tools/idl_parser/idl_ppapi_parser.py @@ -12,7 +12,7 @@ # on WebIDL. # # WebIDL, and WebIDL grammar can be found at: -# http://dev.w3.org/2006/webapi/WebIDL/ +# http://heycam.github.io/webidl/ # PLY can be found at: # http://www.dabeaz.com/ply/ # @@ -50,7 +50,7 @@ class IDLPPAPIParser(IDLParser): # #The parser is based on the WebIDL standard. See: -# http://www.w3.org/TR/WebIDL/#idl-grammar +# http://heycam.github.io/webidl/#idl-grammar # # [1] def p_Definitions(self, p): diff --git a/tools/idl_parser/test_lexer/keywords.in b/tools/idl_parser/test_lexer/keywords.in index 11baff907f..16dc32fc15 100644 --- a/tools/idl_parser/test_lexer/keywords.in +++ b/tools/idl_parser/test_lexer/keywords.in @@ -1,6 +1,7 @@ ANY any ATTRIBUTE attribute BOOLEAN boolean +BYTESTRING ByteString BYTE byte CALLBACK callback CONST const @@ -26,6 +27,8 @@ OPTIONAL optional OR or PARTIAL partial READONLY readonly +REGEXP RegExp +SERIALIZER serializer SETTER setter SHORT short STATIC static diff --git a/tools/idl_parser/test_parser/enum_web.idl b/tools/idl_parser/test_parser/enum_web.idl index 233410c5d5..e3107c0ae4 100644 --- a/tools/idl_parser/test_parser/enum_web.idl +++ b/tools/idl_parser/test_parser/enum_web.idl @@ -67,6 +67,18 @@ enum MealType2 { "other" }; +/* TREE + *Enum(TrailingComma) + * EnumItem(rice) + * EnumItem(noodles) + * EnumItem(other) +*/ +enum TrailingComma { + "rice", + "noodles", + "other", +}; + /* BUILD Error(Unexpected string "noodles" after string "rice".) */ /* ERROR Unexpected string "noodles" after string "rice". */ enum MissingComma { @@ -75,14 +87,6 @@ enum MissingComma { "other" }; -/* BUILD Error(Trailing comma in block.) */ -/* ERROR Trailing comma in block. */ -enum TrailingComma { - "rice", - "noodles", - "other", -}; - /* BUILD Error(Unexpected "," after ",".) */ /* ERROR Unexpected "," after ",". */ enum ExtraComma { diff --git a/tools/idl_parser/test_parser/interface_web.idl b/tools/idl_parser/test_parser/interface_web.idl index a8a4135e5c..accbf35ec9 100644 --- a/tools/idl_parser/test_parser/interface_web.idl +++ b/tools/idl_parser/test_parser/interface_web.idl @@ -76,13 +76,23 @@ interface MyIFaceBig { * Attribute(readOnlyString) * Type() * PrimitiveType(DOMString) + * Attribute(staticString) + * Type() + * PrimitiveType(DOMString) * Operation(myFunction) + * Arguments() + * Argument(myLong) + * Type() + * PrimitiveType(long long) * Type() * PrimitiveType(void) + * Operation(staticFunction) * Arguments() * Argument(myLong) * Type() * PrimitiveType(long long) + * Type() + * PrimitiveType(void) */ interface MyIFaceBig2 { const DOMString? nullValue = null; @@ -90,35 +100,37 @@ interface MyIFaceBig2 { const long long longValue2 = 123; attribute DOMString myString; readonly attribute DOMString readOnlyString; + static attribute DOMString staticString; void myFunction(long long myLong); + static void staticFunction(long long myLong); }; /* TREE *Interface(MyIFaceSpecials) * Operation(set) - * Type() - * PrimitiveType(void) * Arguments() * Argument(property) * Type() * PrimitiveType(DOMString) - * Operation(_unnamed_) * Type() - * PrimitiveType(double) + * PrimitiveType(void) + * Operation(_unnamed_) * Arguments() * Argument(property) * Type() * PrimitiveType(DOMString) - * Operation(GetFiveSix) * Type() - * PrimitiveType(long long) - * Array(5) - * Array(6) + * PrimitiveType(double) + * Operation(GetFiveSix) * Arguments() * Argument(arg) * Type() * Typeref(SomeType) + * Type() + * PrimitiveType(long long) + * Array(5) + * Array(6) */ interface MyIFaceSpecials { setter creator void set(DOMString property); diff --git a/tools/json_schema_compiler/api_gen_util.target.darwin-arm.mk b/tools/json_schema_compiler/api_gen_util.target.darwin-arm.mk index 6d8358495e..6bc93620de 100644 --- a/tools/json_schema_compiler/api_gen_util.target.darwin-arm.mk +++ b/tools/json_schema_compiler/api_gen_util.target.darwin-arm.mk @@ -90,6 +90,7 @@ MY_DEFS_Debug := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ @@ -189,6 +190,7 @@ MY_DEFS_Release := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ diff --git a/tools/json_schema_compiler/api_gen_util.target.darwin-arm64.mk b/tools/json_schema_compiler/api_gen_util.target.darwin-arm64.mk index 5cd9d9cf9e..cf741d6207 100644 --- a/tools/json_schema_compiler/api_gen_util.target.darwin-arm64.mk +++ b/tools/json_schema_compiler/api_gen_util.target.darwin-arm64.mk @@ -80,6 +80,7 @@ MY_DEFS_Debug := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ @@ -168,6 +169,7 @@ MY_DEFS_Release := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ diff --git a/tools/json_schema_compiler/api_gen_util.target.darwin-mips.mk b/tools/json_schema_compiler/api_gen_util.target.darwin-mips.mk index 01f4da0aba..f442815b42 100644 --- a/tools/json_schema_compiler/api_gen_util.target.darwin-mips.mk +++ b/tools/json_schema_compiler/api_gen_util.target.darwin-mips.mk @@ -84,6 +84,7 @@ MY_DEFS_Debug := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ @@ -177,6 +178,7 @@ MY_DEFS_Release := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ diff --git a/tools/json_schema_compiler/api_gen_util.target.darwin-x86.mk b/tools/json_schema_compiler/api_gen_util.target.darwin-x86.mk index 35ae5971c4..6d3cdc55b4 100644 --- a/tools/json_schema_compiler/api_gen_util.target.darwin-x86.mk +++ b/tools/json_schema_compiler/api_gen_util.target.darwin-x86.mk @@ -85,6 +85,7 @@ MY_DEFS_Debug := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ @@ -178,6 +179,7 @@ MY_DEFS_Release := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ diff --git a/tools/json_schema_compiler/api_gen_util.target.darwin-x86_64.mk b/tools/json_schema_compiler/api_gen_util.target.darwin-x86_64.mk index aff9064281..96417b492d 100644 --- a/tools/json_schema_compiler/api_gen_util.target.darwin-x86_64.mk +++ b/tools/json_schema_compiler/api_gen_util.target.darwin-x86_64.mk @@ -84,6 +84,7 @@ MY_DEFS_Debug := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ @@ -176,6 +177,7 @@ MY_DEFS_Release := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ diff --git a/tools/json_schema_compiler/api_gen_util.target.linux-arm.mk b/tools/json_schema_compiler/api_gen_util.target.linux-arm.mk index 6d8358495e..6bc93620de 100644 --- a/tools/json_schema_compiler/api_gen_util.target.linux-arm.mk +++ b/tools/json_schema_compiler/api_gen_util.target.linux-arm.mk @@ -90,6 +90,7 @@ MY_DEFS_Debug := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ @@ -189,6 +190,7 @@ MY_DEFS_Release := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ diff --git a/tools/json_schema_compiler/api_gen_util.target.linux-arm64.mk b/tools/json_schema_compiler/api_gen_util.target.linux-arm64.mk index 5cd9d9cf9e..cf741d6207 100644 --- a/tools/json_schema_compiler/api_gen_util.target.linux-arm64.mk +++ b/tools/json_schema_compiler/api_gen_util.target.linux-arm64.mk @@ -80,6 +80,7 @@ MY_DEFS_Debug := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ @@ -168,6 +169,7 @@ MY_DEFS_Release := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ diff --git a/tools/json_schema_compiler/api_gen_util.target.linux-mips.mk b/tools/json_schema_compiler/api_gen_util.target.linux-mips.mk index 01f4da0aba..f442815b42 100644 --- a/tools/json_schema_compiler/api_gen_util.target.linux-mips.mk +++ b/tools/json_schema_compiler/api_gen_util.target.linux-mips.mk @@ -84,6 +84,7 @@ MY_DEFS_Debug := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ @@ -177,6 +178,7 @@ MY_DEFS_Release := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ diff --git a/tools/json_schema_compiler/api_gen_util.target.linux-x86.mk b/tools/json_schema_compiler/api_gen_util.target.linux-x86.mk index 35ae5971c4..6d3cdc55b4 100644 --- a/tools/json_schema_compiler/api_gen_util.target.linux-x86.mk +++ b/tools/json_schema_compiler/api_gen_util.target.linux-x86.mk @@ -85,6 +85,7 @@ MY_DEFS_Debug := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ @@ -178,6 +179,7 @@ MY_DEFS_Release := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ diff --git a/tools/json_schema_compiler/api_gen_util.target.linux-x86_64.mk b/tools/json_schema_compiler/api_gen_util.target.linux-x86_64.mk index aff9064281..96417b492d 100644 --- a/tools/json_schema_compiler/api_gen_util.target.linux-x86_64.mk +++ b/tools/json_schema_compiler/api_gen_util.target.linux-x86_64.mk @@ -84,6 +84,7 @@ MY_DEFS_Debug := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ @@ -176,6 +177,7 @@ MY_DEFS_Release := \ '-DDATA_REDUCTION_DEV_HOST="http://proxy-dev.googlezip.net:80/"' \ '-DSPDY_PROXY_AUTH_ORIGIN="https://proxy.googlezip.net:443/"' \ '-DDATA_REDUCTION_PROXY_PROBE_URL="http://check.googlezip.net/connect"' \ + '-DDATA_REDUCTION_PROXY_WARMUP_URL="http://www.gstatic.com/generate_204"' \ '-DVIDEO_HOLE=1' \ '-DUSE_OPENSSL=1' \ '-DUSE_OPENSSL_CERTS=1' \ diff --git a/tools/licenses.py b/tools/licenses.py index 19373de874..6e0721a073 100755 --- a/tools/licenses.py +++ b/tools/licenses.py @@ -35,6 +35,7 @@ PRUNE_PATHS = set([ os.path.join('third_party','valgrind'), # Used for development and test, not in the shipping product. + os.path.join('build','secondary'), os.path.join('third_party','bison'), os.path.join('third_party','blanketjs'), os.path.join('third_party','cygwin'), @@ -54,7 +55,6 @@ PRUNE_PATHS = set([ os.path.join('third_party','qunit'), os.path.join('third_party','sinonjs'), os.path.join('third_party','syzygy'), - os.path.join('tools','gn'), # Chromium code in third_party. os.path.join('third_party','fuzzymatch'), diff --git a/tools/lsan/suppressions.txt b/tools/lsan/suppressions.txt index 6b80005128..76c33dc803 100644 --- a/tools/lsan/suppressions.txt +++ b/tools/lsan/suppressions.txt @@ -74,9 +74,6 @@ leak:ppapi::proxy::PPP_Instance_Private_ProxyTest_PPPInstancePrivate_Test leak:gpu::gles2::GLES2DecoderImpl::DoBindRenderbuffer leak:gpu::gles2::GLES2DecoderImpl::DoRenderbufferStorage -# Leak in unit_tests and browser_tests. http://crbug.com/309468 -leak:TranslateBubbleView::CreateViewBeforeTranslate() - # http://crbug.com/318221 leak:base::EnsureProcessTerminated diff --git a/tools/memory_watcher/DEPS b/tools/memory_watcher/DEPS deleted file mode 100644 index b273ae3319..0000000000 --- a/tools/memory_watcher/DEPS +++ /dev/null @@ -1,3 +0,0 @@ -include_rules = [ - "+ui/gfx", -] diff --git a/tools/memory_watcher/README b/tools/memory_watcher/README deleted file mode 100644 index 4850b18246..0000000000 --- a/tools/memory_watcher/README +++ /dev/null @@ -1,17 +0,0 @@ -memory_watcher is a library that can be linked into chromium to trace the -memory allocations. It works by hooking the system allocation/deallocation -functions, and recording the actions. - -To use memory_watcher in chromium: - -(1) Compile the memory_watcher library (it is part of the solution by default) - -(2) Run chromium with these flags "--memory-profile -no-sandbox" -(The instrumentation doesn't work with the sandbox) - -(3) Hit ctrl-alt-D to generate a dump of the memory allocations. -This will create a log file called memorywatcher.logXXXX for every -chromium process (where XXXX is the pid). - -The log file is a human readable text format, which can be further analyzed -using the helpers in the "scripts/" directory. diff --git a/tools/memory_watcher/call_stack.cc b/tools/memory_watcher/call_stack.cc deleted file mode 100644 index 6f829b4501..0000000000 --- a/tools/memory_watcher/call_stack.cc +++ /dev/null @@ -1,399 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "tools/memory_watcher/call_stack.h" - -#include <shlwapi.h> -#include <tlhelp32.h> - -#include "base/strings/string_number_conversions.h" -#include "tools/memory_watcher/memory_hook.h" - -// Typedefs for explicit dynamic linking with functions exported from -// dbghelp.dll. -typedef BOOL (__stdcall *t_StackWalk64)(DWORD, HANDLE, HANDLE, - LPSTACKFRAME64, PVOID, - PREAD_PROCESS_MEMORY_ROUTINE64, - PFUNCTION_TABLE_ACCESS_ROUTINE64, - PGET_MODULE_BASE_ROUTINE64, - PTRANSLATE_ADDRESS_ROUTINE64); -typedef PVOID (__stdcall *t_SymFunctionTableAccess64)(HANDLE, DWORD64); -typedef DWORD64 (__stdcall *t_SymGetModuleBase64)(HANDLE, DWORD64); -typedef BOOL (__stdcall *t_SymCleanup)(HANDLE); -typedef BOOL (__stdcall *t_SymGetSymFromAddr64)(HANDLE, DWORD64, - PDWORD64, PIMAGEHLP_SYMBOL64); -typedef BOOL (__stdcall *t_SymGetLineFromAddr64)(HANDLE, DWORD64, PDWORD, - PIMAGEHLP_LINE64); -typedef BOOL (__stdcall *t_SymInitialize)(HANDLE, PCTSTR, BOOL); -typedef DWORD (__stdcall *t_SymGetOptions)(void); -typedef DWORD (__stdcall *t_SymSetOptions)(DWORD); -typedef BOOL (__stdcall *t_SymGetSearchPath)(HANDLE, PTSTR, DWORD); -typedef DWORD64 (__stdcall *t_SymLoadModule64)(HANDLE, HANDLE, PCSTR, - PCSTR, DWORD64, DWORD); -typedef BOOL (__stdcall *t_SymGetModuleInfo64)(HANDLE, DWORD64, - PIMAGEHLP_MODULE64); - -// static -base::Lock CallStack::dbghelp_lock_; -// static -bool CallStack::dbghelp_loaded_ = false; -// static -DWORD CallStack::active_thread_id_ = 0; - - -static t_StackWalk64 pStackWalk64 = NULL; -static t_SymCleanup pSymCleanup = NULL; -static t_SymGetSymFromAddr64 pSymGetSymFromAddr64 = NULL; -static t_SymFunctionTableAccess64 pSymFunctionTableAccess64 = NULL; -static t_SymGetModuleBase64 pSymGetModuleBase64 = NULL; -static t_SymGetLineFromAddr64 pSymGetLineFromAddr64 = NULL; -static t_SymInitialize pSymInitialize = NULL; -static t_SymGetOptions pSymGetOptions = NULL; -static t_SymSetOptions pSymSetOptions = NULL; -static t_SymGetModuleInfo64 pSymGetModuleInfo64 = NULL; -static t_SymGetSearchPath pSymGetSearchPath = NULL; -static t_SymLoadModule64 pSymLoadModule64 = NULL; - -#define LOADPROC(module, name) do { \ - p##name = reinterpret_cast<t_##name>(GetProcAddress(module, #name)); \ - if (p##name == NULL) return false; \ -} while (0) - -// This code has to be VERY careful to not induce any allocations, as memory -// watching code may cause recursion, which may obscure the stack for the truly -// offensive issue. We use this function to break into a debugger, and it -// is guaranteed to not do any allocations (in fact, not do anything). -static void UltraSafeDebugBreak() { - _asm int(3); -} - -// static -bool CallStack::LoadDbgHelp() { - if (!dbghelp_loaded_) { - base::AutoLock Lock(dbghelp_lock_); - - // Re-check if we've loaded successfully now that we have the lock. - if (dbghelp_loaded_) - return true; - - // Load dbghelp.dll, and obtain pointers to the exported functions that we - // will be using. - HMODULE dbghelp_module = LoadLibrary(L"dbghelp.dll"); - if (dbghelp_module) { - LOADPROC(dbghelp_module, StackWalk64); - LOADPROC(dbghelp_module, SymFunctionTableAccess64); - LOADPROC(dbghelp_module, SymGetModuleBase64); - LOADPROC(dbghelp_module, SymCleanup); - LOADPROC(dbghelp_module, SymGetSymFromAddr64); - LOADPROC(dbghelp_module, SymGetLineFromAddr64); - LOADPROC(dbghelp_module, SymInitialize); - LOADPROC(dbghelp_module, SymGetOptions); - LOADPROC(dbghelp_module, SymSetOptions); - LOADPROC(dbghelp_module, SymGetModuleInfo64); - LOADPROC(dbghelp_module, SymGetSearchPath); - LOADPROC(dbghelp_module, SymLoadModule64); - dbghelp_loaded_ = true; - } else { - UltraSafeDebugBreak(); - return false; - } - } - return dbghelp_loaded_; -} - -// Load the symbols for generating stack traces. -static bool LoadSymbols(HANDLE process_handle) { - static bool symbols_loaded = false; - if (symbols_loaded) return true; - - BOOL ok; - - // Initialize the symbol engine. - ok = pSymInitialize(process_handle, /* hProcess */ - NULL, /* UserSearchPath */ - FALSE); /* fInvadeProcess */ - if (!ok) return false; - - DWORD options = pSymGetOptions(); - options |= SYMOPT_LOAD_LINES; - options |= SYMOPT_FAIL_CRITICAL_ERRORS; - options |= SYMOPT_UNDNAME; - options = pSymSetOptions(options); - - const DWORD kMaxSearchPath = 1024; - TCHAR buf[kMaxSearchPath] = {0}; - ok = pSymGetSearchPath(process_handle, buf, kMaxSearchPath); - if (!ok) - return false; - - HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, - GetCurrentProcessId()); - if (snapshot == INVALID_HANDLE_VALUE) - return false; - - MODULEENTRY32W module; - module.dwSize = sizeof(module); // Set the size of the structure. - BOOL cont = Module32FirstW(snapshot, &module); - while (cont) { - DWORD64 base; - // NOTE the SymLoadModule64 function has the peculiarity of accepting a - // both unicode and ASCII strings even though the parameter is PSTR. - base = pSymLoadModule64(process_handle, - 0, - reinterpret_cast<PSTR>(module.szExePath), - reinterpret_cast<PSTR>(module.szModule), - reinterpret_cast<DWORD64>(module.modBaseAddr), - module.modBaseSize); - if (base == 0) { - int err = GetLastError(); - if (err != ERROR_MOD_NOT_FOUND && err != ERROR_INVALID_HANDLE) - return false; - } - cont = Module32NextW(snapshot, &module); - } - CloseHandle(snapshot); - - symbols_loaded = true; - return true; -} - - -CallStack::SymbolCache* CallStack::symbol_cache_; - -bool CallStack::Initialize() { - // We need to delay load the symbol cache until after - // the MemoryHook heap is alive. - symbol_cache_ = new SymbolCache(); - return LoadDbgHelp(); -} - -CallStack::CallStack() { - static LONG callstack_id = 0; - frame_count_ = 0; - hash_ = 0; - id_ = InterlockedIncrement(&callstack_id); - valid_ = false; - - if (!dbghelp_loaded_) { - UltraSafeDebugBreak(); // Initialize should have been called. - return; - } - - GetStackTrace(); -} - -bool CallStack::IsEqual(const CallStack &target) { - if (frame_count_ != target.frame_count_) - return false; // They can't be equal if the sizes are different. - - // Walk the frames array until we - // either find a mismatch, or until we reach the end of the call stacks. - for (int index = 0; index < frame_count_; index++) { - if (frames_[index] != target.frames_[index]) - return false; // Found a mismatch. They are not equal. - } - - // Reached the end of the call stacks. They are equal. - return true; -} - -void CallStack::AddFrame(DWORD_PTR pc) { - DCHECK(frame_count_ < kMaxTraceFrames); - frames_[frame_count_++] = pc; - - // Create a unique id for this CallStack. - pc = pc + (frame_count_ * 13); // Alter the PC based on position in stack. - hash_ = ~hash_ + (pc << 15); - hash_ = hash_ ^ (pc >> 12); - hash_ = hash_ + (pc << 2); - hash_ = hash_ ^ (pc >> 4); - hash_ = hash_ * 2057; - hash_ = hash_ ^ (pc >> 16); -} - -bool CallStack::LockedRecursionDetected() const { - if (!active_thread_id_) return false; - DWORD thread_id = GetCurrentThreadId(); - // TODO(jar): Perchance we should use atomic access to member. - return thread_id == active_thread_id_; -} - -bool CallStack::GetStackTrace() { - if (LockedRecursionDetected()) - return false; - - // Initialize the context record. - CONTEXT context; - memset(&context, 0, sizeof(context)); - context.ContextFlags = CONTEXT_FULL; - __asm call x - __asm x: pop eax - __asm mov context.Eip, eax - __asm mov context.Ebp, ebp - __asm mov context.Esp, esp - - STACKFRAME64 frame; - memset(&frame, 0, sizeof(frame)); - -#ifdef _M_IX86 - DWORD image_type = IMAGE_FILE_MACHINE_I386; - frame.AddrPC.Offset = context.Eip; - frame.AddrPC.Mode = AddrModeFlat; - frame.AddrFrame.Offset = context.Ebp; - frame.AddrFrame.Mode = AddrModeFlat; - frame.AddrStack.Offset = context.Esp; - frame.AddrStack.Mode = AddrModeFlat; -#elif - NOT IMPLEMENTED! -#endif - - HANDLE current_process = GetCurrentProcess(); - HANDLE current_thread = GetCurrentThread(); - - // Walk the stack. - unsigned int count = 0; - { - AutoDbgHelpLock thread_monitoring_lock; - - while (count < kMaxTraceFrames) { - count++; - if (!pStackWalk64(image_type, - current_process, - current_thread, - &frame, - &context, - 0, - pSymFunctionTableAccess64, - pSymGetModuleBase64, - NULL)) - break; // Couldn't trace back through any more frames. - - if (frame.AddrFrame.Offset == 0) - continue; // End of stack. - - // Push this frame's program counter onto the provided CallStack. - AddFrame((DWORD_PTR)frame.AddrPC.Offset); - } - valid_ = true; - } - return true; -} - -void CallStack::ToString(PrivateAllocatorString* output) { - static const int kStackWalkMaxNameLen = MAX_SYM_NAME; - HANDLE current_process = GetCurrentProcess(); - - if (!LoadSymbols(current_process)) { - *output = "Error"; - return; - } - - base::AutoLock lock(dbghelp_lock_); - - // Iterate through each frame in the call stack. - for (int32 index = 0; index < frame_count_; index++) { - PrivateAllocatorString line; - - DWORD_PTR intruction_pointer = frame(index); - - SymbolCache::iterator it; - it = symbol_cache_->find(intruction_pointer); - if (it != symbol_cache_->end()) { - line = it->second; - } else { - // Try to locate a symbol for this frame. - DWORD64 symbol_displacement = 0; - ULONG64 buffer[(sizeof(IMAGEHLP_SYMBOL64) + - sizeof(TCHAR)*kStackWalkMaxNameLen + - sizeof(ULONG64) - 1) / sizeof(ULONG64)]; - IMAGEHLP_SYMBOL64* symbol = reinterpret_cast<IMAGEHLP_SYMBOL64*>(buffer); - memset(buffer, 0, sizeof(buffer)); - symbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64); - symbol->MaxNameLength = kStackWalkMaxNameLen; - BOOL ok = pSymGetSymFromAddr64(current_process, // hProcess - intruction_pointer, // Address - &symbol_displacement, // Displacement - symbol); // Symbol - if (ok) { - // Try to locate more source information for the symbol. - IMAGEHLP_LINE64 Line; - memset(&Line, 0, sizeof(Line)); - Line.SizeOfStruct = sizeof(Line); - DWORD line_displacement; - ok = pSymGetLineFromAddr64(current_process, - intruction_pointer, - &line_displacement, - &Line); - if (ok) { - // Skip junk symbols from our internal stuff. - if (strstr(symbol->Name, "CallStack::") || - strstr(symbol->Name, "MemoryWatcher::") || - strstr(symbol->Name, "Perftools_") || - strstr(symbol->Name, "MemoryHook::") ) { - // Just record a blank string. - (*symbol_cache_)[intruction_pointer] = ""; - continue; - } - - line += " "; - line += static_cast<char*>(Line.FileName); - line += " ("; - // TODO(jar): get something like this template to work :-/ - // line += IntToCustomString<PrivateAllocatorString>(Line.LineNumber); - // ...and then delete this line, which uses std::string. - line += base::IntToString(Line.LineNumber).c_str(); - line += "): "; - line += symbol->Name; - line += "\n"; - } else { - line += " unknown (0):"; - line += symbol->Name; - line += "\n"; - } - } else { - // OK - couldn't get any info. Try for the module. - IMAGEHLP_MODULE64 module_info; - module_info.SizeOfStruct = sizeof(module_info); - if (pSymGetModuleInfo64(current_process, intruction_pointer, - &module_info)) { - line += " ("; - line += static_cast<char*>(module_info.ModuleName); - line += ")\n"; - } else { - line += " ???\n"; - } - } - } - - (*symbol_cache_)[intruction_pointer] = line; - *output += line; - } - *output += "==================\n"; -} - - -base::Lock AllocationStack::freelist_lock_; -AllocationStack* AllocationStack::freelist_ = NULL; - -void* AllocationStack::operator new(size_t size) { - DCHECK(size == sizeof(AllocationStack)); - { - base::AutoLock lock(freelist_lock_); - if (freelist_ != NULL) { - AllocationStack* stack = freelist_; - freelist_ = freelist_->next_; - stack->next_ = NULL; - return stack; - } - } - return MemoryHook::Alloc(size); -} - -void AllocationStack::operator delete(void* ptr) { - AllocationStack *stack = reinterpret_cast<AllocationStack*>(ptr); - base::AutoLock lock(freelist_lock_); - DCHECK(stack->next_ == NULL); - stack->next_ = freelist_; - freelist_ = stack; -} diff --git a/tools/memory_watcher/call_stack.h b/tools/memory_watcher/call_stack.h deleted file mode 100644 index 941aad4987..0000000000 --- a/tools/memory_watcher/call_stack.h +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// Parts of this module come from: -// http://www.codeproject.com/KB/applications/visualleakdetector.aspx -// by Dan Moulding. -// http://www.codeproject.com/KB/threads/StackWalker.aspx -// by Jochen Kalmbach - -#ifndef TOOLS_MEMORY_WATCHER_CALL_STACK_H_ -#define TOOLS_MEMORY_WATCHER_CALL_STACK_H_ - -#include <windows.h> -#include <dbghelp.h> -#include <functional> -#include <map> -#include <string> - -#include "base/logging.h" -#include "base/synchronization/lock.h" -#include "tools/memory_watcher/memory_watcher.h" - -// The CallStack Class -// A stack where memory has been allocated. -class CallStack { - public: - // Initialize for tracing CallStacks. - static bool Initialize(); - - CallStack(); - virtual ~CallStack() {} - - // Get a hash for this CallStack. - // Identical stack traces will have matching hashes. - int32 hash() { return hash_; } - - // Get a unique ID for this CallStack. - // No two CallStacks will ever have the same ID. The ID is a monotonically - // increasing number. Newer CallStacks always have larger IDs. - int32 id() { return id_; } - - // Retrieves the frame at the specified index. - DWORD_PTR frame(int32 index) { - DCHECK(index < frame_count_ && index >= 0); - return frames_[index]; - } - - // Compares the CallStack to another CallStack - // for equality. Two CallStacks are equal if they are the same size and if - // every frame in each is identical to the corresponding frame in the other. - bool IsEqual(const CallStack &target); - - typedef std::basic_string<char, std::char_traits<char>, - PrivateHookAllocator<char> > PrivateAllocatorString; - - // Convert the callstack to a string stored in output. - void CallStack::ToString(PrivateAllocatorString* output); - - // - bool Valid() const { return valid_; } - - private: - // The maximum number of frames to trace. - static const int kMaxTraceFrames = 32; - - // Pushes a frame's program counter onto the CallStack. - void AddFrame(DWORD_PTR programcounter); - - // Traces the stack, starting from this function, up to kMaxTraceFrames - // frames. - bool GetStackTrace(); - - // Functions for manipulating the frame list. - void ClearFrames(); - - // Dynamically load the DbgHelp library and supporting routines that we - // will use. - static bool LoadDbgHelp(); - - static void LockDbgHelp() { - dbghelp_lock_.Acquire(); - active_thread_id_ = GetCurrentThreadId(); - } - - static void UnlockDbgHelp() { - active_thread_id_ = 0; - dbghelp_lock_.Release(); - } - - class AutoDbgHelpLock { - public: - AutoDbgHelpLock() { - CallStack::LockDbgHelp(); - } - ~AutoDbgHelpLock() { - CallStack::UnlockDbgHelp(); - } - }; - - // Check to see if this thread is already processing a stack. - bool LockedRecursionDetected() const; - - // According to http://msdn2.microsoft.com/en-us/library/ms680650(VS.85).aspx - // "All DbgHelp functions, such as this one, are single threaded. Therefore, - // calls from more than one thread to this function will likely result in - // unexpected behavior or memory corruption. To avoid this, you must - // synchromize all concurrent calls from one thread to this function." - // - // dbghelp_lock_ is used to serialize access across all calls to the DbgHelp - // library. This may be overly conservative (serializing them all together), - // but does guarantee correctness. - static base::Lock dbghelp_lock_; - - // Record the fact that dbghelp has been loaded. - // Changes to this variable are protected by dbghelp_lock_. - // It will only changes once... from false to true. - static bool dbghelp_loaded_; - - // To prevent infinite recursion due to unexpected side effects in libraries, - // we track the thread_id of the thread currently holding the dbghelp_lock_. - // We avoid re-aquiring said lock and return an !valid_ instance when we - // detect recursion. - static DWORD active_thread_id_; - - int frame_count_; // Current size (in frames) - DWORD_PTR frames_[kMaxTraceFrames]; - int32 hash_; - int32 id_; - - // Indicate is this is a valid stack. - // This is false if recursion precluded a real stack generation. - bool valid_; - - // Cache ProgramCounter -> Symbol lookups. - // This cache is not thread safe. - typedef std::map<int32, PrivateAllocatorString, std::less<int32>, - PrivateHookAllocator<int32> > SymbolCache; - static SymbolCache* symbol_cache_; - - DISALLOW_COPY_AND_ASSIGN(CallStack); -}; - -// An AllocationStack is a type of CallStack which represents a CallStack where -// memory has been allocated. This class is also a list item, so that it can -// be easilly allocated and deallocated from its static singly-linked-list of -// free instances. -class AllocationStack : public CallStack { - public: - explicit AllocationStack(int32 size) - : next_(NULL), size_(size), CallStack() {} - - // We maintain a freelist of the AllocationStacks. - void* operator new(size_t s); - void operator delete(void*p); - - int32 size() const { return size_; } - - private: - AllocationStack* next_; // Pointer used when on the freelist. - int32 size_; // Size of block allocated. - static AllocationStack* freelist_; - static base::Lock freelist_lock_; - - DISALLOW_COPY_AND_ASSIGN(AllocationStack); -}; - -#endif // TOOLS_MEMORY_WATCHER_CALL_STACK_H_ diff --git a/tools/memory_watcher/dllmain.cc b/tools/memory_watcher/dllmain.cc deleted file mode 100644 index b642314727..0000000000 --- a/tools/memory_watcher/dllmain.cc +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// The memory_watcher.dll is hooked by simply linking it. When we get the -// windows notification that this DLL is loaded, we do a few things: -// 1) Register a Hot Key. -// Only one process can hook the Hot Key, so one will get it, and the -// others will silently fail. -// 2) Create a thread to wait on an event. -// Since only one process will get the HotKey, it will be responsible for -// notifying all process when it's time to do something. Each process -// will have a thread waiting for communication from the master to dump -// the callstacks. - -#include <windows.h> - -#include "base/at_exit.h" -#include "tools/memory_watcher/memory_watcher.h" -#include "tools/memory_watcher/hotkey.h" - -class MemoryWatcherDumpKey; // Defined below. - -static wchar_t* kDumpEvent = L"MemWatcher.DumpEvent"; -static base::AtExitManager* g_memory_watcher_exit_manager = NULL; -static MemoryWatcher* g_memory_watcher = NULL; -static MemoryWatcherDumpKey* g_hotkey_handler = NULL; -static HANDLE g_dump_event = INVALID_HANDLE_VALUE; -static HANDLE g_quit_event = INVALID_HANDLE_VALUE; -static HANDLE g_watcher_thread = INVALID_HANDLE_VALUE; - -// A HotKey to dump the memory statistics. -class MemoryWatcherDumpKey : public HotKeyHandler { - public: - MemoryWatcherDumpKey(UINT modifiers, UINT vkey) - : HotKeyHandler(modifiers, vkey) {} - - virtual void OnHotKey(UINT, WPARAM, LPARAM) { - SetEvent(g_dump_event); - } -}; - -// Creates the global memory watcher. -void CreateMemoryWatcher() { - g_memory_watcher_exit_manager = new base::AtExitManager(); - g_memory_watcher = new MemoryWatcher(); - // Register ALT-CONTROL-D to Dump Memory stats. - g_hotkey_handler = new MemoryWatcherDumpKey(MOD_ALT|MOD_CONTROL, 0x44); -} - -// Deletes the global memory watcher. -void DeleteMemoryWatcher() { - if (g_hotkey_handler) - delete g_hotkey_handler; - g_hotkey_handler = NULL; - if (g_memory_watcher) - delete g_memory_watcher; - g_memory_watcher = NULL; - - // Intentionly leak g_memory_watcher_exit_manager. -} - -// Thread for watching for key events. -DWORD WINAPI ThreadMain(LPVOID) { - bool stopping = false; - HANDLE events[2] = { g_dump_event, g_quit_event }; - while (!stopping) { - DWORD rv = WaitForMultipleObjects(2, events, FALSE, INFINITE); - switch (rv) { - case WAIT_OBJECT_0: - if (g_memory_watcher) { - g_memory_watcher->DumpLeaks(); - } - stopping = true; - break; - case WAIT_OBJECT_0 + 1: - stopping = true; - break; - default: - NOTREACHED(); - break; - } - } - return 0; -} - -// Creates the background thread -void CreateBackgroundThread() { - // Create a named event which can be used to notify - // all watched processes. - g_dump_event = CreateEvent(0, TRUE, FALSE, kDumpEvent); - DCHECK(g_dump_event != NULL); - - // Create a local event which can be used to kill our - // background thread. - g_quit_event = CreateEvent(0, TRUE, FALSE, NULL); - DCHECK(g_quit_event != NULL); - - // Create the background thread. - g_watcher_thread = CreateThread(0, - 0, - ThreadMain, - 0, - 0, - 0); - DCHECK(g_watcher_thread != NULL); -} - -// Tell the background thread to stop. -void StopBackgroundThread() { - // Send notification to our background thread. - SetEvent(g_quit_event); - - // Wait for our background thread to die. - DWORD rv = WaitForSingleObject(g_watcher_thread, INFINITE); - DCHECK(rv == WAIT_OBJECT_0); - - // Cleanup our global handles. - CloseHandle(g_quit_event); - CloseHandle(g_dump_event); - CloseHandle(g_watcher_thread); -} - -bool IsChromeExe() { - return GetModuleHandleA("chrome.exe") != NULL; -} - -extern "C" { -// DllMain is the windows entry point to this DLL. -// We use the entry point as the mechanism for starting and stopping -// the MemoryWatcher. -BOOL WINAPI DllMain(HINSTANCE dll_instance, DWORD reason, - LPVOID reserved) { - if (!IsChromeExe()) - return FALSE; - - switch (reason) { - case DLL_PROCESS_ATTACH: - CreateMemoryWatcher(); - CreateBackgroundThread(); - break; - case DLL_PROCESS_DETACH: - DeleteMemoryWatcher(); - StopBackgroundThread(); - break; - } - return TRUE; -} - -__declspec(dllexport) void __cdecl SetLogName(char* name) { - g_memory_watcher->SetLogName(name); -} - -} // extern "C" diff --git a/tools/memory_watcher/hotkey.h b/tools/memory_watcher/hotkey.h deleted file mode 100644 index 3ac430cdad..0000000000 --- a/tools/memory_watcher/hotkey.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef TOOLS_MEMORY_WATCHER_HOTKEY_H_ -#define TOOLS_MEMORY_WATCHER_HOTKEY_H_ - -#include "ui/gfx/rect.h" -#include "ui/gfx/win/msg_util.h" -#include "ui/gfx/win/window_impl.h" - -// HotKey handler. -// Programs wishing to register a hotkey can use this. -class HotKeyHandler : public gfx::WindowImpl { - public: - HotKeyHandler(UINT modifiers, UINT vk) - : modifiers_(modifiers), - vkey_(vk) { - Start(); - } - ~HotKeyHandler() { Stop(); } - - CR_BEGIN_MSG_MAP_EX(HotKeyHandler) - CR_MSG_WM_HOTKEY(OnHotKey) - CR_END_MSG_MAP() - - private: - static const int hotkey_id = 0x0000baba; - - bool Start() { - set_window_style(WS_POPUP); - Init(NULL, gfx::Rect()); - return RegisterHotKey(hwnd(), hotkey_id, modifiers_, vkey_) == TRUE; - } - - void Stop() { - UnregisterHotKey(hwnd(), hotkey_id); - DestroyWindow(hwnd()); - } - - // Handle the registered Hotkey being pressed. - virtual void OnHotKey(UINT /*uMsg*/, - WPARAM /*wParam*/, - LPARAM /*lParam*/) = 0; - - UINT modifiers_; - UINT vkey_; -}; - -#endif // TOOLS_MEMORY_WATCHER_HOTKEY_H_ diff --git a/tools/memory_watcher/ia32_modrm_map.cc b/tools/memory_watcher/ia32_modrm_map.cc deleted file mode 100644 index 5c4ec3f2ff..0000000000 --- a/tools/memory_watcher/ia32_modrm_map.cc +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/* - * Table of relevant information about how to decode the ModR/M byte. - * Based on information in the IA 32 Intel Architecture - * Software Developer's Manual Volume 2: Instruction Set Reference. - */ - -#include "mini_disassembler.h" -#include "mini_disassembler_types.h" - -namespace sidestep { - -const ModrmEntry MiniDisassembler::s_ia16_modrm_map_[] = { -// mod == 00 - /* r/m == 000 */ { false, false, OS_ZERO }, - /* r/m == 001 */ { false, false, OS_ZERO }, - /* r/m == 010 */ { false, false, OS_ZERO }, - /* r/m == 011 */ { false, false, OS_ZERO }, - /* r/m == 100 */ { false, false, OS_ZERO }, - /* r/m == 101 */ { false, false, OS_ZERO }, - /* r/m == 110 */ { true, false, OS_WORD }, - /* r/m == 111 */ { false, false, OS_ZERO }, -// mod == 01 - /* r/m == 000 */ { true, false, OS_BYTE }, - /* r/m == 001 */ { true, false, OS_BYTE }, - /* r/m == 010 */ { true, false, OS_BYTE }, - /* r/m == 011 */ { true, false, OS_BYTE }, - /* r/m == 100 */ { true, false, OS_BYTE }, - /* r/m == 101 */ { true, false, OS_BYTE }, - /* r/m == 110 */ { true, false, OS_BYTE }, - /* r/m == 111 */ { true, false, OS_BYTE }, -// mod == 10 - /* r/m == 000 */ { true, false, OS_WORD }, - /* r/m == 001 */ { true, false, OS_WORD }, - /* r/m == 010 */ { true, false, OS_WORD }, - /* r/m == 011 */ { true, false, OS_WORD }, - /* r/m == 100 */ { true, false, OS_WORD }, - /* r/m == 101 */ { true, false, OS_WORD }, - /* r/m == 110 */ { true, false, OS_WORD }, - /* r/m == 111 */ { true, false, OS_WORD }, -// mod == 11 - /* r/m == 000 */ { false, false, OS_ZERO }, - /* r/m == 001 */ { false, false, OS_ZERO }, - /* r/m == 010 */ { false, false, OS_ZERO }, - /* r/m == 011 */ { false, false, OS_ZERO }, - /* r/m == 100 */ { false, false, OS_ZERO }, - /* r/m == 101 */ { false, false, OS_ZERO }, - /* r/m == 110 */ { false, false, OS_ZERO }, - /* r/m == 111 */ { false, false, OS_ZERO } -}; - -const ModrmEntry MiniDisassembler::s_ia32_modrm_map_[] = { -// mod == 00 - /* r/m == 000 */ { false, false, OS_ZERO }, - /* r/m == 001 */ { false, false, OS_ZERO }, - /* r/m == 010 */ { false, false, OS_ZERO }, - /* r/m == 011 */ { false, false, OS_ZERO }, - /* r/m == 100 */ { false, true, OS_ZERO }, - /* r/m == 101 */ { true, false, OS_DOUBLE_WORD }, - /* r/m == 110 */ { false, false, OS_ZERO }, - /* r/m == 111 */ { false, false, OS_ZERO }, -// mod == 01 - /* r/m == 000 */ { true, false, OS_BYTE }, - /* r/m == 001 */ { true, false, OS_BYTE }, - /* r/m == 010 */ { true, false, OS_BYTE }, - /* r/m == 011 */ { true, false, OS_BYTE }, - /* r/m == 100 */ { true, true, OS_BYTE }, - /* r/m == 101 */ { true, false, OS_BYTE }, - /* r/m == 110 */ { true, false, OS_BYTE }, - /* r/m == 111 */ { true, false, OS_BYTE }, -// mod == 10 - /* r/m == 000 */ { true, false, OS_DOUBLE_WORD }, - /* r/m == 001 */ { true, false, OS_DOUBLE_WORD }, - /* r/m == 010 */ { true, false, OS_DOUBLE_WORD }, - /* r/m == 011 */ { true, false, OS_DOUBLE_WORD }, - /* r/m == 100 */ { true, true, OS_DOUBLE_WORD }, - /* r/m == 101 */ { true, false, OS_DOUBLE_WORD }, - /* r/m == 110 */ { true, false, OS_DOUBLE_WORD }, - /* r/m == 111 */ { true, false, OS_DOUBLE_WORD }, -// mod == 11 - /* r/m == 000 */ { false, false, OS_ZERO }, - /* r/m == 001 */ { false, false, OS_ZERO }, - /* r/m == 010 */ { false, false, OS_ZERO }, - /* r/m == 011 */ { false, false, OS_ZERO }, - /* r/m == 100 */ { false, false, OS_ZERO }, - /* r/m == 101 */ { false, false, OS_ZERO }, - /* r/m == 110 */ { false, false, OS_ZERO }, - /* r/m == 111 */ { false, false, OS_ZERO }, -}; - -}; // namespace sidestep diff --git a/tools/memory_watcher/ia32_opcode_map.cc b/tools/memory_watcher/ia32_opcode_map.cc deleted file mode 100644 index 6fb15d8108..0000000000 --- a/tools/memory_watcher/ia32_opcode_map.cc +++ /dev/null @@ -1,1161 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/* - * Opcode decoding maps. Based on the IA-32 Intel Architecture - * Software Developer's Manual Volume 2: Instruction Set Reference. Idea - * for how to lay out the tables in memory taken from the implementation - * in the Bastard disassembly environment. - */ - -#include "mini_disassembler.h" - -namespace sidestep { - -/* -* This is the first table to be searched; the first field of each -* Opcode in the table is either 0 to indicate you're in the -* right table, or an index to the correct table, in the global -* map g_pentiumOpcodeMap -*/ -const Opcode s_first_opcode_byte[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_E | OT_B, AM_G | OT_B, AM_NOT_USED, "add", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_NOT_USED, "add", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_G | OT_B, AM_E | OT_B, AM_NOT_USED, "add", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "add", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "add", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "add", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_REGISTER | OT_W, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_GENERIC, AM_REGISTER | OT_W, AM_NOT_USED, AM_NOT_USED, "pop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x8 */ { 0, IT_GENERIC, AM_E | OT_B, AM_G | OT_B, AM_NOT_USED, "or", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x9 */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_NOT_USED, "or", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA */ { 0, IT_GENERIC, AM_G | OT_B, AM_E | OT_B, AM_NOT_USED, "or", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "or", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "or", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xD */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "or", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xE */ { 0, IT_GENERIC, AM_REGISTER | OT_W, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xF */ { 1, IT_REFERENCE, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x10 */ { 0, IT_GENERIC, AM_E | OT_B, AM_G | OT_B, AM_NOT_USED, "adc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x11 */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_NOT_USED, "adc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x12 */ { 0, IT_GENERIC, AM_G | OT_B, AM_E | OT_B, AM_NOT_USED, "adc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x13 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "adc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x14 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "adc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x15 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "adc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x16 */ { 0, IT_GENERIC, AM_REGISTER | OT_W, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x17 */ { 0, IT_GENERIC, AM_REGISTER | OT_W, AM_NOT_USED, AM_NOT_USED, "pop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x18 */ { 0, IT_GENERIC, AM_E | OT_B, AM_G | OT_B, AM_NOT_USED, "sbb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x19 */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_NOT_USED, "sbb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1A */ { 0, IT_GENERIC, AM_G | OT_B, AM_E | OT_B, AM_NOT_USED, "sbb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1B */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "sbb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1C */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "sbb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1D */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "sbb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1E */ { 0, IT_GENERIC, AM_REGISTER | OT_W, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1F */ { 0, IT_GENERIC, AM_REGISTER | OT_W, AM_NOT_USED, AM_NOT_USED, "pop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x20 */ { 0, IT_GENERIC, AM_E | OT_B, AM_G | OT_B, AM_NOT_USED, "and", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x21 */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_NOT_USED, "and", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x22 */ { 0, IT_GENERIC, AM_G | OT_B, AM_E | OT_B, AM_NOT_USED, "and", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x23 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "and", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x24 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "and", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x25 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "and", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x26 */ { 0, IT_PREFIX, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x27 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "daa", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x28 */ { 0, IT_GENERIC, AM_E | OT_B, AM_G | OT_B, AM_NOT_USED, "sub", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x29 */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_NOT_USED, "sub", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2A */ { 0, IT_GENERIC, AM_G | OT_B, AM_E | OT_B, AM_NOT_USED, "sub", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2B */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "sub", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2C */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "sub", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2D */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "sub", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2E */ { 0, IT_PREFIX, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2F */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "das", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x30 */ { 0, IT_GENERIC, AM_E | OT_B, AM_G | OT_B, AM_NOT_USED, "xor", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x31 */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_NOT_USED, "xor", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x32 */ { 0, IT_GENERIC, AM_G | OT_B, AM_E | OT_B, AM_NOT_USED, "xor", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x33 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "xor", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x34 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "xor", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x35 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "xor", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x36 */ { 0, IT_PREFIX, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x37 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "aaa", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x38 */ { 0, IT_GENERIC, AM_E | OT_B, AM_G | OT_B, AM_NOT_USED, "cmp", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x39 */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_NOT_USED, "cmp", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3A */ { 0, IT_GENERIC, AM_G | OT_B, AM_E | OT_B, AM_NOT_USED, "cmp", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3B */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmp", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3C */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "cmp", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3D */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "cmp", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3E */ { 0, IT_PREFIX, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3F */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "aas", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x40 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "inc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x41 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "inc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x42 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "inc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x43 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "inc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x44 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "inc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x45 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "inc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x46 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "inc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x47 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "inc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x48 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "dec", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x49 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "dec", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4A */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "dec", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4B */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "dec", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4C */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "dec", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4D */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "dec", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4E */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "dec", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4F */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "dec", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x50 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x51 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x52 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x53 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x54 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x55 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x56 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x57 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x58 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "pop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x59 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "pop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5A */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "pop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5B */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "pop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5C */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "pop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5D */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "pop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5E */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "pop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5F */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_NOT_USED, AM_NOT_USED, "pop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x60 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "pushad", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x61 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "popad", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x62 */ { 0, IT_GENERIC, AM_G | OT_V, AM_M | OT_A, AM_NOT_USED, "bound", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x63 */ { 0, IT_GENERIC, AM_E | OT_W, AM_G | OT_W, AM_NOT_USED, "arpl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x64 */ { 0, IT_PREFIX, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x65 */ { 0, IT_PREFIX, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x66 */ { 0, IT_PREFIX_OPERAND, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x67 */ { 0, IT_PREFIX_ADDRESS, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x68 */ { 0, IT_GENERIC, AM_I | OT_V, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x69 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_I | OT_V, "imul", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6A */ { 0, IT_GENERIC, AM_I | OT_B, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6B */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_I | OT_B, "imul", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6C */ { 0, IT_GENERIC, AM_Y | OT_B, AM_REGISTER | OT_B, AM_NOT_USED, "insb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6D */ { 0, IT_GENERIC, AM_Y | OT_V, AM_REGISTER | OT_V, AM_NOT_USED, "insd", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6E */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_X | OT_B, AM_NOT_USED, "outsb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6F */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_X | OT_V, AM_NOT_USED, "outsb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x70 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "jo", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x71 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "jno", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x72 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "jc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x73 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "jnc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x74 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "jz", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x75 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "jnz", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x76 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "jbe", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x77 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "ja", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x78 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "js", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x79 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "jns", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7A */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "jpe", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7B */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "jpo", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7C */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "jl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7D */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "jge", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7E */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "jle", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7F */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "jg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x80 */ { 2, IT_REFERENCE, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x81 */ { 3, IT_REFERENCE, AM_E | OT_V, AM_I | OT_V, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x82 */ { 4, IT_REFERENCE, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x83 */ { 5, IT_REFERENCE, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x84 */ { 0, IT_GENERIC, AM_E | OT_B, AM_G | OT_B, AM_NOT_USED, "test", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x85 */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_NOT_USED, "test", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x86 */ { 0, IT_GENERIC, AM_E | OT_B, AM_G | OT_B, AM_NOT_USED, "xchg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x87 */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_NOT_USED, "xchg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x88 */ { 0, IT_GENERIC, AM_E | OT_B, AM_G | OT_B, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x89 */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x8A */ { 0, IT_GENERIC, AM_G | OT_B, AM_E | OT_B, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x8B */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x8C */ { 0, IT_GENERIC, AM_E | OT_W, AM_S | OT_W, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x8D */ { 0, IT_GENERIC, AM_G | OT_V, AM_M | OT_ADDRESS_MODE_M, AM_NOT_USED, "lea", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x8E */ { 0, IT_GENERIC, AM_S | OT_W, AM_E | OT_W, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x8F */ { 0, IT_GENERIC, AM_E | OT_V, AM_NOT_USED, AM_NOT_USED, "pop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x90 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "nop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x91 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_REGISTER | OT_V, AM_NOT_USED, "xchg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x92 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_REGISTER | OT_V, AM_NOT_USED, "xchg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x93 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_REGISTER | OT_V, AM_NOT_USED, "xchg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x94 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_REGISTER | OT_V, AM_NOT_USED, "xchg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x95 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_REGISTER | OT_V, AM_NOT_USED, "xchg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x96 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_REGISTER | OT_V, AM_NOT_USED, "xchg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x97 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_REGISTER | OT_V, AM_NOT_USED, "xchg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x98 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "cwde", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x99 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "cdq", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x9A */ { 0, IT_JUMP, AM_A | OT_P, AM_NOT_USED, AM_NOT_USED, "callf", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x9B */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "wait", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x9C */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "pushfd", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x9D */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "popfd", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x9E */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "sahf", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x9F */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "lahf", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA0 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_O | OT_B, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA1 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_O | OT_V, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA2 */ { 0, IT_GENERIC, AM_O | OT_B, AM_REGISTER | OT_B, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA3 */ { 0, IT_GENERIC, AM_O | OT_V, AM_REGISTER | OT_V, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA4 */ { 0, IT_GENERIC, AM_X | OT_B, AM_Y | OT_B, AM_NOT_USED, "movsb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA5 */ { 0, IT_GENERIC, AM_X | OT_V, AM_Y | OT_V, AM_NOT_USED, "movsd", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA6 */ { 0, IT_GENERIC, AM_X | OT_B, AM_Y | OT_B, AM_NOT_USED, "cmpsb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA7 */ { 0, IT_GENERIC, AM_X | OT_V, AM_Y | OT_V, AM_NOT_USED, "cmpsd", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA8 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "test", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA9 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "test", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xAA */ { 0, IT_GENERIC, AM_Y | OT_B, AM_REGISTER | OT_B, AM_NOT_USED, "stosb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xAB */ { 0, IT_GENERIC, AM_Y | OT_V, AM_REGISTER | OT_V, AM_NOT_USED, "stosd", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xAC */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_X| OT_B, AM_NOT_USED, "lodsb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xAD */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_X| OT_V, AM_NOT_USED, "lodsd", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xAE */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_Y | OT_B, AM_NOT_USED, "scasb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xAF */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_Y | OT_V, AM_NOT_USED, "scasd", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB0 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB1 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB2 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB3 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB4 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB5 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB6 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB7 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB8 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB9 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xBA */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xBB */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xBC */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xBD */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xBE */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xBF */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_I | OT_V, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC0 */ { 6, IT_REFERENCE, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC1 */ { 7, IT_REFERENCE, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC2 */ { 0, IT_RETURN, AM_I | OT_W, AM_NOT_USED, AM_NOT_USED, "ret", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC3 */ { 0, IT_RETURN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "ret", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC4 */ { 0, IT_GENERIC, AM_G | OT_V, AM_M | OT_P, AM_NOT_USED, "les", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC5 */ { 0, IT_GENERIC, AM_G | OT_V, AM_M | OT_P, AM_NOT_USED, "lds", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC6 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC7 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_V, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC8 */ { 0, IT_GENERIC, AM_I | OT_W, AM_I | OT_B, AM_NOT_USED, "enter", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC9 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "leave", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xCA */ { 0, IT_RETURN, AM_I | OT_W, AM_NOT_USED, AM_NOT_USED, "retf", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xCB */ { 0, IT_RETURN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "retf", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xCC */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "int3", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xCD */ { 0, IT_GENERIC, AM_I | OT_B, AM_NOT_USED, AM_NOT_USED, "int", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xCE */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "into", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xCF */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "iret", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xD0 */ { 8, IT_REFERENCE, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xD1 */ { 9, IT_REFERENCE, AM_E | OT_V, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xD2 */ { 10, IT_REFERENCE, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xD3 */ { 11, IT_REFERENCE, AM_E | OT_V, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xD4 */ { 0, IT_GENERIC, AM_I | OT_B, AM_NOT_USED, AM_NOT_USED, "aam", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xD5 */ { 0, IT_GENERIC, AM_I | OT_B, AM_NOT_USED, AM_NOT_USED, "aad", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xD6 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xD7 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "xlat", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - - // The following 8 lines would be references to the FPU tables, but we currently - // do not support the FPU instructions in this disassembler. - - /* 0xD8 */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xD9 */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xDA */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xDB */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xDC */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xDD */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xDE */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xDF */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - - - /* 0xE0 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "loopnz", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xE1 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "loopz", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xE2 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "loop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xE3 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "jcxz", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xE4 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "in", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xE5 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_I | OT_B, AM_NOT_USED, "in", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xE6 */ { 0, IT_GENERIC, AM_I | OT_B, AM_REGISTER | OT_B, AM_NOT_USED, "out", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xE7 */ { 0, IT_GENERIC, AM_I | OT_B, AM_REGISTER | OT_B, AM_NOT_USED, "out", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xE8 */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "call", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xE9 */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "jmp", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xEA */ { 0, IT_JUMP, AM_A | OT_P, AM_NOT_USED, AM_NOT_USED, "jmp", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xEB */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "jmp", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xEC */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_REGISTER | OT_W, AM_NOT_USED, "in", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xED */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_REGISTER | OT_W, AM_NOT_USED, "in", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xEE */ { 0, IT_GENERIC, AM_REGISTER | OT_W, AM_REGISTER | OT_B, AM_NOT_USED, "out", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xEF */ { 0, IT_GENERIC, AM_REGISTER | OT_W, AM_REGISTER | OT_V, AM_NOT_USED, "out", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xF0 */ { 0, IT_PREFIX, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "lock:", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xF1 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xF2 */ { 0, IT_PREFIX, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "repne:", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xF3 */ { 0, IT_PREFIX, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "rep:", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xF4 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "hlt", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xF5 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "cmc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xF6 */ { 12, IT_REFERENCE, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xF7 */ { 13, IT_REFERENCE, AM_E | OT_V, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xF8 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "clc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xF9 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "stc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xFA */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "cli", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xFB */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "sti", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xFC */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "cld", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xFD */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "std", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xFE */ { 14, IT_REFERENCE, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xFF */ { 15, IT_REFERENCE, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_0f[] = { - /* 0x0 */ { 16, IT_REFERENCE, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 17, IT_REFERENCE, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_W, AM_NOT_USED, "lar", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_W, AM_NOT_USED, "lsl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "clts", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x8 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "invd", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x9 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "wbinvd", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "ud2", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xD */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xE */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xF */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x10 */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_NOT_USED, "movups", true, - /* F2h */ { 0, IT_GENERIC, AM_V | OT_SD, AM_W | OT_SD, AM_NOT_USED, "movsd" }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_SS, AM_W | OT_SS, AM_NOT_USED, "movss" }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_PD, AM_NOT_USED, "movupd" } }, - /* 0x11 */ { 0, IT_GENERIC, AM_W | OT_PS, AM_V | OT_PS, AM_NOT_USED, "movups", true, - /* F2h */ { 0, IT_GENERIC, AM_W | OT_SD, AM_V | OT_SD, AM_NOT_USED, "movsd" }, - /* F3h */ { 0, IT_GENERIC, AM_W | OT_SS, AM_V | OT_SS, AM_NOT_USED, "movss" }, - /* 66h */ { 0, IT_GENERIC, AM_W | OT_PD, AM_V | OT_PD, AM_NOT_USED, "movupd" } }, - /* 0x12 */ { 0, IT_GENERIC, AM_W | OT_Q, AM_V | OT_Q, AM_NOT_USED, "movlps", true, - /* F2h */ { 0, IT_GENERIC, AM_V | OT_Q, AM_V | OT_Q, AM_NOT_USED, "movhlps" }, // only one of ... - /* F3h */ { 0, IT_GENERIC, AM_V | OT_Q, AM_V | OT_Q, AM_NOT_USED, "movhlps" }, // ...these two is correct, Intel doesn't specify which - /* 66h */ { 0, IT_GENERIC, AM_V | OT_Q, AM_W | OT_S, AM_NOT_USED, "movlpd" } }, - /* 0x13 */ { 0, IT_GENERIC, AM_V | OT_Q, AM_W | OT_Q, AM_NOT_USED, "movlps", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_Q, AM_W | OT_Q, AM_NOT_USED, "movlpd" } }, - /* 0x14 */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_Q, AM_NOT_USED, "unpcklps", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_Q, AM_NOT_USED, "unpcklpd" } }, - /* 0x15 */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_Q, AM_NOT_USED, "unpckhps", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_Q, AM_NOT_USED, "unpckhpd" } }, - /* 0x16 */ { 0, IT_GENERIC, AM_V | OT_Q, AM_W | OT_Q, AM_NOT_USED, "movhps", true, - /* F2h */ { 0, IT_GENERIC, AM_V | OT_Q, AM_V | OT_Q, AM_NOT_USED, "movlhps" }, // only one of... - /* F3h */ { 0, IT_GENERIC, AM_V | OT_Q, AM_V | OT_Q, AM_NOT_USED, "movlhps" }, // ...these two is correct, Intel doesn't specify which - /* 66h */ { 0, IT_GENERIC, AM_V | OT_Q, AM_W | OT_Q, AM_NOT_USED, "movhpd" } }, - /* 0x17 */ { 0, IT_GENERIC, AM_W | OT_Q, AM_V | OT_Q, AM_NOT_USED, "movhps", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_W | OT_Q, AM_V | OT_Q, AM_NOT_USED, "movhpd" } }, - /* 0x18 */ { 18, IT_REFERENCE, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x19 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1A */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1B */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1C */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1D */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1E */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1F */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x20 */ { 0, IT_GENERIC, AM_R | OT_D, AM_C | OT_D, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x21 */ { 0, IT_GENERIC, AM_R | OT_D, AM_D | OT_D, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x22 */ { 0, IT_GENERIC, AM_C | OT_D, AM_R | OT_D, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x23 */ { 0, IT_GENERIC, AM_D | OT_D, AM_R | OT_D, AM_NOT_USED, "mov", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x24 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x25 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x26 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x27 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x28 */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_NOT_USED, "movaps", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_PD, AM_NOT_USED, "movapd" } }, - /* 0x29 */ { 0, IT_GENERIC, AM_W | OT_PS, AM_V | OT_PS, AM_NOT_USED, "movaps", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_W | OT_PD, AM_V | OT_PD, AM_NOT_USED, "movapd" } }, - /* 0x2A */ { 0, IT_GENERIC, AM_V | OT_PS, AM_Q | OT_Q, AM_NOT_USED, "cvtpi2ps", true, - /* F2h */ { 0, IT_GENERIC, AM_V | OT_SD, AM_E | OT_D, AM_NOT_USED, "cvtsi2sd" }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_SS, AM_E | OT_D, AM_NOT_USED, "cvtsi2ss" }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_Q | OT_DQ, AM_NOT_USED, "cvtpi2pd" } }, - /* 0x2B */ { 0, IT_GENERIC, AM_W | OT_PS, AM_V | OT_PS, AM_NOT_USED, "movntps", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_W | OT_PD, AM_V | OT_PD, AM_NOT_USED, "movntpd" } }, - /* 0x2C */ { 0, IT_GENERIC, AM_Q | OT_Q, AM_W | OT_PS, AM_NOT_USED, "cvttps2pi", true, - /* F2h */ { 0, IT_GENERIC, AM_G | OT_D, AM_W | OT_SD, AM_NOT_USED, "cvttsd2si" }, - /* F3h */ { 0, IT_GENERIC, AM_G | OT_D, AM_W | OT_SS, AM_NOT_USED, "cvttss2si" }, - /* 66h */ { 0, IT_GENERIC, AM_Q | OT_DQ, AM_W | OT_PD, AM_NOT_USED, "cvttpd2pi" } }, - /* 0x2D */ { 0, IT_GENERIC, AM_Q | OT_Q, AM_W | OT_PS, AM_NOT_USED, "cvtps2pi", true, - /* F2h */ { 0, IT_GENERIC, AM_G | OT_D, AM_W | OT_SD, AM_NOT_USED, "cvtsd2si" }, - /* F3h */ { 0, IT_GENERIC, AM_G | OT_D, AM_W | OT_SS, AM_NOT_USED, "cvtss2si" }, - /* 66h */ { 0, IT_GENERIC, AM_Q | OT_DQ, AM_W | OT_PD, AM_NOT_USED, "cvtpd2pi" } }, - /* 0x2E */ { 0, IT_GENERIC, AM_V | OT_SS, AM_W | OT_SS, AM_NOT_USED, "ucomiss", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_SD, AM_W | OT_SD, AM_NOT_USED, "ucomisd" } }, - /* 0x2F */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_SS, AM_NOT_USED, "comiss", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_SD, AM_W | OT_SD, AM_NOT_USED, "comisd" } }, - /* 0x30 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "wrmsr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x31 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "rdtsc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x32 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "rdmsr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x33 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "rdpmc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x34 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "sysenter", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x35 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "sysexit", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x36 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x37 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x38 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x39 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3A */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3B */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3C */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "movnti", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3D */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3E */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3F */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x40 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmovo", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x41 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmovno", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x42 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmovc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x43 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmovnc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x44 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmovz", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x45 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmovnz", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x46 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmovbe", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x47 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmova", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x48 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmovs", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x49 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmovns", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4A */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmovpe", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4B */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmovpo", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4C */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmovl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4D */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmovge", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4E */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmovle", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4F */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "cmovg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x50 */ { 0, IT_GENERIC, AM_E | OT_D, AM_V | OT_PS, AM_NOT_USED, "movmskps", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_E | OT_D, AM_V | OT_PD, AM_NOT_USED, "movmskpd" } }, - /* 0x51 */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_NOT_USED, "sqrtps", true, - /* F2h */ { 0, IT_GENERIC, AM_V | OT_SD, AM_W | OT_SD, AM_NOT_USED, "sqrtsd" }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_SS, AM_W | OT_SS, AM_NOT_USED, "sqrtss" }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_PD, AM_NOT_USED, "sqrtpd" } }, - /* 0x52 */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_NOT_USED, "rsqrtps", true, - /* F2h */ { 0 }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_SS, AM_W | OT_SS, AM_NOT_USED, "rsqrtss" }, - /* 66h */ { 0 } }, - /* 0x53 */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_NOT_USED, "rcpps", true, - /* F2h */ { 0 }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_SS, AM_W | OT_SS, AM_NOT_USED, "rcpss" }, - /* 66h */ { 0 } }, - /* 0x54 */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_NOT_USED, "andps", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_PD, AM_NOT_USED, "andpd" } }, - /* 0x55 */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_NOT_USED, "andnps", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_PD, AM_NOT_USED, "andnpd" } }, - /* 0x56 */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_NOT_USED, "orps", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_PD, AM_NOT_USED, "orpd" } }, - /* 0x57 */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_NOT_USED, "xorps", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_PD, AM_NOT_USED, "xorpd" } }, - /* 0x58 */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_NOT_USED, "addps", true, - /* F2h */ { 0, IT_GENERIC, AM_V | OT_SD, AM_W | OT_SD, AM_NOT_USED, "addsd" }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_SS, AM_W | OT_SS, AM_NOT_USED, "addss" }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_PD, AM_NOT_USED, "addpd" } }, - /* 0x59 */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_NOT_USED, "mulps", true, - /* F2h */ { 0, IT_GENERIC, AM_V | OT_SD, AM_W | OT_SD, AM_NOT_USED, "mulsd" }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_SS, AM_W | OT_SS, AM_NOT_USED, "mulss" }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_PD, AM_NOT_USED, "mulpd" } }, - /* 0x5A */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_PS, AM_NOT_USED, "cvtps2pd", true, - /* F2h */ { 0, IT_GENERIC, AM_V | OT_SD, AM_W | OT_SD, AM_NOT_USED, "cvtsd2ss" }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_SS, AM_W | OT_SS, AM_NOT_USED, "cvtss2sd" }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PD, AM_NOT_USED, "cvtpd2ps" } }, - /* 0x5B */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_DQ, AM_NOT_USED, "cvtdq2ps", true, - /* F2h */ { 0 }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_PS, AM_NOT_USED, "cvttps2dq" }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_PS, AM_NOT_USED, "cvtps2dq" } }, - /* 0x5C */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_NOT_USED, "subps", true, - /* F2h */ { 0, IT_GENERIC, AM_V | OT_SD, AM_W | OT_SD, AM_NOT_USED, "subsd" }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_SS, AM_W | OT_SS, AM_NOT_USED, "subss" }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_PD, AM_NOT_USED, "subpd" } }, - /* 0x5D */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_NOT_USED, "minps", true, - /* F2h */ { 0, IT_GENERIC, AM_V | OT_SD, AM_W | OT_SD, AM_NOT_USED, "minsd" }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_SS, AM_W | OT_SS, AM_NOT_USED, "minss" }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_PD, AM_NOT_USED, "minpd" } }, - /* 0x5E */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_NOT_USED, "divps", true, - /* F2h */ { 0, IT_GENERIC, AM_V | OT_SD, AM_W | OT_SD, AM_NOT_USED, "divsd" }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_SS, AM_W | OT_SS, AM_NOT_USED, "divss" }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_PD, AM_NOT_USED, "divpd" } }, - /* 0x5F */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_NOT_USED, "maxps", true, - /* F2h */ { 0, IT_GENERIC, AM_V | OT_SD, AM_W | OT_SD, AM_NOT_USED, "maxsd" }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_SS, AM_W | OT_SS, AM_NOT_USED, "maxss" }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_PD, AM_NOT_USED, "maxpd" } }, - /* 0x60 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_D, AM_NOT_USED, "punpcklbw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "punpcklbw" } }, - /* 0x61 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_D, AM_NOT_USED, "punpcklwd", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "punpcklwd" } }, - /* 0x62 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_D, AM_NOT_USED, "punpckldq", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "punpckldq" } }, - /* 0x63 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_D, AM_NOT_USED, "packsswb", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "packsswb" } }, - /* 0x64 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_D, AM_NOT_USED, "pcmpgtb", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pcmpgtb" } }, - /* 0x65 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_D, AM_NOT_USED, "pcmpgtw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pcmpgtw" } }, - /* 0x66 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_D, AM_NOT_USED, "pcmpgtd", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pcmpgtd" } }, - /* 0x67 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_D, AM_NOT_USED, "packuswb", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "packuswb" } }, - /* 0x68 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_D, AM_NOT_USED, "punpckhbw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_P | OT_DQ, AM_Q | OT_DQ, AM_NOT_USED, "punpckhbw" } }, - /* 0x69 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_D, AM_NOT_USED, "punpckhwd", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_P | OT_DQ, AM_Q | OT_DQ, AM_NOT_USED, "punpckhwd" } }, - /* 0x6A */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_D, AM_NOT_USED, "punpckhdq", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_P | OT_DQ, AM_Q | OT_DQ, AM_NOT_USED, "punpckhdq" } }, - /* 0x6B */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_D, AM_NOT_USED, "packssdw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_P | OT_DQ, AM_Q | OT_DQ, AM_NOT_USED, "packssdw" } }, - /* 0x6C */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "not used without prefix", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "punpcklqdq" } }, - /* 0x6D */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "not used without prefix", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "punpcklqdq" } }, - /* 0x6E */ { 0, IT_GENERIC, AM_P | OT_D, AM_E | OT_D, AM_NOT_USED, "movd", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_E | OT_D, AM_NOT_USED, "movd" } }, - /* 0x6F */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_D, AM_NOT_USED, "movq", true, - /* F2h */ { 0 }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "movdqu" }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "movdqa" } }, - /* 0x70 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_I | OT_B, "pshuf", true, - /* F2h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_I | OT_B, "pshuflw" }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_I | OT_B, "pshufhw" }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_I | OT_B, "pshufd" } }, - /* 0x71 */ { 19, IT_REFERENCE, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x72 */ { 20, IT_REFERENCE, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x73 */ { 21, IT_REFERENCE, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x74 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pcmpeqb", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pcmpeqb" } }, - /* 0x75 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pcmpeqw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pcmpeqw" } }, - /* 0x76 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pcmpeqd", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pcmpeqd" } }, - /* 0x77 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "emms", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - - // The following six opcodes are escapes into the MMX stuff, which this disassembler does not support. - /* 0x78 */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x79 */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7A */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7B */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7C */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7D */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - - /* 0x7E */ { 0, IT_GENERIC, AM_E | OT_D, AM_P | OT_D, AM_NOT_USED, "movd", true, - /* F2h */ { 0 }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_Q, AM_W | OT_Q, AM_NOT_USED, "movq" }, - /* 66h */ { 0, IT_GENERIC, AM_E | OT_D, AM_V | OT_DQ, AM_NOT_USED, "movd" } }, - /* 0x7F */ { 0, IT_GENERIC, AM_Q | OT_Q, AM_P | OT_Q, AM_NOT_USED, "movq", true, - /* F2h */ { 0 }, - /* F3h */ { 0, IT_GENERIC, AM_W | OT_DQ, AM_V | OT_DQ, AM_NOT_USED, "movdqu" }, - /* 66h */ { 0, IT_GENERIC, AM_W | OT_DQ, AM_V | OT_DQ, AM_NOT_USED, "movdqa" } }, - /* 0x80 */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "jo", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x81 */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "jno", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x82 */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "jc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x83 */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "jnc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x84 */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "jz", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x85 */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "jnz", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x86 */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "jbe", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x87 */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "ja", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x88 */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "js", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x89 */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "jns", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x8A */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "jpe", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x8B */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "jpo", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x8C */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "jl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x8D */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "jge", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x8E */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "jle", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x8F */ { 0, IT_JUMP, AM_J | OT_V, AM_NOT_USED, AM_NOT_USED, "jg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x90 */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "seto", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x91 */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "setno", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x92 */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "setc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x93 */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "setnc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x94 */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "setz", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x95 */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "setnz", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x96 */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "setbe", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x97 */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "seta", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x98 */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "sets", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x99 */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "setns", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x9A */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "setpe", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x9B */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "setpo", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x9C */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "setl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x9D */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "setge", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x9E */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "setle", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x9F */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "setg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA0 */ { 0, IT_GENERIC, AM_REGISTER | OT_W, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA1 */ { 0, IT_GENERIC, AM_REGISTER | OT_W, AM_NOT_USED, AM_NOT_USED, "pop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA2 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "cpuid", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA3 */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_NOT_USED, "bt", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA4 */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_I | OT_B, "shld", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA5 */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_I | OT_B | AM_REGISTER, "shld", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA6 */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA7 */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA8 */ { 0, IT_GENERIC, AM_REGISTER | OT_W, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xA9 */ { 0, IT_GENERIC, AM_REGISTER | OT_W, AM_NOT_USED, AM_NOT_USED, "pop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xAA */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "rsm", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xAB */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_NOT_USED, "bts", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xAC */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_I | OT_B, "shrd", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xAD */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_I | OT_B | AM_REGISTER, "shrd", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xAE */ { 22, IT_REFERENCE, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xAF */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "imul", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB0 */ { 0, IT_GENERIC, AM_E | OT_B, AM_G | OT_B, AM_NOT_USED, "cmpxchg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB1 */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_NOT_USED, "cmpxchg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB2 */ { 0, IT_GENERIC, AM_M | OT_P, AM_NOT_USED, AM_NOT_USED, "lss", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB3 */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_NOT_USED, "btr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB4 */ { 0, IT_GENERIC, AM_M | OT_P, AM_NOT_USED, AM_NOT_USED, "lfs", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB5 */ { 0, IT_GENERIC, AM_M | OT_P, AM_NOT_USED, AM_NOT_USED, "lgs", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB6 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_B, AM_NOT_USED, "movzx", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB7 */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_W, AM_NOT_USED, "movzx", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB8 */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xB9 */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "ud1", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xBA */ { 23, IT_REFERENCE, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xBB */ { 0, IT_GENERIC, AM_E | OT_V, AM_G | OT_V, AM_NOT_USED, "btc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xBC */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "bsf", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xBD */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_V, AM_NOT_USED, "bsr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xBE */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_B, AM_NOT_USED, "movsx", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xBF */ { 0, IT_GENERIC, AM_G | OT_V, AM_E | OT_W, AM_NOT_USED, "movsx", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC0 */ { 0, IT_GENERIC, AM_E | OT_B, AM_G | OT_B, AM_NOT_USED, "xadd", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC1 */ { 0, IT_GENERIC, AM_E | OT_V, AM_NOT_USED, AM_NOT_USED, "xadd", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC2 */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_I | OT_B, "cmpps", true, - /* F2h */ { 0, IT_GENERIC, AM_V | OT_SD, AM_W | OT_SD, AM_I | OT_B, "cmpsd" }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_SS, AM_W | OT_SS, AM_I | OT_B, "cmpss" }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_PD, AM_I | OT_B, "cmppd" } }, - /* 0xC3 */ { 0, IT_GENERIC, AM_E | OT_D, AM_G | OT_D, AM_NOT_USED, "movnti", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC4 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_E | OT_D, AM_I | OT_B, "pinsrw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_E | OT_D, AM_I | OT_B, "pinsrw" } }, - /* 0xC5 */ { 0, IT_GENERIC, AM_G | OT_D, AM_P | OT_Q, AM_I | OT_B, "pextrw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_G | OT_D, AM_V | OT_DQ, AM_I | OT_B, "pextrw" } }, - /* 0xC6 */ { 0, IT_GENERIC, AM_V | OT_PS, AM_W | OT_PS, AM_I | OT_B, "shufps", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_PD, AM_I | OT_B, "shufpd" } }, - /* 0xC7 */ { 24, IT_REFERENCE, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC8 */ { 0, IT_GENERIC, AM_REGISTER | OT_D, AM_NOT_USED, AM_NOT_USED, "bswap", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xC9 */ { 0, IT_GENERIC, AM_REGISTER | OT_D, AM_NOT_USED, AM_NOT_USED, "bswap", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xCA */ { 0, IT_GENERIC, AM_REGISTER | OT_D, AM_NOT_USED, AM_NOT_USED, "bswap", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xCB */ { 0, IT_GENERIC, AM_REGISTER | OT_D, AM_NOT_USED, AM_NOT_USED, "bswap", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xCC */ { 0, IT_GENERIC, AM_REGISTER | OT_D, AM_NOT_USED, AM_NOT_USED, "bswap", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xCD */ { 0, IT_GENERIC, AM_REGISTER | OT_D, AM_NOT_USED, AM_NOT_USED, "bswap", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xCE */ { 0, IT_GENERIC, AM_REGISTER | OT_D, AM_NOT_USED, AM_NOT_USED, "bswap", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xCF */ { 0, IT_GENERIC, AM_REGISTER | OT_D, AM_NOT_USED, AM_NOT_USED, "bswap", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xD0 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xD1 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "psrlw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "psrlw" } }, - /* 0xD2 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "psrld", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "psrld" } }, - /* 0xD3 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "psrlq", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "psrlq" } }, - /* 0xD4 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "paddq", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "paddq" } }, - /* 0xD5 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pmullw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pmullw" } }, - /* 0xD6 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "unused without prefix", true, - /* F2h */ { 0, IT_GENERIC, AM_P | OT_Q, AM_W | OT_Q, AM_NOT_USED, "movdq2q" }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_Q | OT_Q, AM_NOT_USED, "movq2dq" }, - /* 66h */ { 0, IT_GENERIC, AM_W | OT_Q, AM_V | OT_Q, AM_NOT_USED, "movq" } }, - /* 0xD7 */ { 0, IT_GENERIC, AM_G | OT_D, AM_P | OT_Q, AM_NOT_USED, "pmovmskb", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_G | OT_D, AM_V | OT_DQ, AM_NOT_USED, "pmovmskb" } }, - /* 0xD8 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "psubusb", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "psubusb" } }, - /* 0xD9 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "psubusw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "psubusw" } }, - /* 0xDA */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pminub", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pminub" } }, - /* 0xDB */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pand", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pand" } }, - /* 0xDC */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "paddusb", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "paddusb" } }, - /* 0xDD */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "paddusw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "paddusw" } }, - /* 0xDE */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pmaxub", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pmaxub" } }, - /* 0xDF */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pandn", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pandn" } }, - /* 0xE0 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pavgb", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pavgb" } }, - /* 0xE1 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "psraw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "psrqw" } }, - /* 0xE2 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "psrad", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "psrad" } }, - /* 0xE3 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pavgw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pavgw" } }, - /* 0xE4 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pmulhuw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pmulhuw" } }, - /* 0xE5 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pmulhuw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pmulhw" } }, - /* 0xE6 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "not used without prefix", true, - /* F2h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_PD, AM_NOT_USED, "cvtpd2dq" }, - /* F3h */ { 0, IT_GENERIC, AM_V | OT_PD, AM_W | OT_DQ, AM_NOT_USED, "cvtdq2pd" }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_PD, AM_NOT_USED, "cvttpd2dq" } }, - /* 0xE7 */ { 0, IT_GENERIC, AM_W | OT_Q, AM_V | OT_Q, AM_NOT_USED, "movntq", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_W | OT_DQ, AM_V | OT_DQ, AM_NOT_USED, "movntdq" } }, - /* 0xE8 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "psubsb", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "psubsb" } }, - /* 0xE9 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "psubsw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "psubsw" } }, - /* 0xEA */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pminsw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pminsw" } }, - /* 0xEB */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "por", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "por" } }, - /* 0xEC */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "paddsb", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "paddsb" } }, - /* 0xED */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "paddsw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "paddsw" } }, - /* 0xEE */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pmaxsw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pmaxsw" } }, - /* 0xEF */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pxor", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pxor" } }, - /* 0xF0 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0xF1 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "psllw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "psllw" } }, - /* 0xF2 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pslld", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pslld" } }, - /* 0xF3 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "psllq", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "psllq" } }, - /* 0xF4 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pmuludq", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pmuludq" } }, - /* 0xF5 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "pmaddwd", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pmaddwd" } }, - /* 0xF6 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "psadbw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "psadbw" } }, - /* 0xF7 */ { 0, IT_GENERIC, AM_P | OT_PI, AM_Q | OT_PI, AM_NOT_USED, "maskmovq", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "maskmovdqu" } }, - /* 0xF8 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "psubb", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "psubb" } }, - /* 0xF9 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "psubw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "psubw" } }, - /* 0xFA */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "psubd", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "psubd" } }, - /* 0xFB */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "psubq", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "psubq" } }, - /* 0xFC */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "paddb", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "paddb" } }, - /* 0xFD */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "paddw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "paddw" } }, - /* 0xFE */ { 0, IT_GENERIC, AM_P | OT_Q, AM_Q | OT_Q, AM_NOT_USED, "paddd", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "paddd" } }, - /* 0xFF */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_0f00[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_E | OT_W, AM_NOT_USED, AM_NOT_USED, "sldt", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_E | OT_W, AM_NOT_USED, AM_NOT_USED, "str", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_E | OT_W, AM_NOT_USED, AM_NOT_USED, "lldt", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_E | OT_W, AM_NOT_USED, AM_NOT_USED, "ltr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_E | OT_W, AM_NOT_USED, AM_NOT_USED, "verr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_GENERIC, AM_E | OT_W, AM_NOT_USED, AM_NOT_USED, "verw", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_0f01[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_M | OT_S, AM_NOT_USED, AM_NOT_USED, "sgdt", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_M | OT_S, AM_NOT_USED, AM_NOT_USED, "sidt", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_M | OT_S, AM_NOT_USED, AM_NOT_USED, "lgdt", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_M | OT_S, AM_NOT_USED, AM_NOT_USED, "lidt", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_E | OT_W, AM_NOT_USED, AM_NOT_USED, "smsw", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_E | OT_W, AM_NOT_USED, AM_NOT_USED, "lmsw", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_GENERIC, AM_M | OT_B, AM_NOT_USED, AM_NOT_USED, "invlpg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_0f18[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_M | OT_ADDRESS_MODE_M, AM_NOT_USED, AM_NOT_USED, "prefetch", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_REGISTER | OT_D, AM_NOT_USED, AM_NOT_USED, "prefetch", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_REGISTER | OT_D, AM_NOT_USED, AM_NOT_USED, "prefetch", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_REGISTER | OT_D, AM_NOT_USED, AM_NOT_USED, "prefetch", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_0f71[] = { - /* 0x0 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_I | OT_B, AM_NOT_USED, "psrlw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_P | OT_DQ, AM_I | OT_B, AM_NOT_USED, "psrlw" } }, - /* 0x3 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_I | OT_B, AM_NOT_USED, "psraw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_P | OT_DQ, AM_I | OT_B, AM_NOT_USED, "psraw" } }, - /* 0x5 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_I | OT_B, AM_NOT_USED, "psllw", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_P | OT_DQ, AM_I | OT_B, AM_NOT_USED, "psllw" } }, - /* 0x7 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_0f72[] = { - /* 0x0 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_I | OT_B, AM_NOT_USED, "psrld", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_W | OT_DQ, AM_I | OT_B, AM_NOT_USED, "psrld" } }, - /* 0x3 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_I | OT_B, AM_NOT_USED, "psrad", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_W | OT_DQ, AM_I | OT_B, AM_NOT_USED, "psrad" } }, - /* 0x5 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_I | OT_B, AM_NOT_USED, "pslld", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_W | OT_DQ, AM_I | OT_B, AM_NOT_USED, "pslld" } }, - /* 0x7 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_0f73[] = { - /* 0x0 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_I | OT_B, AM_NOT_USED, "psrlq", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_W | OT_DQ, AM_I | OT_B, AM_NOT_USED, "psrlq" } }, - /* 0x3 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_P | OT_Q, AM_I | OT_B, AM_NOT_USED, "psllq", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_W | OT_DQ, AM_I | OT_B, AM_NOT_USED, "psllq" } }, - /* 0x7 */ { 0, IT_GENERIC, AM_W | OT_DQ, AM_I | OT_B, AM_NOT_USED, "pslldq", true, - /* F2h */ { 0 }, - /* F3h */ { 0 }, - /* 66h */ { 0, IT_GENERIC, AM_W | OT_DQ, AM_I | OT_B, AM_NOT_USED, "pslldq" } }, -}; - -const Opcode s_opcode_byte_after_0fae[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "fxsave", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "fxrstor", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "ldmxcsr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "stmxcsr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "lfence", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "mfence", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "clflush/sfence", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, -}; - -const Opcode s_opcode_byte_after_0fba[] = { - /* 0x0 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "bt", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "bts", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "btr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "btc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_0fc7[] = { - /* 0x0 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_M | OT_Q, AM_NOT_USED, AM_NOT_USED, "cmpxch8b", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_80[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "add", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "or", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "adc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "sbb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "and", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "sub", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "xor", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "cmp", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_81[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_V, AM_NOT_USED, "add", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_V, AM_NOT_USED, "or", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_V, AM_NOT_USED, "adc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_V, AM_NOT_USED, "sbb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_V, AM_NOT_USED, "and", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_V, AM_NOT_USED, "sub", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_V, AM_NOT_USED, "xor", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_V, AM_NOT_USED, "cmp", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_82[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "add", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "or", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "adc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "sbb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "and", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "sub", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "xor", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "cmp", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_83[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "add", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "or", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "adc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "sbb", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "and", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "sub", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "xor", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "cmp", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_c0[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "rol", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "ror", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "rcl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "rcr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "shl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "shr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "sal", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "sar", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_c1[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "rol", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "ror", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "rcl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "rcr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "shl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "shr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "sal", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_B, AM_NOT_USED, "sar", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_d0[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_E | OT_B, AM_IMPLICIT, AM_NOT_USED, "rol", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_E | OT_B, AM_IMPLICIT, AM_NOT_USED, "ror", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_E | OT_B, AM_IMPLICIT, AM_NOT_USED, "rcl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_E | OT_B, AM_IMPLICIT, AM_NOT_USED, "rcr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_E | OT_B, AM_IMPLICIT, AM_NOT_USED, "shl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_GENERIC, AM_E | OT_B, AM_IMPLICIT, AM_NOT_USED, "shr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_E | OT_B, AM_IMPLICIT, AM_NOT_USED, "sal", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_GENERIC, AM_E | OT_B, AM_IMPLICIT, AM_NOT_USED, "sar", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_d1[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_E | OT_V, AM_IMPLICIT, AM_NOT_USED, "rol", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_E | OT_V, AM_IMPLICIT, AM_NOT_USED, "ror", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_E | OT_V, AM_IMPLICIT, AM_NOT_USED, "rcl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_E | OT_V, AM_IMPLICIT, AM_NOT_USED, "rcr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_E | OT_V, AM_IMPLICIT, AM_NOT_USED, "shl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_GENERIC, AM_E | OT_V, AM_IMPLICIT, AM_NOT_USED, "shr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_E | OT_V, AM_IMPLICIT, AM_NOT_USED, "sal", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_GENERIC, AM_E | OT_V, AM_IMPLICIT, AM_NOT_USED, "sar", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_d2[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_E | OT_B, AM_REGISTER | OT_B, AM_NOT_USED, "rol", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_E | OT_B, AM_REGISTER | OT_B, AM_NOT_USED, "ror", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_E | OT_B, AM_REGISTER | OT_B, AM_NOT_USED, "rcl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_E | OT_B, AM_REGISTER | OT_B, AM_NOT_USED, "rcr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_E | OT_B, AM_REGISTER | OT_B, AM_NOT_USED, "shl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_GENERIC, AM_E | OT_B, AM_REGISTER | OT_B, AM_NOT_USED, "shr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_E | OT_B, AM_REGISTER | OT_B, AM_NOT_USED, "sal", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_GENERIC, AM_E | OT_B, AM_REGISTER | OT_B, AM_NOT_USED, "sar", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_d3[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_E | OT_V, AM_REGISTER | OT_B, AM_NOT_USED, "rol", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_E | OT_V, AM_REGISTER | OT_B, AM_NOT_USED, "ror", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_E | OT_V, AM_REGISTER | OT_B, AM_NOT_USED, "rcl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_E | OT_V, AM_REGISTER | OT_B, AM_NOT_USED, "rcr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_E | OT_V, AM_REGISTER | OT_B, AM_NOT_USED, "shl", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_GENERIC, AM_E | OT_V, AM_REGISTER | OT_B, AM_NOT_USED, "shr", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_E | OT_V, AM_REGISTER | OT_B, AM_NOT_USED, "sal", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_GENERIC, AM_E | OT_V, AM_REGISTER | OT_B, AM_NOT_USED, "sar", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_f6[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "test", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_E | OT_B, AM_I | OT_B, AM_NOT_USED, "test", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "not", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "neg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, OT_B | AM_REGISTER, AM_E | OT_B, AM_NOT_USED, "mul", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_GENERIC, OT_B | AM_REGISTER, AM_E | OT_B, AM_NOT_USED, "imul", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_E | OT_B, AM_NOT_USED, "div", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_GENERIC, AM_REGISTER | OT_B, AM_E | OT_B, AM_NOT_USED, "idiv", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_f7[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_V, AM_NOT_USED, "test", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_E | OT_V, AM_I | OT_V, AM_NOT_USED, "test", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_GENERIC, AM_E | OT_V, AM_NOT_USED, AM_NOT_USED, "not", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_GENERIC, AM_E | OT_V, AM_NOT_USED, AM_NOT_USED, "neg", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_E | OT_V, AM_NOT_USED, "mul", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_E | OT_V, AM_NOT_USED, "imul", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_E | OT_V, AM_NOT_USED, "div", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_GENERIC, AM_REGISTER | OT_V, AM_E | OT_V, AM_NOT_USED, "idiv", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_fe[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "inc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_E | OT_B, AM_NOT_USED, AM_NOT_USED, "dec", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -const Opcode s_opcode_byte_after_ff[] = { - /* 0x0 */ { 0, IT_GENERIC, AM_E | OT_V, AM_NOT_USED, AM_NOT_USED, "inc", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x1 */ { 0, IT_GENERIC, AM_E | OT_V, AM_NOT_USED, AM_NOT_USED, "dec", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x2 */ { 0, IT_JUMP, AM_E | OT_V, AM_NOT_USED, AM_NOT_USED, "call", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x3 */ { 0, IT_JUMP, AM_E | OT_P, AM_NOT_USED, AM_NOT_USED, "call", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x4 */ { 0, IT_JUMP, AM_E | OT_V, AM_NOT_USED, AM_NOT_USED, "jmp", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x5 */ { 0, IT_JUMP, AM_E | OT_P, AM_NOT_USED, AM_NOT_USED, "jmp", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x6 */ { 0, IT_GENERIC, AM_E | OT_V, AM_NOT_USED, AM_NOT_USED, "push", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } }, - /* 0x7 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } } -}; - -/* -* A table of all the other tables, containing some extra information, e.g. -* how to mask out the byte we're looking at. -*/ -const OpcodeTable MiniDisassembler::s_ia32_opcode_map_[]={ - // One-byte opcodes and jumps to larger - /* 0 */ {s_first_opcode_byte, 0, 0xff, 0, 0xff}, - // Two-byte opcodes (second byte) - /* 1 */ {s_opcode_byte_after_0f, 0, 0xff, 0, 0xff}, - // Start of tables for opcodes using ModR/M bits as extension - /* 2 */ {s_opcode_byte_after_80, 3, 0x07, 0, 0x07}, - /* 3 */ {s_opcode_byte_after_81, 3, 0x07, 0, 0x07}, - /* 4 */ {s_opcode_byte_after_82, 3, 0x07, 0, 0x07}, - /* 5 */ {s_opcode_byte_after_83, 3, 0x07, 0, 0x07}, - /* 6 */ {s_opcode_byte_after_c0, 3, 0x07, 0, 0x07}, - /* 7 */ {s_opcode_byte_after_c1, 3, 0x07, 0, 0x07}, - /* 8 */ {s_opcode_byte_after_d0, 3, 0x07, 0, 0x07}, - /* 9 */ {s_opcode_byte_after_d1, 3, 0x07, 0, 0x07}, - /* 10 */ {s_opcode_byte_after_d2, 3, 0x07, 0, 0x07}, - /* 11 */ {s_opcode_byte_after_d3, 3, 0x07, 0, 0x07}, - /* 12 */ {s_opcode_byte_after_f6, 3, 0x07, 0, 0x07}, - /* 13 */ {s_opcode_byte_after_f7, 3, 0x07, 0, 0x07}, - /* 14 */ {s_opcode_byte_after_fe, 3, 0x07, 0, 0x01}, - /* 15 */ {s_opcode_byte_after_ff, 3, 0x07, 0, 0x07}, - /* 16 */ {s_opcode_byte_after_0f00, 3, 0x07, 0, 0x07}, - /* 17 */ {s_opcode_byte_after_0f01, 3, 0x07, 0, 0x07}, - /* 18 */ {s_opcode_byte_after_0f18, 3, 0x07, 0, 0x07}, - /* 19 */ {s_opcode_byte_after_0f71, 3, 0x07, 0, 0x07}, - /* 20 */ {s_opcode_byte_after_0f72, 3, 0x07, 0, 0x07}, - /* 21 */ {s_opcode_byte_after_0f73, 3, 0x07, 0, 0x07}, - /* 22 */ {s_opcode_byte_after_0fae, 3, 0x07, 0, 0x07}, - /* 23 */ {s_opcode_byte_after_0fba, 3, 0x07, 0, 0x07}, - /* 24 */ {s_opcode_byte_after_0fc7, 3, 0x07, 0, 0x01} -}; - -}; // namespace sidestep diff --git a/tools/memory_watcher/memory_hook.cc b/tools/memory_watcher/memory_hook.cc deleted file mode 100644 index 64df93d204..0000000000 --- a/tools/memory_watcher/memory_hook.cc +++ /dev/null @@ -1,562 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Static class for hooking Win32 API routines. - -// Some notes about how to hook Memory Allocation Routines in Windows. -// -// For our purposes we do not hook the libc routines. There are two -// reasons for this. First, the libc routines all go through HeapAlloc -// anyway. So, it's redundant to log both HeapAlloc and malloc. -// Second, it can be tricky to hook in both static and dynamic linkages -// of libc. - -#include <windows.h> - -#include "memory_hook.h" -#include "memory_watcher.h" -#include "preamble_patcher.h" - -// Calls GetProcAddress, but casts to the correct type. -#define GET_PROC_ADDRESS(hmodule, name) \ - ( (Type_##name)(::GetProcAddress(hmodule, #name)) ) - -// Macro to declare Patch functions. -#define DECLARE_PATCH(name) Patch<Type_##name> patch_##name - -// Macro to install Patch functions. -#define INSTALL_PATCH(name) do { \ - patch_##name.set_original(GET_PROC_ADDRESS(hkernel32, ##name)); \ - patch_##name.Install(&Perftools_##name); \ -} while (0) - -// Macro to install Patch functions. -#define INSTALL_NTDLLPATCH(name) do { \ - patch_##name.set_original(GET_PROC_ADDRESS(hntdll, ##name)); \ - patch_##name.Install(&Perftools_##name); \ -} while (0) - -// Macro to uninstall Patch functions. -#define UNINSTALL_PATCH(name) patch_##name.Uninstall(); - - - -// Windows APIs to be hooked - -// HeapAlloc routines -typedef HANDLE (WINAPI *Type_HeapCreate)(DWORD flOptions, - SIZE_T dwInitialSize, - SIZE_T dwMaximumSize); -typedef BOOL (WINAPI *Type_HeapDestroy)(HANDLE hHeap); -typedef LPVOID (WINAPI *Type_HeapAlloc)(HANDLE hHeap, DWORD dwFlags, - DWORD_PTR dwBytes); -typedef LPVOID (WINAPI *Type_HeapReAlloc)(HANDLE hHeap, DWORD dwFlags, - LPVOID lpMem, SIZE_T dwBytes); -typedef BOOL (WINAPI *Type_HeapFree)(HANDLE hHeap, DWORD dwFlags, - LPVOID lpMem); - -// GlobalAlloc routines -typedef HGLOBAL (WINAPI *Type_GlobalAlloc)(UINT uFlags, SIZE_T dwBytes); -typedef HGLOBAL (WINAPI *Type_GlobalReAlloc)(HGLOBAL hMem, SIZE_T dwBytes, - UINT uFlags); -typedef HGLOBAL (WINAPI *Type_GlobalFree)(HGLOBAL hMem); - -// LocalAlloc routines -typedef HLOCAL (WINAPI *Type_LocalAlloc)(UINT uFlags, SIZE_T uBytes); -typedef HLOCAL (WINAPI *Type_LocalReAlloc)(HLOCAL hMem, SIZE_T uBytes, - UINT uFlags); -typedef HLOCAL (WINAPI *Type_LocalFree)(HLOCAL hMem); - -// A Windows-API equivalent of mmap and munmap, for "anonymous regions" -typedef LPVOID (WINAPI *Type_VirtualAllocEx)(HANDLE process, LPVOID address, - SIZE_T size, DWORD type, - DWORD protect); -typedef BOOL (WINAPI *Type_VirtualFreeEx)(HANDLE process, LPVOID address, - SIZE_T size, DWORD type); - -// A Windows-API equivalent of mmap and munmap, for actual files -typedef LPVOID (WINAPI *Type_MapViewOfFile)(HANDLE hFileMappingObject, - DWORD dwDesiredAccess, - DWORD dwFileOffsetHigh, - DWORD dwFileOffsetLow, - SIZE_T dwNumberOfBytesToMap); -typedef LPVOID (WINAPI *Type_MapViewOfFileEx)(HANDLE hFileMappingObject, - DWORD dwDesiredAccess, - DWORD dwFileOffsetHigh, - DWORD dwFileOffsetLow, - SIZE_T dwNumberOfBytesToMap, - LPVOID lpBaseAddress); -typedef BOOL (WINAPI *Type_UnmapViewOfFile)(LPVOID lpBaseAddress); - -typedef DWORD (WINAPI *Type_NtUnmapViewOfSection)(HANDLE process, - LPVOID lpBaseAddress); - - -// Patch is a template for keeping the pointer to the original -// hooked routine, the function to call when hooked, and the -// stub routine which is patched. -template<class T> -class Patch { - public: - // Constructor. Does not hook the function yet. - Patch<T>() - : original_function_(NULL), - patch_function_(NULL), - stub_function_(NULL) { - } - - // Destructor. Unhooks the function if it has been hooked. - ~Patch<T>() { - Uninstall(); - } - - // Patches original function with func. - // Must have called set_original to set the original function. - void Install(T func) { - patch_function_ = func; - CHECK(patch_function_ != NULL); - CHECK(original_function_ != NULL); - CHECK(stub_function_ == NULL); - CHECK(sidestep::SIDESTEP_SUCCESS == - sidestep::PreamblePatcher::Patch(original_function_, - patch_function_, &stub_function_)); - } - - // Un-patches the function. - void Uninstall() { - if (stub_function_) - sidestep::PreamblePatcher::Unpatch(original_function_, - patch_function_, stub_function_); - stub_function_ = NULL; - } - - // Set the function to be patched. - void set_original(T original) { original_function_ = original; } - - // Get the original function being patched. - T original() { return original_function_; } - - // Get the patched function. (e.g. the replacement function) - T patched() { return patch_function_; } - - // Access to the stub for calling the original function - // while it is patched. - T operator()() { - DCHECK(stub_function_); - return stub_function_; - } - - private: - // The function that we plan to patch. - T original_function_; - // The function to replace the original with. - T patch_function_; - // To unpatch, we also need to keep around a "stub" that points to the - // pre-patched Windows function. - T stub_function_; -}; - - -// All Windows memory-allocation routines call through to one of these. -DECLARE_PATCH(HeapCreate); -DECLARE_PATCH(HeapDestroy); -DECLARE_PATCH(HeapAlloc); -DECLARE_PATCH(HeapReAlloc); -DECLARE_PATCH(HeapFree); -DECLARE_PATCH(VirtualAllocEx); -DECLARE_PATCH(VirtualFreeEx); -DECLARE_PATCH(MapViewOfFile); -DECLARE_PATCH(MapViewOfFileEx); -DECLARE_PATCH(UnmapViewOfFile); -DECLARE_PATCH(GlobalAlloc); -DECLARE_PATCH(GlobalReAlloc); -DECLARE_PATCH(GlobalFree); -DECLARE_PATCH(LocalAlloc); -DECLARE_PATCH(LocalReAlloc); -DECLARE_PATCH(LocalFree); -DECLARE_PATCH(NtUnmapViewOfSection); - -// Our replacement functions. - -static HANDLE WINAPI Perftools_HeapCreate(DWORD flOptions, - SIZE_T dwInitialSize, - SIZE_T dwMaximumSize) { - if (dwInitialSize > 4096) - dwInitialSize = 4096; - return patch_HeapCreate()(flOptions, dwInitialSize, dwMaximumSize); -} - -static BOOL WINAPI Perftools_HeapDestroy(HANDLE hHeap) { - return patch_HeapDestroy()(hHeap); -} - -static LPVOID WINAPI Perftools_HeapAlloc(HANDLE hHeap, DWORD dwFlags, - DWORD_PTR dwBytes) { - LPVOID rv = patch_HeapAlloc()(hHeap, dwFlags, dwBytes); - MemoryHook::hook()->OnTrack(hHeap, reinterpret_cast<int32>(rv), dwBytes); - return rv; -} - -static BOOL WINAPI Perftools_HeapFree(HANDLE hHeap, DWORD dwFlags, - LPVOID lpMem) { - size_t size = 0; - if (lpMem != 0) { - size = HeapSize(hHeap, 0, lpMem); // Will crash if lpMem is 0. - // Note: size could be 0; HeapAlloc does allocate 0 length buffers. - } - MemoryHook::hook()->OnUntrack(hHeap, reinterpret_cast<int32>(lpMem), size); - return patch_HeapFree()(hHeap, dwFlags, lpMem); -} - -static LPVOID WINAPI Perftools_HeapReAlloc(HANDLE hHeap, DWORD dwFlags, - LPVOID lpMem, SIZE_T dwBytes) { - // Don't call realloc, but instead do a free/malloc. The problem is that - // the builtin realloc may either expand a buffer, or it may simply - // just call free/malloc. If so, we will already have tracked the new - // block via Perftools_HeapAlloc. - - LPVOID rv = Perftools_HeapAlloc(hHeap, dwFlags, dwBytes); - DCHECK_EQ((HEAP_REALLOC_IN_PLACE_ONLY & dwFlags), 0u); - - // If there was an old buffer, now copy the data to the new buffer. - if (lpMem != 0) { - size_t size = HeapSize(hHeap, 0, lpMem); - if (size > dwBytes) - size = dwBytes; - // Note: size could be 0; HeapAlloc does allocate 0 length buffers. - memcpy(rv, lpMem, size); - Perftools_HeapFree(hHeap, dwFlags, lpMem); - } - return rv; -} - -static LPVOID WINAPI Perftools_VirtualAllocEx(HANDLE process, LPVOID address, - SIZE_T size, DWORD type, - DWORD protect) { - bool already_committed = false; - if (address != NULL) { - MEMORY_BASIC_INFORMATION info; - CHECK(VirtualQuery(address, &info, sizeof(info))); - if (info.State & MEM_COMMIT) { - already_committed = true; - CHECK(size >= info.RegionSize); - } - } - bool reserving = (address == NULL) || (type & MEM_RESERVE); - bool committing = !already_committed && (type & MEM_COMMIT); - - - LPVOID result = patch_VirtualAllocEx()(process, address, size, type, - protect); - MEMORY_BASIC_INFORMATION info; - CHECK(VirtualQuery(result, &info, sizeof(info))); - size = info.RegionSize; - - if (committing) - MemoryHook::hook()->OnTrack(0, reinterpret_cast<int32>(result), size); - - return result; -} - -static BOOL WINAPI Perftools_VirtualFreeEx(HANDLE process, LPVOID address, - SIZE_T size, DWORD type) { - int chunk_size = size; - MEMORY_BASIC_INFORMATION info; - CHECK(VirtualQuery(address, &info, sizeof(info))); - if (chunk_size == 0) - chunk_size = info.RegionSize; - bool decommit = (info.State & MEM_COMMIT) != 0; - - if (decommit) - MemoryHook::hook()->OnUntrack(0, reinterpret_cast<int32>(address), - chunk_size); - - return patch_VirtualFreeEx()(process, address, size, type); -} - -static base::Lock known_maps_lock; -static std::map<void*, int> known_maps; - -static LPVOID WINAPI Perftools_MapViewOfFileEx(HANDLE hFileMappingObject, - DWORD dwDesiredAccess, - DWORD dwFileOffsetHigh, - DWORD dwFileOffsetLow, - SIZE_T dwNumberOfBytesToMap, - LPVOID lpBaseAddress) { - // For this function pair, you always deallocate the full block of - // data that you allocate, so NewHook/DeleteHook is the right API. - LPVOID result = patch_MapViewOfFileEx()(hFileMappingObject, dwDesiredAccess, - dwFileOffsetHigh, dwFileOffsetLow, - dwNumberOfBytesToMap, lpBaseAddress); - { - base::AutoLock lock(known_maps_lock); - MEMORY_BASIC_INFORMATION info; - if (known_maps.find(result) == known_maps.end()) { - CHECK(VirtualQuery(result, &info, sizeof(info))); - // TODO(mbelshe): THIS map uses the standard heap!!!! - known_maps[result] = 1; - MemoryHook::hook()->OnTrack(0, reinterpret_cast<int32>(result), - info.RegionSize); - } else { - known_maps[result] = known_maps[result] + 1; - } - } - return result; -} - -static LPVOID WINAPI Perftools_MapViewOfFile(HANDLE hFileMappingObject, - DWORD dwDesiredAccess, - DWORD dwFileOffsetHigh, - DWORD dwFileOffsetLow, - SIZE_T dwNumberOfBytesToMap) { - return Perftools_MapViewOfFileEx(hFileMappingObject, dwDesiredAccess, - dwFileOffsetHigh, dwFileOffsetLow, - dwNumberOfBytesToMap, 0); -} - -static BOOL WINAPI Perftools_UnmapViewOfFile(LPVOID lpBaseAddress) { - // This will call into NtUnmapViewOfSection(). - return patch_UnmapViewOfFile()(lpBaseAddress); -} - -static DWORD WINAPI Perftools_NtUnmapViewOfSection(HANDLE process, - LPVOID lpBaseAddress) { - // Some windows APIs call directly into this routine rather - // than calling UnmapViewOfFile. If we didn't trap this function, - // then we appear to have bogus leaks. - { - base::AutoLock lock(known_maps_lock); - MEMORY_BASIC_INFORMATION info; - CHECK(VirtualQuery(lpBaseAddress, &info, sizeof(info))); - if (known_maps.find(lpBaseAddress) != known_maps.end()) { - if (known_maps[lpBaseAddress] == 1) { - MemoryHook::hook()->OnUntrack(0, reinterpret_cast<int32>(lpBaseAddress), - info.RegionSize); - known_maps.erase(lpBaseAddress); - } else { - known_maps[lpBaseAddress] = known_maps[lpBaseAddress] - 1; - } - } - } - return patch_NtUnmapViewOfSection()(process, lpBaseAddress); -} - -static HGLOBAL WINAPI Perftools_GlobalAlloc(UINT uFlags, SIZE_T dwBytes) { - // GlobalAlloc is built atop HeapAlloc anyway. So we don't track these. - // GlobalAlloc will internally call into HeapAlloc and we track there. - - // Force all memory to be fixed. - uFlags &= ~GMEM_MOVEABLE; - HGLOBAL rv = patch_GlobalAlloc()(uFlags, dwBytes); - return rv; -} - -static HGLOBAL WINAPI Perftools_GlobalFree(HGLOBAL hMem) { - return patch_GlobalFree()(hMem); -} - -static HGLOBAL WINAPI Perftools_GlobalReAlloc(HGLOBAL hMem, SIZE_T dwBytes, - UINT uFlags) { - // TODO(jar): [The following looks like a copy/paste typo from LocalRealloc.] - // GlobalDiscard is a macro which calls LocalReAlloc with size 0. - if (dwBytes == 0) { - return patch_GlobalReAlloc()(hMem, dwBytes, uFlags); - } - - HGLOBAL rv = Perftools_GlobalAlloc(uFlags, dwBytes); - if (hMem != 0) { - size_t size = GlobalSize(hMem); - if (size > dwBytes) - size = dwBytes; - // Note: size could be 0; HeapAlloc does allocate 0 length buffers. - memcpy(rv, hMem, size); - Perftools_GlobalFree(hMem); - } - - return rv; -} - -static HLOCAL WINAPI Perftools_LocalAlloc(UINT uFlags, SIZE_T dwBytes) { - // LocalAlloc is built atop HeapAlloc anyway. So we don't track these. - // LocalAlloc will internally call into HeapAlloc and we track there. - - // Force all memory to be fixed. - uFlags &= ~LMEM_MOVEABLE; - HLOCAL rv = patch_LocalAlloc()(uFlags, dwBytes); - return rv; -} - -static HLOCAL WINAPI Perftools_LocalFree(HLOCAL hMem) { - return patch_LocalFree()(hMem); -} - -static HLOCAL WINAPI Perftools_LocalReAlloc(HLOCAL hMem, SIZE_T dwBytes, - UINT uFlags) { - // LocalDiscard is a macro which calls LocalReAlloc with size 0. - if (dwBytes == 0) { - return patch_LocalReAlloc()(hMem, dwBytes, uFlags); - } - - HGLOBAL rv = Perftools_LocalAlloc(uFlags, dwBytes); - if (hMem != 0) { - size_t size = LocalSize(hMem); - if (size > dwBytes) - size = dwBytes; - // Note: size could be 0; HeapAlloc does allocate 0 length buffers. - memcpy(rv, hMem, size); - Perftools_LocalFree(hMem); - } - - return rv; -} - -bool MemoryHook::hooked_ = false; -MemoryHook* MemoryHook::global_hook_ = NULL; - -MemoryHook::MemoryHook() - : watcher_(NULL), - heap_(NULL) { - CreateHeap(); -} - -MemoryHook::~MemoryHook() { - // It's a bit dangerous to ever close this heap; MemoryWatchers may have - // used this heap for their tracking data. Closing the heap while any - // MemoryWatchers still exist is pretty dangerous. - CloseHeap(); -} - -bool MemoryHook::Initialize() { - if (global_hook_ == NULL) - global_hook_ = new MemoryHook(); - return true; -} - -bool MemoryHook::Hook() { - DCHECK(!hooked_); - if (!hooked_) { - DCHECK(global_hook_); - - // Luckily, Patch() doesn't call malloc or windows alloc routines - // itself -- though it does call new (we can use PatchWithStub to - // get around that, and will need to if we need to patch new). - - HMODULE hkernel32 = ::GetModuleHandle(L"kernel32"); - CHECK(hkernel32 != NULL); - - HMODULE hntdll = ::GetModuleHandle(L"ntdll"); - CHECK(hntdll != NULL); - - // Now that we've found all the functions, patch them - INSTALL_PATCH(HeapCreate); - INSTALL_PATCH(HeapDestroy); - INSTALL_PATCH(HeapAlloc); - INSTALL_PATCH(HeapReAlloc); - INSTALL_PATCH(HeapFree); - INSTALL_PATCH(VirtualAllocEx); - INSTALL_PATCH(VirtualFreeEx); - INSTALL_PATCH(MapViewOfFileEx); - INSTALL_PATCH(MapViewOfFile); - INSTALL_PATCH(UnmapViewOfFile); - INSTALL_NTDLLPATCH(NtUnmapViewOfSection); - INSTALL_PATCH(GlobalAlloc); - INSTALL_PATCH(GlobalReAlloc); - INSTALL_PATCH(GlobalFree); - INSTALL_PATCH(LocalAlloc); - INSTALL_PATCH(LocalReAlloc); - INSTALL_PATCH(LocalFree); - - // We are finally completely hooked. - hooked_ = true; - } - return true; -} - -bool MemoryHook::Unhook() { - if (hooked_) { - // We need to go back to the system malloc/etc at global destruct time, - // so objects that were constructed before tcmalloc, using the system - // malloc, can destroy themselves using the system free. This depends - // on DLLs unloading in the reverse order in which they load! - // - // We also go back to the default HeapAlloc/etc, just for consistency. - // Who knows, it may help avoid weird bugs in some situations. - UNINSTALL_PATCH(HeapCreate); - UNINSTALL_PATCH(HeapDestroy); - UNINSTALL_PATCH(HeapAlloc); - UNINSTALL_PATCH(HeapReAlloc); - UNINSTALL_PATCH(HeapFree); - UNINSTALL_PATCH(VirtualAllocEx); - UNINSTALL_PATCH(VirtualFreeEx); - UNINSTALL_PATCH(MapViewOfFile); - UNINSTALL_PATCH(MapViewOfFileEx); - UNINSTALL_PATCH(UnmapViewOfFile); - UNINSTALL_PATCH(NtUnmapViewOfSection); - UNINSTALL_PATCH(GlobalAlloc); - UNINSTALL_PATCH(GlobalReAlloc); - UNINSTALL_PATCH(GlobalFree); - UNINSTALL_PATCH(LocalAlloc); - UNINSTALL_PATCH(LocalReAlloc); - UNINSTALL_PATCH(LocalFree); - - hooked_ = false; - } - return true; -} - -bool MemoryHook::RegisterWatcher(MemoryObserver* watcher) { - DCHECK(global_hook_->watcher_ == NULL); - - if (!hooked_) - Hook(); - - DCHECK(global_hook_); - global_hook_->watcher_ = watcher; - return true; -} - -bool MemoryHook::UnregisterWatcher(MemoryObserver* watcher) { - DCHECK(hooked_); - DCHECK(global_hook_->watcher_ == watcher); - // TODO(jar): changing watcher_ here is very racy. Other threads may (without - // a lock) testing, and then calling through this value. We probably can't - // remove this until we are single threaded. - global_hook_->watcher_ = NULL; - - // For now, since there are no more watchers, unhook memory. - return Unhook(); -} - -bool MemoryHook::CreateHeap() { - // Create a heap for our own memory. - DCHECK(heap_ == NULL); - heap_ = HeapCreate(0, 0, 0); - DCHECK(heap_ != NULL); - return heap_ != NULL; -} - -bool MemoryHook::CloseHeap() { - DCHECK(heap_ != NULL); - HeapDestroy(heap_); - heap_ = NULL; - return true; -} - -void MemoryHook::OnTrack(HANDLE heap, int32 id, int32 size) { - // Don't notify about allocations to our internal heap. - if (heap == heap_) - return; - - if (watcher_) - watcher_->OnTrack(heap, id, size); -} - -void MemoryHook::OnUntrack(HANDLE heap, int32 id, int32 size) { - // Don't notify about allocations to our internal heap. - if (heap == heap_) - return; - - if (watcher_) - watcher_->OnUntrack(heap, id, size); -} diff --git a/tools/memory_watcher/memory_hook.h b/tools/memory_watcher/memory_hook.h deleted file mode 100644 index 4227edb7ca..0000000000 --- a/tools/memory_watcher/memory_hook.h +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// Static class for hooking Win32 API routines. For now, -// we only add one watcher at a time. -// -// TODO(mbelshe): Support multiple watchers. - -#ifndef MEMORY_WATCHER_MEMORY_HOOK_ -#define MEMORY_WATCHER_MEMORY_HOOK_ - -#include "base/logging.h" - -// When allocating memory for internal use with the MemoryHook, -// we must always use the MemoryHook's heap; otherwise, the memory -// gets tracked, and it becomes an infinite loop (allocation() calls -// MemoryHook() which calls allocation(), etc). -// -// PrivateHookAllocator is an STL-friendly Allocator so that STL lists, -// maps, etc can be used on the global MemoryHook's heap. -template <class T> -class PrivateHookAllocator { - public: - // These type definitions are needed for stl allocators. - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef T* pointer; - typedef const T* const_pointer; - typedef T& reference; - typedef const T& const_reference; - typedef T value_type; - - PrivateHookAllocator() {} - - // Allocate memory for STL. - pointer allocate(size_type n, const void * = 0) { - return reinterpret_cast<T*>(MemoryHook::Alloc(n * sizeof(T))); - } - - // Deallocate memory for STL. - void deallocate(void* p, size_type) { - if (p) - MemoryHook::Free(p); - } - - // Construct the object - void construct(pointer p, const T& val) { - new (reinterpret_cast<T*>(p))T(val); - } - - // Destruct an object - void destroy(pointer p) { p->~T(); } - - size_type max_size() const { return size_t(-1); } - - template <class U> - struct rebind { typedef PrivateHookAllocator<U> other; }; - - template <class U> - PrivateHookAllocator(const PrivateHookAllocator<U>&) {} -}; - -template<class T, class U> inline -bool operator==(const PrivateHookAllocator<T>&, - const PrivateHookAllocator<U>&) { - return (true); -} - -template<class T, class U> inline -bool operator!=(const PrivateHookAllocator<T>& left, - const PrivateHookAllocator<U>& right) { - return (!(left == right)); -} - - -// Classes which monitor memory from these hooks implement -// the MemoryObserver interface. -class MemoryObserver { - public: - virtual ~MemoryObserver() {} - - // Track a pointer. Will capture the current StackTrace. - virtual void OnTrack(HANDLE heap, int32 id, int32 size) = 0; - - // Untrack a pointer, removing it from our list. - virtual void OnUntrack(HANDLE heap, int32 id, int32 size) = 0; -}; - -class MemoryHook : MemoryObserver { - public: - // Initialize the MemoryHook. Must be called before - // registering watchers. This can be called repeatedly, - // but is not thread safe. - static bool Initialize(); - - // Returns true is memory allocations and deallocations - // are being traced. - static bool hooked() { return hooked_ != NULL; } - - // Register a class to receive memory allocation & deallocation - // callbacks. If we haven't hooked memory yet, this call will - // force memory hooking to start. - static bool RegisterWatcher(MemoryObserver* watcher); - - // Register a class to stop receiving callbacks. If there are - // no more watchers, this call will unhook memory. - static bool UnregisterWatcher(MemoryObserver* watcher); - - // MemoryHook provides a private heap for allocating - // unwatched memory. - static void* Alloc(size_t size) { - DCHECK(global_hook_ && global_hook_->heap_); - return HeapAlloc(global_hook_->heap_, 0, size); - } - static void Free(void* ptr) { - DCHECK(global_hook_ && global_hook_->heap_); - HeapFree(global_hook_->heap_, 0, ptr); - } - - // Access the global hook. For internal use only from static "C" - // hooks. - static MemoryHook* hook() { return global_hook_; } - - // MemoryObserver interface. - virtual void OnTrack(HANDLE hHeap, int32 id, int32 size); - virtual void OnUntrack(HANDLE hHeap, int32 id, int32 size); - - private: - MemoryHook(); - ~MemoryHook(); - - // Enable memory tracing. When memory is 'hooked', - // MemoryWatchers which have registered will be called - // as memory is allocated and deallocated. - static bool Hook(); - - // Disables memory tracing. - static bool Unhook(); - - // Create our private heap - bool CreateHeap(); - - // Close our private heap. - bool CloseHeap(); - - MemoryObserver* watcher_; - HANDLE heap_; // An internal accounting heap. - static bool hooked_; - static MemoryHook* global_hook_; -}; - -#endif // MEMORY_WATCHER_MEMORY_HOOK_ diff --git a/tools/memory_watcher/memory_watcher.cc b/tools/memory_watcher/memory_watcher.cc deleted file mode 100644 index 38e933c7e7..0000000000 --- a/tools/memory_watcher/memory_watcher.cc +++ /dev/null @@ -1,255 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <algorithm> -#include <windows.h> -#include <tlhelp32.h> // for CreateToolhelp32Snapshot() -#include <map> - -#include "tools/memory_watcher/memory_watcher.h" -#include "base/file_util.h" -#include "base/logging.h" -#include "base/metrics/stats_counters.h" -#include "base/strings/string_util.h" -#include "base/strings/utf_string_conversions.h" -#include "base/synchronization/lock.h" -#include "tools/memory_watcher/call_stack.h" -#include "tools/memory_watcher/preamble_patcher.h" - -static base::StatsCounter mem_in_use("MemoryInUse.Bytes"); -static base::StatsCounter mem_in_use_blocks("MemoryInUse.Blocks"); -static base::StatsCounter mem_in_use_allocs("MemoryInUse.Allocs"); -static base::StatsCounter mem_in_use_frees("MemoryInUse.Frees"); - -// --------------------------------------------------------------------- - -MemoryWatcher::MemoryWatcher() - : file_(NULL), - hooked_(false), - active_thread_id_(0) { - MemoryHook::Initialize(); - CallStack::Initialize(); - - block_map_ = new CallStackMap(); - - // Register last - only after we're ready for notifications! - Hook(); -} - -MemoryWatcher::~MemoryWatcher() { - Unhook(); - - CloseLogFile(); - - // Pointers in the block_map are part of the MemoryHook heap. Be sure - // to delete the map before closing the heap. - delete block_map_; -} - -void MemoryWatcher::Hook() { - DCHECK(!hooked_); - MemoryHook::RegisterWatcher(this); - hooked_ = true; -} - -void MemoryWatcher::Unhook() { - if (hooked_) { - MemoryHook::UnregisterWatcher(this); - hooked_ = false; - } -} - -void MemoryWatcher::OpenLogFile() { - DCHECK(file_ == NULL); - file_name_ = "memwatcher"; - if (!log_name_.empty()) { - file_name_ += "."; - file_name_ += log_name_; - } - file_name_ += ".log"; - char buf[16]; - file_name_ += _itoa(GetCurrentProcessId(), buf, 10); - - std::string tmp_name(file_name_); - tmp_name += ".tmp"; - file_ = fopen(tmp_name.c_str(), "w+"); -} - -void MemoryWatcher::CloseLogFile() { - if (file_ != NULL) { - fclose(file_); - file_ = NULL; - std::wstring tmp_name = base::ASCIIToWide(file_name_); - tmp_name += L".tmp"; - base::Move(base::FilePath(tmp_name), - base::FilePath(base::ASCIIToWide(file_name_))); - } -} - -bool MemoryWatcher::LockedRecursionDetected() const { - if (!active_thread_id_) return false; - DWORD thread_id = GetCurrentThreadId(); - // TODO(jar): Perchance we should use atomic access to member. - return thread_id == active_thread_id_; -} - -void MemoryWatcher::OnTrack(HANDLE heap, int32 id, int32 size) { - // Don't track zeroes. It's a waste of time. - if (size == 0) - return; - - if (LockedRecursionDetected()) - return; - - // AllocationStack overrides new/delete to not allocate - // from the main heap. - AllocationStack* stack = new AllocationStack(size); - if (!stack->Valid()) return; // Recursion blocked generation of stack. - - { - base::AutoLock lock(block_map_lock_); - - // Ideally, we'd like to verify that the block being added - // here is not already in our list of tracked blocks. However, - // the lookup in our hash table is expensive and slows us too - // much. - CallStackMap::iterator block_it = block_map_->find(id); - if (block_it != block_map_->end()) { -#if 0 // Don't do this until stack->ToString() uses ONLY our heap. - active_thread_id_ = GetCurrentThreadId(); - PrivateAllocatorString output; - block_it->second->ToString(&output); - // VLOG(1) << "First Stack size " << stack->size() << "was\n" << output; - stack->ToString(&output); - // VLOG(1) << "Second Stack size " << stack->size() << "was\n" << output; -#endif // 0 - - // TODO(jar): We should delete one stack, and keep the other, perhaps - // based on size. - // For now, just delete the first, and keep the second? - delete block_it->second; - } - // TODO(jar): Perchance we should use atomic access to member. - active_thread_id_ = 0; // Note: Only do this AFTER exiting above scope! - - (*block_map_)[id] = stack; - } - - mem_in_use.Add(size); - mem_in_use_blocks.Increment(); - mem_in_use_allocs.Increment(); -} - -void MemoryWatcher::OnUntrack(HANDLE heap, int32 id, int32 size) { - DCHECK_GE(size, 0); - - // Don't bother with these. - if (size == 0) - return; - - if (LockedRecursionDetected()) - return; - - { - base::AutoLock lock(block_map_lock_); - active_thread_id_ = GetCurrentThreadId(); - - // First, find the block in our block_map. - CallStackMap::iterator it = block_map_->find(id); - if (it != block_map_->end()) { - AllocationStack* stack = it->second; - DCHECK(stack->size() == size); - block_map_->erase(id); - delete stack; - } else { - // Untracked item. This happens a fair amount, and it is - // normal. A lot of time elapses during process startup - // before the allocation routines are hooked. - size = 0; // Ignore size in tallies. - } - // TODO(jar): Perchance we should use atomic access to member. - active_thread_id_ = 0; - } - - mem_in_use.Add(-size); - mem_in_use_blocks.Decrement(); - mem_in_use_frees.Increment(); -} - -void MemoryWatcher::SetLogName(char* log_name) { - if (!log_name) - return; - - log_name_ = log_name; -} - -// Help sort lists of stacks based on allocation cost. -// Note: Sort based on allocation count is interesting too! -static bool CompareCallStackIdItems(MemoryWatcher::StackTrack* left, - MemoryWatcher::StackTrack* right) { - return left->size > right->size; -} - - -void MemoryWatcher::DumpLeaks() { - // We can only dump the leaks once. We'll cleanup the hooks here. - if (!hooked_) - return; - Unhook(); - - base::AutoLock lock(block_map_lock_); - active_thread_id_ = GetCurrentThreadId(); - - OpenLogFile(); - - // Aggregate contributions from each allocated block on per-stack basis. - CallStackIdMap stack_map; - for (CallStackMap::iterator block_it = block_map_->begin(); - block_it != block_map_->end(); ++block_it) { - AllocationStack* stack = block_it->second; - int32 stack_hash = stack->hash(); - int32 alloc_block_size = stack->size(); - CallStackIdMap::iterator it = stack_map.find(stack_hash); - if (it == stack_map.end()) { - StackTrack tracker; - tracker.count = 1; - tracker.size = alloc_block_size; - tracker.stack = stack; // Temporary pointer into block_map_. - stack_map[stack_hash] = tracker; - } else { - it->second.count++; - it->second.size += alloc_block_size; - } - } - // Don't release lock yet, as block_map_ is still pointed into. - - // Put references to StrackTracks into array for sorting. - std::vector<StackTrack*, PrivateHookAllocator<int32> > - stack_tracks(stack_map.size()); - CallStackIdMap::iterator it = stack_map.begin(); - for (size_t i = 0; i < stack_tracks.size(); ++i) { - stack_tracks[i] = &(it->second); - ++it; - } - sort(stack_tracks.begin(), stack_tracks.end(), CompareCallStackIdItems); - - int32 total_bytes = 0; - int32 total_blocks = 0; - for (size_t i = 0; i < stack_tracks.size(); ++i) { - StackTrack* stack_track = stack_tracks[i]; - fwprintf(file_, L"%d bytes, %d allocs, #%d\n", - stack_track->size, stack_track->count, i); - total_bytes += stack_track->size; - total_blocks += stack_track->count; - - CallStack* stack = stack_track->stack; - PrivateAllocatorString output; - stack->ToString(&output); - fprintf(file_, "%s", output.c_str()); - } - fprintf(file_, "Total Leaks: %d\n", total_blocks); - fprintf(file_, "Total Stacks: %d\n", stack_tracks.size()); - fprintf(file_, "Total Bytes: %d\n", total_bytes); - CloseLogFile(); -} diff --git a/tools/memory_watcher/memory_watcher.gyp b/tools/memory_watcher/memory_watcher.gyp deleted file mode 100644 index ed0505c85a..0000000000 --- a/tools/memory_watcher/memory_watcher.gyp +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (c) 2011 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -{ - 'variables': { - 'chromium_code': 1, - }, - 'targets': [ - { - 'target_name': 'memory_watcher', - 'type': 'shared_library', - 'dependencies': [ - '../../base/base.gyp:base', - '../../ui/gfx/gfx.gyp:gfx', - '../../ui/gfx/gfx.gyp:gfx_geometry', - ], - 'defines': [ - 'BUILD_MEMORY_WATCHER', - ], - 'include_dirs': [ - '../..', - ], - # 4748 "/GS can not protect parameters and local variables from local - # buffer overrun because optimizations are disabled in function". - # 4740 "flow in or out of inline asm code suppresses global optimization" - # (result of __asm call x, __asm x:). - # Nothing to be done about these warnings. - 'msvs_disabled_warnings': [ 4748, 4740 ], - 'sources': [ - 'call_stack.cc', - 'call_stack.h', - 'dllmain.cc', - 'hotkey.h', - 'ia32_modrm_map.cc', - 'ia32_opcode_map.cc', - 'memory_hook.cc', - 'memory_hook.h', - 'memory_watcher.cc', - 'memory_watcher.h', - 'mini_disassembler.cc', - 'preamble_patcher.cc', - 'preamble_patcher.h', - 'preamble_patcher_with_stub.cc', - ], - }, - ], -} diff --git a/tools/memory_watcher/memory_watcher.h b/tools/memory_watcher/memory_watcher.h deleted file mode 100644 index 8f5f1c2eb6..0000000000 --- a/tools/memory_watcher/memory_watcher.h +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// MemoryWatcher. -// The MemoryWatcher is a library that can be linked into any -// win32 application. It will override the default memory allocators -// and track call stacks for any allocations that are made. It can -// then be used to see what memory is in use. - -#ifndef TOOLS_MEMORY_WATCHER_MEMORY_WATCHER_ -#define TOOLS_MEMORY_WATCHER_MEMORY_WATCHER_ - -#include <map> -#include <functional> - -#include "base/synchronization/lock.h" -#include "tools/memory_watcher/memory_hook.h" - -class CallStack; -class AllocationStack; - -// The MemoryWatcher installs allocation hooks and monitors -// allocations and frees. -class MemoryWatcher : MemoryObserver { - public: - struct StackTrack { - CallStack* stack; - int count; - int size; - }; - - typedef std::map<int32, AllocationStack*, std::less<int32>, - PrivateHookAllocator<int32> > CallStackMap; - typedef std::map<int32, StackTrack, std::less<int32>, - PrivateHookAllocator<int32> > CallStackIdMap; - typedef std::basic_string<char, std::char_traits<char>, - PrivateHookAllocator<char> > PrivateAllocatorString; - - MemoryWatcher(); - virtual ~MemoryWatcher(); - - // Dump all tracked pointers still in use. - void DumpLeaks(); - - // MemoryObserver interface. - virtual void OnTrack(HANDLE heap, int32 id, int32 size); - virtual void OnUntrack(HANDLE heap, int32 id, int32 size); - - // Sets a name that appears in the generated file name. - void SetLogName(char* log_name); - - private: - // Opens the logfile which we create. - void OpenLogFile(); - - // Close the logfile. - void CloseLogFile(); - - // Hook the memory hooks. - void Hook(); - - // Unhooks our memory hooks. - void Unhook(); - - // Check to see if this thread is already processing a block, and should not - // recurse. - bool LockedRecursionDetected() const; - - // This is for logging. - FILE* file_; - - bool hooked_; // True when this class has the memory_hooks hooked. - - // Either 0, or else the threadID for a thread that is actively working on - // a stack track. Used to avoid recursive tracking. - DWORD active_thread_id_; - - base::Lock block_map_lock_; - // The block_map provides quick lookups based on the allocation - // pointer. This is important for having fast round trips through - // malloc/free. - CallStackMap *block_map_; - - // The file name for that log. - std::string file_name_; - - // An optional name that appears in the log file name (used to differentiate - // logs). - std::string log_name_; -}; - - - -#endif // TOOLS_MEMORY_WATCHER_MEMORY_WATCHER_ diff --git a/tools/memory_watcher/mini_disassembler.cc b/tools/memory_watcher/mini_disassembler.cc deleted file mode 100644 index c97ae6f3e2..0000000000 --- a/tools/memory_watcher/mini_disassembler.cc +++ /dev/null @@ -1,392 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/* - * Implementation of MiniDisassembler. - */ - -#include "mini_disassembler.h" - -namespace sidestep { - -MiniDisassembler::MiniDisassembler(bool operand_default_is_32_bits, - bool address_default_is_32_bits) - : operand_default_is_32_bits_(operand_default_is_32_bits), - address_default_is_32_bits_(address_default_is_32_bits) { - Initialize(); -} - -MiniDisassembler::MiniDisassembler() - : operand_default_is_32_bits_(true), - address_default_is_32_bits_(true) { - Initialize(); -} - -InstructionType MiniDisassembler::Disassemble( - unsigned char* start_byte, - unsigned int& instruction_bytes) { - // Clean up any state from previous invocations. - Initialize(); - - // Start by processing any prefixes. - unsigned char* current_byte = start_byte; - unsigned int size = 0; - InstructionType instruction_type = ProcessPrefixes(current_byte, size); - - if (IT_UNKNOWN == instruction_type) - return instruction_type; - - current_byte += size; - size = 0; - - // Invariant: We have stripped all prefixes, and the operand_is_32_bits_ - // and address_is_32_bits_ flags are correctly set. - - instruction_type = ProcessOpcode(current_byte, 0, size); - - // Check for error processing instruction - if ((IT_UNKNOWN == instruction_type_) || (IT_UNUSED == instruction_type_)) { - return IT_UNKNOWN; - } - - current_byte += size; - - // Invariant: operand_bytes_ indicates the total size of operands - // specified by the opcode and/or ModR/M byte and/or SIB byte. - // pCurrentByte points to the first byte after the ModR/M byte, or after - // the SIB byte if it is present (i.e. the first byte of any operands - // encoded in the instruction). - - // We get the total length of any prefixes, the opcode, and the ModR/M and - // SIB bytes if present, by taking the difference of the original starting - // address and the current byte (which points to the first byte of the - // operands if present, or to the first byte of the next instruction if - // they are not). Adding the count of bytes in the operands encoded in - // the instruction gives us the full length of the instruction in bytes. - instruction_bytes += operand_bytes_ + (current_byte - start_byte); - - // Return the instruction type, which was set by ProcessOpcode(). - return instruction_type_; -} - -void MiniDisassembler::Initialize() { - operand_is_32_bits_ = operand_default_is_32_bits_; - address_is_32_bits_ = address_default_is_32_bits_; - operand_bytes_ = 0; - have_modrm_ = false; - should_decode_modrm_ = false; - instruction_type_ = IT_UNKNOWN; - got_f2_prefix_ = false; - got_f3_prefix_ = false; - got_66_prefix_ = false; -} - -InstructionType MiniDisassembler::ProcessPrefixes(unsigned char* start_byte, - unsigned int& size) { - InstructionType instruction_type = IT_GENERIC; - const Opcode& opcode = s_ia32_opcode_map_[0].table_[*start_byte]; - - switch (opcode.type_) { - case IT_PREFIX_ADDRESS: - address_is_32_bits_ = !address_default_is_32_bits_; - goto nochangeoperand; - case IT_PREFIX_OPERAND: - operand_is_32_bits_ = !operand_default_is_32_bits_; - nochangeoperand: - case IT_PREFIX: - - if (0xF2 == (*start_byte)) - got_f2_prefix_ = true; - else if (0xF3 == (*start_byte)) - got_f3_prefix_ = true; - else if (0x66 == (*start_byte)) - got_66_prefix_ = true; - - instruction_type = opcode.type_; - size ++; - // we got a prefix, so add one and check next byte - ProcessPrefixes(start_byte + 1, size); - default: - break; // not a prefix byte - } - - return instruction_type; -} - -InstructionType MiniDisassembler::ProcessOpcode(unsigned char* start_byte, - unsigned int table_index, - unsigned int& size) { - const OpcodeTable& table = s_ia32_opcode_map_[table_index]; // Get our table - unsigned char current_byte = (*start_byte) >> table.shift_; - current_byte = current_byte & table.mask_; // Mask out the bits we will use - - // Check whether the byte we have is inside the table we have. - if (current_byte < table.min_lim_ || current_byte > table.max_lim_) { - instruction_type_ = IT_UNKNOWN; - return instruction_type_; - } - - const Opcode& opcode = table.table_[current_byte]; - if (IT_UNUSED == opcode.type_) { - // This instruction is not used by the IA-32 ISA, so we indicate - // this to the user. Probably means that we were pointed to - // a byte in memory that was not the start of an instruction. - instruction_type_ = IT_UNUSED; - return instruction_type_; - } else if (IT_REFERENCE == opcode.type_) { - // We are looking at an opcode that has more bytes (or is continued - // in the ModR/M byte). Recursively find the opcode definition in - // the table for the opcode's next byte. - size++; - ProcessOpcode(start_byte + 1, opcode.table_index_, size); - return instruction_type_; - } - - const SpecificOpcode* specific_opcode = (SpecificOpcode*)&opcode; - if (opcode.is_prefix_dependent_) { - if (got_f2_prefix_ && opcode.opcode_if_f2_prefix_.mnemonic_ != 0) { - specific_opcode = &opcode.opcode_if_f2_prefix_; - } else if (got_f3_prefix_ && opcode.opcode_if_f3_prefix_.mnemonic_ != 0) { - specific_opcode = &opcode.opcode_if_f3_prefix_; - } else if (got_66_prefix_ && opcode.opcode_if_66_prefix_.mnemonic_ != 0) { - specific_opcode = &opcode.opcode_if_66_prefix_; - } - } - - // Inv: The opcode type is known. - instruction_type_ = specific_opcode->type_; - - // Let's process the operand types to see if we have any immediate - // operands, and/or a ModR/M byte. - - ProcessOperand(specific_opcode->flag_dest_); - ProcessOperand(specific_opcode->flag_source_); - ProcessOperand(specific_opcode->flag_aux_); - - // Inv: We have processed the opcode and incremented operand_bytes_ - // by the number of bytes of any operands specified by the opcode - // that are stored in the instruction (not registers etc.). Now - // we need to return the total number of bytes for the opcode and - // for the ModR/M or SIB bytes if they are present. - - if (table.mask_ != 0xff) { - if (have_modrm_) { - // we're looking at a ModR/M byte so we're not going to - // count that into the opcode size - ProcessModrm(start_byte, size); - return IT_GENERIC; - } else { - // need to count the ModR/M byte even if it's just being - // used for opcode extension - size++; - return IT_GENERIC; - } - } else { - if (have_modrm_) { - // The ModR/M byte is the next byte. - size++; - ProcessModrm(start_byte + 1, size); - return IT_GENERIC; - } else { - size++; - return IT_GENERIC; - } - } -} - -bool MiniDisassembler::ProcessOperand(int flag_operand) { - bool succeeded = true; - if (AM_NOT_USED == flag_operand) - return succeeded; - - // Decide what to do based on the addressing mode. - switch (flag_operand & AM_MASK) { - // No ModR/M byte indicated by these addressing modes, and no - // additional (e.g. immediate) parameters. - case AM_A: // Direct address - case AM_F: // EFLAGS register - case AM_X: // Memory addressed by the DS:SI register pair - case AM_Y: // Memory addressed by the ES:DI register pair - case AM_IMPLICIT: // Parameter is implicit, occupies no space in - // instruction - break; - - // There is a ModR/M byte but it does not necessarily need - // to be decoded. - case AM_C: // reg field of ModR/M selects a control register - case AM_D: // reg field of ModR/M selects a debug register - case AM_G: // reg field of ModR/M selects a general register - case AM_P: // reg field of ModR/M selects an MMX register - case AM_R: // mod field of ModR/M may refer only to a general register - case AM_S: // reg field of ModR/M selects a segment register - case AM_T: // reg field of ModR/M selects a test register - case AM_V: // reg field of ModR/M selects a 128-bit XMM register - have_modrm_ = true; - break; - - // In these addressing modes, there is a ModR/M byte and it needs to be - // decoded. No other (e.g. immediate) params than indicated in ModR/M. - case AM_E: // Operand is either a general-purpose register or memory, - // specified by ModR/M byte - case AM_M: // ModR/M byte will refer only to memory - case AM_Q: // Operand is either an MMX register or memory (complex - // evaluation), specified by ModR/M byte - case AM_W: // Operand is either a 128-bit XMM register or memory (complex - // eval), specified by ModR/M byte - have_modrm_ = true; - should_decode_modrm_ = true; - break; - - // These addressing modes specify an immediate or an offset value - // directly, so we need to look at the operand type to see how many - // bytes. - case AM_I: // Immediate data. - case AM_J: // Jump to offset. - case AM_O: // Operand is at offset. - switch (flag_operand & OT_MASK) { - case OT_B: // Byte regardless of operand-size attribute. - operand_bytes_ += OS_BYTE; - break; - case OT_C: // Byte or word, depending on operand-size attribute. - if (operand_is_32_bits_) - operand_bytes_ += OS_WORD; - else - operand_bytes_ += OS_BYTE; - break; - case OT_D: // Doubleword, regardless of operand-size attribute. - operand_bytes_ += OS_DOUBLE_WORD; - break; - case OT_DQ: // Double-quadword, regardless of operand-size attribute. - operand_bytes_ += OS_DOUBLE_QUAD_WORD; - break; - case OT_P: // 32-bit or 48-bit pointer, depending on operand-size - // attribute. - if (operand_is_32_bits_) - operand_bytes_ += OS_48_BIT_POINTER; - else - operand_bytes_ += OS_32_BIT_POINTER; - break; - case OT_PS: // 128-bit packed single-precision floating-point data. - operand_bytes_ += OS_128_BIT_PACKED_SINGLE_PRECISION_FLOATING; - break; - case OT_Q: // Quadword, regardless of operand-size attribute. - operand_bytes_ += OS_QUAD_WORD; - break; - case OT_S: // 6-byte pseudo-descriptor. - operand_bytes_ += OS_PSEUDO_DESCRIPTOR; - break; - case OT_SD: // Scalar Double-Precision Floating-Point Value - case OT_PD: // Unaligned packed double-precision floating point value - operand_bytes_ += OS_DOUBLE_PRECISION_FLOATING; - break; - case OT_SS: - // Scalar element of a 128-bit packed single-precision - // floating data. - // We simply return enItUnknown since we don't have to support - // floating point - succeeded = false; - break; - case OT_V: // Word or doubleword, depending on operand-size attribute. - if (operand_is_32_bits_) - operand_bytes_ += OS_DOUBLE_WORD; - else - operand_bytes_ += OS_WORD; - break; - case OT_W: // Word, regardless of operand-size attribute. - operand_bytes_ += OS_WORD; - break; - - // Can safely ignore these. - case OT_A: // Two one-word operands in memory or two double-word - // operands in memory - case OT_PI: // Quadword MMX technology register (e.g. mm0) - case OT_SI: // Doubleword integer register (e.g., eax) - break; - - default: - break; - } - break; - - default: - break; - } - - return succeeded; -} - -bool MiniDisassembler::ProcessModrm(unsigned char* start_byte, - unsigned int& size) { - // If we don't need to decode, we just return the size of the ModR/M - // byte (there is never a SIB byte in this case). - if (!should_decode_modrm_) { - size++; - return true; - } - - // We never care about the reg field, only the combination of the mod - // and r/m fields, so let's start by packing those fields together into - // 5 bits. - unsigned char modrm = (*start_byte); - unsigned char mod = modrm & 0xC0; // mask out top two bits to get mod field - modrm = modrm & 0x07; // mask out bottom 3 bits to get r/m field - mod = mod >> 3; // shift the mod field to the right place - modrm = mod | modrm; // combine the r/m and mod fields as discussed - mod = mod >> 3; // shift the mod field to bits 2..0 - - // Invariant: modrm contains the mod field in bits 4..3 and the r/m field - // in bits 2..0, and mod contains the mod field in bits 2..0 - - const ModrmEntry* modrm_entry = 0; - if (address_is_32_bits_) - modrm_entry = &s_ia32_modrm_map_[modrm]; - else - modrm_entry = &s_ia16_modrm_map_[modrm]; - - // Invariant: modrm_entry points to information that we need to decode - // the ModR/M byte. - - // Add to the count of operand bytes, if the ModR/M byte indicates - // that some operands are encoded in the instruction. - if (modrm_entry->is_encoded_in_instruction_) - operand_bytes_ += modrm_entry->operand_size_; - - // Process the SIB byte if necessary, and return the count - // of ModR/M and SIB bytes. - if (modrm_entry->use_sib_byte_) { - size++; - return ProcessSib(start_byte + 1, mod, size); - } else { - size++; - return true; - } -} - -bool MiniDisassembler::ProcessSib(unsigned char* start_byte, - unsigned char mod, - unsigned int& size) { - // get the mod field from the 2..0 bits of the SIB byte - unsigned char sib_base = (*start_byte) & 0x07; - if (0x05 == sib_base) { - switch (mod) { - case 0x00: // mod == 00 - case 0x02: // mod == 10 - operand_bytes_ += OS_DOUBLE_WORD; - break; - case 0x01: // mod == 01 - operand_bytes_ += OS_BYTE; - break; - case 0x03: // mod == 11 - // According to the IA-32 docs, there does not seem to be a disp - // value for this value of mod - default: - break; - } - } - - size++; - return true; -} - -}; // namespace sidestep diff --git a/tools/memory_watcher/mini_disassembler.h b/tools/memory_watcher/mini_disassembler.h deleted file mode 100644 index 1d0f966e3b..0000000000 --- a/tools/memory_watcher/mini_disassembler.h +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/* - * Definition of MiniDisassembler. - */ - -#ifndef GOOGLE_PERFTOOLS_MINI_DISASSEMBLER_H__ -#define GOOGLE_PERFTOOLS_MINI_DISASSEMBLER_H__ - -#include <windows.h> -#include "mini_disassembler_types.h" - -// compatibility shim -#include "base/logging.h" -#define ASSERT(cond, msg) DCHECK(cond) -#define ASSERT1(cond) DCHECK(cond) - -namespace sidestep { - -// This small disassembler is very limited -// in its functionality, and in fact does only the bare minimum required by the -// preamble patching utility. It may be useful for other purposes, however. -// -// The limitations include at least the following: -// -# No support for coprocessor opcodes, MMX, etc. -// -# No machine-readable identification of opcodes or decoding of -// assembly parameters. The name of the opcode (as a string) is given, -// however, to aid debugging. -// -// You may ask what this little disassembler actually does, then? The answer is -// that it does the following, which is exactly what the patching utility needs: -// -# Indicates if opcode is a jump (any kind) or a return (any kind) -// because this is important for the patching utility to determine if -// a function is too short or there are jumps too early in it for it -// to be preamble patched. -// -# The opcode length is always calculated, so that the patching utility -// can figure out where the next instruction starts, and whether it -// already has enough instructions to replace with the absolute jump -// to the patching code. -// -// The usage is quite simple; just create a MiniDisassembler and use its -// Disassemble() method. -// -// If you would like to extend this disassembler, please refer to the -// IA-32 Intel Architecture Software Developer's Manual Volume 2: -// Instruction Set Reference for information about operand decoding -// etc. -class MiniDisassembler { - public: - - // Creates a new instance and sets defaults. - // - // @param operand_default_32_bits If true, the default operand size is - // set to 32 bits, which is the default under Win32. Otherwise it is 16 bits. - // @param address_default_32_bits If true, the default address size is - // set to 32 bits, which is the default under Win32. Otherwise it is 16 bits. - MiniDisassembler(bool operand_default_32_bits, - bool address_default_32_bits); - - // Equivalent to MiniDisassembler(true, true); - MiniDisassembler(); - - // Attempts to disassemble a single instruction starting from the - // address in memory it is pointed to. - // - // @param start Address where disassembly should start. - // @param instruction_bytes Variable that will be <b>incremented</b> by - // the length in bytes of the instruction. - // @return enItJump, enItReturn or enItGeneric on success. enItUnknown - // if unable to disassemble, enItUnused if this seems to be an unused - // opcode. In the last two (error) cases, cbInstruction will be set - // to 0xffffffff. - // - // @post This instance of the disassembler is ready to be used again, - // with unchanged defaults from creation time. - InstructionType Disassemble(unsigned char* start, unsigned int& instruction_bytes); - - private: - - // Makes the disassembler ready for reuse. - void Initialize(); - - // Sets the flags for address and operand sizes. - // @return Number of prefix bytes. - InstructionType ProcessPrefixes(unsigned char* start, unsigned int& size); - - // Sets the flag for whether we have ModR/M, and increments - // operand_bytes_ if any are specifies by the opcode directly. - // @return Number of opcode bytes. - InstructionType ProcessOpcode(unsigned char * start, - unsigned int table, - unsigned int& size); - - // Checks the type of the supplied operand. Increments - // operand_bytes_ if it directly indicates an immediate etc. - // operand. Asserts have_modrm_ if the operand specifies - // a ModR/M byte. - bool ProcessOperand(int flag_operand); - - // Increments operand_bytes_ by size specified by ModR/M and - // by SIB if present. - // @return 0 in case of error, 1 if there is just a ModR/M byte, - // 2 if there is a ModR/M byte and a SIB byte. - bool ProcessModrm(unsigned char* start, unsigned int& size); - - // Processes the SIB byte that it is pointed to. - // @param start Pointer to the SIB byte. - // @param mod The mod field from the ModR/M byte. - // @return 1 to indicate success (indicates 1 SIB byte) - bool ProcessSib(unsigned char* start, unsigned char mod, unsigned int& size); - - // The instruction type we have decoded from the opcode. - InstructionType instruction_type_; - - // Counts the number of bytes that is occupied by operands in - // the current instruction (note: we don't care about how large - // operands stored in registers etc. are). - unsigned int operand_bytes_; - - // True iff there is a ModR/M byte in this instruction. - bool have_modrm_; - - // True iff we need to decode the ModR/M byte (sometimes it just - // points to a register, we can tell by the addressing mode). - bool should_decode_modrm_; - - // Current operand size is 32 bits if true, 16 bits if false. - bool operand_is_32_bits_; - - // Default operand size is 32 bits if true, 16 bits if false. - bool operand_default_is_32_bits_; - - // Current address size is 32 bits if true, 16 bits if false. - bool address_is_32_bits_; - - // Default address size is 32 bits if true, 16 bits if false. - bool address_default_is_32_bits_; - - // Huge big opcode table based on the IA-32 manual, defined - // in Ia32OpcodeMap.cc - static const OpcodeTable s_ia32_opcode_map_[]; - - // Somewhat smaller table to help with decoding ModR/M bytes - // when 16-bit addressing mode is being used. Defined in - // Ia32ModrmMap.cc - static const ModrmEntry s_ia16_modrm_map_[]; - - // Somewhat smaller table to help with decoding ModR/M bytes - // when 32-bit addressing mode is being used. Defined in - // Ia32ModrmMap.cc - static const ModrmEntry s_ia32_modrm_map_[]; - - // Indicators of whether we got certain prefixes that certain - // silly Intel instructions depend on in nonstandard ways for - // their behaviors. - bool got_f2_prefix_, got_f3_prefix_, got_66_prefix_; -}; - -}; // namespace sidestep - -#endif // GOOGLE_PERFTOOLS_MINI_DISASSEMBLER_H__ diff --git a/tools/memory_watcher/mini_disassembler_types.h b/tools/memory_watcher/mini_disassembler_types.h deleted file mode 100644 index 4fc24abde3..0000000000 --- a/tools/memory_watcher/mini_disassembler_types.h +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/* - * Several simple types used by the disassembler and some of the patching - * mechanisms. - */ - -#ifndef GOOGLE_PERFTOOLS_MINI_DISASSEMBLER_TYPES_H__ -#define GOOGLE_PERFTOOLS_MINI_DISASSEMBLER_TYPES_H__ - -namespace sidestep { - -// Categories of instructions that we care about -enum InstructionType { - // This opcode is not used - IT_UNUSED, - // This disassembler does not recognize this opcode (error) - IT_UNKNOWN, - // This is not an instruction but a reference to another table - IT_REFERENCE, - // This byte is a prefix byte that we can ignore - IT_PREFIX, - // This is a prefix byte that switches to the nondefault address size - IT_PREFIX_ADDRESS, - // This is a prefix byte that switches to the nondefault operand size - IT_PREFIX_OPERAND, - // A jump or call instruction - IT_JUMP, - // A return instruction - IT_RETURN, - // Any other type of instruction (in this case we don't care what it is) - IT_GENERIC, -}; - -// Lists IA-32 operand sizes in multiples of 8 bits -enum OperandSize { - OS_ZERO = 0, - OS_BYTE = 1, - OS_WORD = 2, - OS_DOUBLE_WORD = 4, - OS_QUAD_WORD = 8, - OS_DOUBLE_QUAD_WORD = 16, - OS_32_BIT_POINTER = 32/8, - OS_48_BIT_POINTER = 48/8, - OS_SINGLE_PRECISION_FLOATING = 32/8, - OS_DOUBLE_PRECISION_FLOATING = 64/8, - OS_DOUBLE_EXTENDED_PRECISION_FLOATING = 80/8, - OS_128_BIT_PACKED_SINGLE_PRECISION_FLOATING = 128/8, - OS_PSEUDO_DESCRIPTOR = 6 -}; - -// Operand addressing methods from the IA-32 manual. The enAmMask value -// is a mask for the rest. The other enumeration values are named for the -// names given to the addressing methods in the manual, e.g. enAm_D is for -// the D addressing method. -// -// The reason we use a full 4 bytes and a mask, is that we need to combine -// these flags with the enOperandType to store the details -// on the operand in a single integer. -enum AddressingMethod { - AM_NOT_USED = 0, // This operand is not used for this instruction - AM_MASK = 0x00FF0000, // Mask for the rest of the values in this enumeration - AM_A = 0x00010000, // A addressing type - AM_C = 0x00020000, // C addressing type - AM_D = 0x00030000, // D addressing type - AM_E = 0x00040000, // E addressing type - AM_F = 0x00050000, // F addressing type - AM_G = 0x00060000, // G addressing type - AM_I = 0x00070000, // I addressing type - AM_J = 0x00080000, // J addressing type - AM_M = 0x00090000, // M addressing type - AM_O = 0x000A0000, // O addressing type - AM_P = 0x000B0000, // P addressing type - AM_Q = 0x000C0000, // Q addressing type - AM_R = 0x000D0000, // R addressing type - AM_S = 0x000E0000, // S addressing type - AM_T = 0x000F0000, // T addressing type - AM_V = 0x00100000, // V addressing type - AM_W = 0x00110000, // W addressing type - AM_X = 0x00120000, // X addressing type - AM_Y = 0x00130000, // Y addressing type - AM_REGISTER = 0x00140000, // Specific register is always used as this op - AM_IMPLICIT = 0x00150000, // An implicit, fixed value is used -}; - -// Operand types from the IA-32 manual. The enOtMask value is -// a mask for the rest. The rest of the values are named for the -// names given to these operand types in the manual, e.g. enOt_ps -// is for the ps operand type in the manual. -// -// The reason we use a full 4 bytes and a mask, is that we need -// to combine these flags with the enAddressingMethod to store the details -// on the operand in a single integer. -enum OperandType { - OT_MASK = 0xFF000000, - OT_A = 0x01000000, - OT_B = 0x02000000, - OT_C = 0x03000000, - OT_D = 0x04000000, - OT_DQ = 0x05000000, - OT_P = 0x06000000, - OT_PI = 0x07000000, - OT_PS = 0x08000000, // actually unsupported for (we don't know its size) - OT_Q = 0x09000000, - OT_S = 0x0A000000, - OT_SS = 0x0B000000, - OT_SI = 0x0C000000, - OT_V = 0x0D000000, - OT_W = 0x0E000000, - OT_SD = 0x0F000000, // scalar double-precision floating-point value - OT_PD = 0x10000000, // double-precision floating point - // dummy "operand type" for address mode M - which doesn't specify - // operand type - OT_ADDRESS_MODE_M = 0x80000000 -}; - -// Everything that's in an Opcode (see below) except the three -// alternative opcode structs for different prefixes. -struct SpecificOpcode { - // Index to continuation table, or 0 if this is the last - // byte in the opcode. - int table_index_; - - // The opcode type - InstructionType type_; - - // Description of the type of the dest, src and aux operands, - // put together from an enOperandType flag and an enAddressingMethod - // flag. - int flag_dest_; - int flag_source_; - int flag_aux_; - - // We indicate the mnemonic for debugging purposes - const char* mnemonic_; -}; - -// The information we keep in our tables about each of the different -// valid instructions recognized by the IA-32 architecture. -struct Opcode { - // Index to continuation table, or 0 if this is the last - // byte in the opcode. - int table_index_; - - // The opcode type - InstructionType type_; - - // Description of the type of the dest, src and aux operands, - // put together from an enOperandType flag and an enAddressingMethod - // flag. - int flag_dest_; - int flag_source_; - int flag_aux_; - - // We indicate the mnemonic for debugging purposes - const char* mnemonic_; - - // Alternative opcode info if certain prefixes are specified. - // In most cases, all of these are zeroed-out. Only used if - // bPrefixDependent is true. - bool is_prefix_dependent_; - SpecificOpcode opcode_if_f2_prefix_; - SpecificOpcode opcode_if_f3_prefix_; - SpecificOpcode opcode_if_66_prefix_; -}; - -// Information about each table entry. -struct OpcodeTable { - // Table of instruction entries - const Opcode* table_; - // How many bytes left to shift ModR/M byte <b>before</b> applying mask - unsigned char shift_; - // Mask to apply to byte being looked at before comparing to table - unsigned char mask_; - // Minimum/maximum indexes in table. - unsigned char min_lim_; - unsigned char max_lim_; -}; - -// Information about each entry in table used to decode ModR/M byte. -struct ModrmEntry { - // Is the operand encoded as bytes in the instruction (rather than - // if it's e.g. a register in which case it's just encoded in the - // ModR/M byte) - bool is_encoded_in_instruction_; - - // Is there a SIB byte? In this case we always need to decode it. - bool use_sib_byte_; - - // What is the size of the operand (only important if it's encoded - // in the instruction)? - OperandSize operand_size_; -}; - -}; // namespace sidestep - -#endif // GOOGLE_PERFTOOLS_MINI_DISASSEMBLER_TYPES_H__ diff --git a/tools/memory_watcher/preamble_patcher.cc b/tools/memory_watcher/preamble_patcher.cc deleted file mode 100644 index 846d88141b..0000000000 --- a/tools/memory_watcher/preamble_patcher.cc +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "preamble_patcher.h" -#include "memory_hook.h" -#include "mini_disassembler.h" - -// compatibility shims -#include "base/logging.h" - -// Definitions of assembly statements we need -#define ASM_JMP32REL 0xE9 -#define ASM_INT3 0xCC - -namespace sidestep { - -SideStepError PreamblePatcher::RawPatchWithStubAndProtections( - void* target_function, void *replacement_function, - unsigned char* preamble_stub, unsigned long stub_size, - unsigned long* bytes_needed) { - // We need to be able to write to a process-local copy of the first - // MAX_PREAMBLE_STUB_SIZE bytes of target_function. We may be giving execute - // privilege to something that doesn't have it, but that's the price to pay - // for tools. - DWORD old_target_function_protect = 0; - BOOL succeeded = ::VirtualProtect(reinterpret_cast<void*>(target_function), - MAX_PREAMBLE_STUB_SIZE, - PAGE_EXECUTE_READWRITE, - &old_target_function_protect); - if (!succeeded) { - ASSERT(false, "Failed to make page containing target function " - "copy-on-write."); - return SIDESTEP_ACCESS_DENIED; - } - - SideStepError error_code = RawPatchWithStub(target_function, - replacement_function, - preamble_stub, - stub_size, - bytes_needed); - if (SIDESTEP_SUCCESS != error_code) { - ASSERT1(false); - return error_code; - } - - // Restore the protection of the first MAX_PREAMBLE_STUB_SIZE bytes of - // pTargetFunction to what they were before we started goofing around. - succeeded = ::VirtualProtect(reinterpret_cast<void*>(target_function), - MAX_PREAMBLE_STUB_SIZE, - old_target_function_protect, - &old_target_function_protect); - if (!succeeded) { - ASSERT(false, "Failed to restore protection to target function."); - // We must not return an error here because the function has actually - // been patched, and returning an error would likely cause our client - // code not to unpatch it. So we just keep going. - } - - // Flush the instruction cache to make sure the processor doesn't execute the - // old version of the instructions (before our patch). - // - // FlushInstructionCache is actually a no-op at least on single-processor - // XP machines. I'm not sure why this is so, but it is, yet I want to keep - // the call to the API here for correctness in case there is a difference in - // some variants of Windows/hardware. - succeeded = ::FlushInstructionCache(::GetCurrentProcess(), - target_function, - MAX_PREAMBLE_STUB_SIZE); - if (!succeeded) { - ASSERT(false, "Failed to flush instruction cache."); - // We must not return an error here because the function has actually - // been patched, and returning an error would likely cause our client - // code not to unpatch it. So we just keep going. - } - - return SIDESTEP_SUCCESS; -} - -SideStepError PreamblePatcher::RawPatch(void* target_function, - void* replacement_function, - void** original_function_stub) { - if (!target_function || !replacement_function || !original_function_stub || - (*original_function_stub) || target_function == replacement_function) { - ASSERT(false, "Preconditions not met"); - return SIDESTEP_INVALID_PARAMETER; - } - - // @see MAX_PREAMBLE_STUB_SIZE for an explanation of how we arrives at - // this size - unsigned char* preamble_stub = - reinterpret_cast<unsigned char*>( - MemoryHook::Alloc(sizeof(unsigned char) * MAX_PREAMBLE_STUB_SIZE)); - if (!preamble_stub) { - ASSERT(false, "Unable to allocate preamble-stub."); - return SIDESTEP_INSUFFICIENT_BUFFER; - } - - // Change the protection of the newly allocated preamble stub to - // PAGE_EXECUTE_READWRITE. This is required to work with DEP (Data - // Execution Prevention) which will cause an exception if code is executed - // from a page on which you do not have read access. - DWORD old_stub_protect = 0; - BOOL succeeded = VirtualProtect(preamble_stub, MAX_PREAMBLE_STUB_SIZE, - PAGE_EXECUTE_READWRITE, &old_stub_protect); - if (!succeeded) { - ASSERT(false, "Failed to make page preamble stub read-write-execute."); - delete[] preamble_stub; - return SIDESTEP_ACCESS_DENIED; - } - - SideStepError error_code = RawPatchWithStubAndProtections(target_function, - replacement_function, - preamble_stub, - MAX_PREAMBLE_STUB_SIZE, - NULL); - if (SIDESTEP_SUCCESS != error_code) { - ASSERT1(false); - delete[] preamble_stub; - return error_code; - } - - *original_function_stub = reinterpret_cast<void*>(preamble_stub); - - // NOTE: For hooking malloc/free, we don't want to use streams which - // allocate. Basically, we've hooked malloc, but not necessarily - // hooked free yet. To do anything which uses the heap could crash - // with a mismatched malloc/free! - //VLOG(1) << "PreamblePatcher::RawPatch successfully patched 0x" - // << target_function; - - return SIDESTEP_SUCCESS; -} - -SideStepError PreamblePatcher::Unpatch(void* target_function, - void* replacement_function, - void* original_function_stub) { - ASSERT1(target_function && original_function_stub); - if (!target_function || !original_function_stub) { - return SIDESTEP_INVALID_PARAMETER; - } - - // We disassemble the preamble of the _stub_ to see how many bytes we - // originally copied to the stub. - MiniDisassembler disassembler; - unsigned int preamble_bytes = 0; - while (preamble_bytes < 5) { - InstructionType instruction_type = disassembler.Disassemble( - reinterpret_cast<unsigned char*>(original_function_stub) + - preamble_bytes, preamble_bytes); - if (IT_GENERIC != instruction_type) { - ASSERT(false, "Should only have generic instructions in stub!!"); - return SIDESTEP_UNSUPPORTED_INSTRUCTION; - } - } - - // Before unpatching, target_function should be a JMP to - // replacement_function. If it's not, then either it's an error, or - // we're falling into the case where the original instruction was a - // JMP, and we patched the jumped_to address rather than the JMP - // itself. (For instance, if malloc() is just a JMP to __malloc(), - // we patched __malloc() and not malloc().) - unsigned char* target = reinterpret_cast<unsigned char*>(target_function); - while (1) { // we stop when target is a JMP to replacement_function - if (target[0] != ASM_JMP32REL) { - ASSERT(false, "target_function does not look like it was patched."); - return SIDESTEP_INVALID_PARAMETER; - } - int relative_offset; // Windows guarantees int is 4 bytes - ASSERT1(sizeof(relative_offset) == 4); - memcpy(reinterpret_cast<void*>(&relative_offset), - reinterpret_cast<void*>(target + 1), 4); - unsigned char* jump_to = target + 5 + relative_offset; - if (jump_to == replacement_function) - break; - target = jump_to; // follow the jmp - } - - // We need to be able to write to a process-local copy of the first - // MAX_PREAMBLE_STUB_SIZE bytes of target_function. We may be giving execute - // privilege to something that doesn't have it, but that's the price to pay - // for tools. - DWORD old_target_function_protect = 0; - BOOL succeeded = ::VirtualProtect(reinterpret_cast<void*>(target), - MAX_PREAMBLE_STUB_SIZE, - PAGE_EXECUTE_READWRITE, - &old_target_function_protect); - if (!succeeded) { - ASSERT(false, "Failed to make page containing target function " - "copy-on-write."); - return SIDESTEP_ACCESS_DENIED; - } - - // Replace the first few bytes of the original function with the bytes we - // previously moved to the preamble stub. - memcpy(reinterpret_cast<void*>(target), - original_function_stub, preamble_bytes); - - // Stub is now useless so delete it. - // [csilvers: Commented out for perftools because it causes big problems - // when we're unpatching malloc. We just let this live on as a leak.] - //delete original_function_stub; - - // Restore the protection of the first MAX_PREAMBLE_STUB_SIZE bytes of - // target to what they were before we started goofing around. - succeeded = ::VirtualProtect(reinterpret_cast<void*>(target), - MAX_PREAMBLE_STUB_SIZE, - old_target_function_protect, - &old_target_function_protect); - - // Flush the instruction cache to make sure the processor doesn't execute the - // old version of the instructions (before our patch). - // - // See comment on FlushInstructionCache elsewhere in this file. - succeeded = ::FlushInstructionCache(::GetCurrentProcess(), - target, - MAX_PREAMBLE_STUB_SIZE); - if (!succeeded) { - ASSERT(false, "Failed to flush instruction cache."); - return SIDESTEP_UNEXPECTED; - } - - VLOG(1) << "PreamblePatcher::Unpatch successfully unpatched 0x" - << target_function; - return SIDESTEP_SUCCESS; -} - -}; // namespace sidestep diff --git a/tools/memory_watcher/preamble_patcher.h b/tools/memory_watcher/preamble_patcher.h deleted file mode 100644 index fae2551bd7..0000000000 --- a/tools/memory_watcher/preamble_patcher.h +++ /dev/null @@ -1,293 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/* - * Definition of PreamblePatcher - */ - -#ifndef MEMORY_WATCHER_PREAMBLE_PATCHER_H__ -#define MEMORY_WATCHER_PREAMBLE_PATCHER_H__ - -#include <windows.h> - -// compatibility shim -#include "base/logging.h" -#define ASSERT(cond, msg) DCHECK(cond) -#define ASSERT1(cond) DCHECK(cond) - -// Maximum size of the preamble stub. We overwrite at least the first 5 -// bytes of the function. Considering the worst case scenario, we need 4 -// bytes + the max instruction size + 5 more bytes for our jump back to -// the original code. With that in mind, 32 is a good number :) -#define MAX_PREAMBLE_STUB_SIZE (32) - -namespace sidestep { - -// Possible results of patching/unpatching -enum SideStepError { - SIDESTEP_SUCCESS = 0, - SIDESTEP_INVALID_PARAMETER, - SIDESTEP_INSUFFICIENT_BUFFER, - SIDESTEP_JUMP_INSTRUCTION, - SIDESTEP_FUNCTION_TOO_SMALL, - SIDESTEP_UNSUPPORTED_INSTRUCTION, - SIDESTEP_NO_SUCH_MODULE, - SIDESTEP_NO_SUCH_FUNCTION, - SIDESTEP_ACCESS_DENIED, - SIDESTEP_UNEXPECTED, -}; - -#define SIDESTEP_TO_HRESULT(error) \ - MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NULL, error) - -// Implements a patching mechanism that overwrites the first few bytes of -// a function preamble with a jump to our hook function, which is then -// able to call the original function via a specially-made preamble-stub -// that imitates the action of the original preamble. -// -// NOTE: This patching mechanism should currently only be used for -// non-production code, e.g. unit tests, because it is not threadsafe. -// See the TODO in preamble_patcher_with_stub.cc for instructions on what -// we need to do before using it in production code; it's fairly simple -// but unnecessary for now since we only intend to use it in unit tests. -// -// To patch a function, use either of the typesafe Patch() methods. You -// can unpatch a function using Unpatch(). -// -// Typical usage goes something like this: -// @code -// typedef int (*MyTypesafeFuncPtr)(int x); -// MyTypesafeFuncPtr original_func_stub; -// int MyTypesafeFunc(int x) { return x + 1; } -// int HookMyTypesafeFunc(int x) { return 1 + original_func_stub(x); } -// -// void MyPatchInitializingFunction() { -// original_func_stub = PreamblePatcher::Patch( -// MyTypesafeFunc, HookMyTypesafeFunc); -// if (!original_func_stub) { -// // ... error handling ... -// } -// -// // ... continue - you have patched the function successfully ... -// } -// @endcode -// -// Note that there are a number of ways that this method of patching can -// fail. The most common are: -// - If there is a jump (jxx) instruction in the first 5 bytes of -// the function being patched, we cannot patch it because in the -// current implementation we do not know how to rewrite relative -// jumps after relocating them to the preamble-stub. Note that -// if you really really need to patch a function like this, it -// would be possible to add this functionality (but at some cost). -// - If there is a return (ret) instruction in the first 5 bytes -// we cannot patch the function because it may not be long enough -// for the jmp instruction we use to inject our patch. -// - If there is another thread currently executing within the bytes -// that are copied to the preamble stub, it will crash in an undefined -// way. -// -// If you get any other error than the above, you're either pointing the -// patcher at an invalid instruction (e.g. into the middle of a multi- -// byte instruction, or not at memory containing executable instructions) -// or, there may be a bug in the disassembler we use to find -// instruction boundaries. -// -// NOTE: In optimized builds, when you have very trivial functions that -// the compiler can reason do not have side effects, the compiler may -// reuse the result of calling the function with a given parameter, which -// may mean if you patch the function in between your patch will never get -// invoked. See preamble_patcher_test.cc for an example. -class PreamblePatcher { - public: - - // This is a typesafe version of RawPatch(), identical in all other - // ways than it takes a template parameter indicating the type of the - // function being patched. - // - // @param T The type of the function you are patching. Usually - // you will establish this type using a typedef, as in the following - // example: - // @code - // typedef BOOL (WINAPI *MessageBoxPtr)(HWND, LPCTSTR, LPCTSTR, UINT); - // MessageBoxPtr original = NULL; - // PreamblePatcher::Patch(MessageBox, Hook_MessageBox, &original); - // @endcode - template <class T> - static SideStepError Patch(T target_function, - T replacement_function, - T* original_function_stub) { - // NOTE: casting from a function to a pointer is contra the C++ - // spec. It's not safe on IA64, but is on i386. We use - // a C-style cast here to emphasize this is not legal C++. - return RawPatch((void*)(target_function), - (void*)(replacement_function), - (void**)(original_function_stub)); - } - - // Patches a named function imported from the named module using - // preamble patching. Uses RawPatch() to do the actual patching - // work. - // - // @param T The type of the function you are patching. Must - // exactly match the function you specify using module_name and - // function_name. - // - // @param module_name The name of the module from which the function - // is being imported. Note that the patch will fail if this module - // has not already been loaded into the current process. - // - // @param function_name The name of the function you wish to patch. - // - // @param replacement_function Your replacement function which - // will be called whenever code tries to call the original function. - // - // @param original_function_stub Pointer to memory that should receive a - // pointer that can be used (e.g. in the replacement function) to call the - // original function, or NULL to indicate failure. - // - // @return One of the EnSideStepError error codes; only SIDESTEP_SUCCESS - // indicates success. - template <class T> - static SideStepError Patch(LPCTSTR module_name, - LPCSTR function_name, - T replacement_function, - T* original_function_stub) { - ASSERT1(module_name && function_name); - if (!module_name || !function_name) { - ASSERT(false, - "You must specify a module name and function name."); - return SIDESTEP_INVALID_PARAMETER; - } - HMODULE module = ::GetModuleHandle(module_name); - ASSERT1(module != NULL); - if (!module) { - ASSERT(false, "Invalid module name."); - return SIDESTEP_NO_SUCH_MODULE; - } - FARPROC existing_function = ::GetProcAddress(module, function_name); - if (!existing_function) { - return SIDESTEP_NO_SUCH_FUNCTION; - } - // NOTE: casting from a function to a pointer is contra the C++ - // spec. It's not safe on IA64, but is on i386. We use - // a C-style cast here to emphasize this is not legal C++. - return RawPatch((void*)existing_function, (void*)replacement_function, - (void**)(original_function_stub)); - } - - // Patches a function by overwriting its first few bytes with - // a jump to a different function. This is the "worker" function - // for each of the typesafe Patch() functions. In most cases, - // it is preferable to use the Patch() functions rather than - // this one as they do more checking at compile time. - // - // @param target_function A pointer to the function that should be - // patched. - // - // @param replacement_function A pointer to the function that should - // replace the target function. The replacement function must have - // exactly the same calling convention and parameters as the original - // function. - // - // @param original_function_stub Pointer to memory that should receive a - // pointer that can be used (e.g. in the replacement function) to call the - // original function, or NULL to indicate failure. - // - // @param original_function_stub Pointer to memory that should receive a - // pointer that can be used (e.g. in the replacement function) to call the - // original function, or NULL to indicate failure. - // - // @return One of the EnSideStepError error codes; only SIDESTEP_SUCCESS - // indicates success. - // - // @note The preamble-stub (the memory pointed to by - // *original_function_stub) is allocated on the heap, and (in - // production binaries) never destroyed, resulting in a memory leak. This - // will be the case until we implement safe unpatching of a method. - // However, it is quite difficult to unpatch a method (because other - // threads in the process may be using it) so we are leaving it for now. - // See however UnsafeUnpatch, which can be used for binaries where you - // know only one thread is running, e.g. unit tests. - static SideStepError RawPatch(void* target_function, - void* replacement_function, - void** original_function_stub); - - // Unpatches target_function and deletes the stub that previously could be - // used to call the original version of the function. - // - // DELETES the stub that is passed to the function. - // - // @param target_function Pointer to the target function which was - // previously patched, i.e. a pointer which value should match the value - // of the symbol prior to patching it. - // - // @param replacement_function Pointer to the function target_function - // was patched to. - // - // @param original_function_stub Pointer to the stub returned when - // patching, that could be used to call the original version of the - // patched function. This function will also delete the stub, which after - // unpatching is useless. - // - // If your original call was - // origptr = Patch(VirtualAlloc, MyVirtualAlloc) - // then to undo it you would call - // Unpatch(VirtualAlloc, MyVirtualAlloc, origptr); - // - // @return One of the EnSideStepError error codes; only SIDESTEP_SUCCESS - // indicates success. - static SideStepError Unpatch(void* target_function, - void* replacement_function, - void* original_function_stub); - - private: - - // Patches a function by overwriting its first few bytes with - // a jump to a different function. This is similar to the RawPatch - // function except that it uses the stub allocated by the caller - // instead of allocating it. - // - // We call VirtualProtect to make the - // target function writable at least for the duration of the call. - // - // @param target_function A pointer to the function that should be - // patched. - // - // @param replacement_function A pointer to the function that should - // replace the target function. The replacement function must have - // exactly the same calling convention and parameters as the original - // function. - // - // @param preamble_stub A pointer to a buffer where the preamble stub - // should be copied. The size of the buffer should be sufficient to - // hold the preamble bytes. - // - // @param stub_size Size in bytes of the buffer allocated for the - // preamble_stub - // - // @param bytes_needed Pointer to a variable that receives the minimum - // number of bytes required for the stub. Can be set to NULL if you're - // not interested. - // - // @return An error code indicating the result of patching. - static SideStepError RawPatchWithStubAndProtections(void* target_function, - void *replacement_function, - unsigned char* preamble_stub, - unsigned long stub_size, - unsigned long* bytes_needed); - - // A helper function used by RawPatchWithStubAndProtections -- it does - // everything but the VirtualProtect wsork. Defined in - // preamble_patcher_with_stub.cc. - static SideStepError RawPatchWithStub(void* target_function, - void *replacement_function, - unsigned char* preamble_stub, - unsigned long stub_size, - unsigned long* bytes_needed); -}; - -}; // namespace sidestep - -#endif // MEMORY_WATCHER_PREAMBLE_PATCHER_H__ diff --git a/tools/memory_watcher/preamble_patcher_with_stub.cc b/tools/memory_watcher/preamble_patcher_with_stub.cc deleted file mode 100644 index 31303065c3..0000000000 --- a/tools/memory_watcher/preamble_patcher_with_stub.cc +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/* - * Implementation of PreamblePatcher - */ - -#include "preamble_patcher.h" - -#include "mini_disassembler.h" - -// Definitions of assembly statements we need -#define ASM_JMP32REL 0xE9 -#define ASM_INT3 0xCC - -namespace sidestep { - -SideStepError PreamblePatcher::RawPatchWithStub( - void* target_function, - void *replacement_function, - unsigned char* preamble_stub, - unsigned long stub_size, - unsigned long* bytes_needed) { - if ((NULL == target_function) || - (NULL == replacement_function) || - (NULL == preamble_stub)) { - ASSERT(false, "Invalid parameters - either pTargetFunction or " - "pReplacementFunction or pPreambleStub were NULL."); - return SIDESTEP_INVALID_PARAMETER; - } - - // TODO(V7:joi) Siggi and I just had a discussion and decided that both - // patching and unpatching are actually unsafe. We also discussed a - // method of making it safe, which is to freeze all other threads in the - // process, check their thread context to see if their eip is currently - // inside the block of instructions we need to copy to the stub, and if so - // wait a bit and try again, then unfreeze all threads once we've patched. - // Not implementing this for now since we're only using SideStep for unit - // testing, but if we ever use it for production code this is what we - // should do. - // - // NOTE: Stoyan suggests we can write 8 or even 10 bytes atomically using - // FPU instructions, and on newer processors we could use cmpxchg8b or - // cmpxchg16b. So it might be possible to do the patching/unpatching - // atomically and avoid having to freeze other threads. Note though, that - // doing it atomically does not help if one of the other threads happens - // to have its eip in the middle of the bytes you change while you change - // them. - unsigned char* target = reinterpret_cast<unsigned char*>(target_function); - - // First, deal with a special case that we see with functions that - // point into an IAT table (including functions linked statically - // into the application): these function already starts with - // ASM_JMP32REL. For instance, malloc() might be implemented as a - // JMP to __malloc(). In that case, we replace the destination of - // the JMP (__malloc), rather than the JMP itself (malloc). This - // way we get the correct behavior no matter how malloc gets called. - if (target[0] == ASM_JMP32REL) { - // target[1-4] holds the place the jmp goes to, but it's - // relative to the next instruction. - int relative_offset; // Windows guarantees int is 4 bytes - ASSERT1(sizeof(relative_offset) == 4); - memcpy(reinterpret_cast<void*>(&relative_offset), - reinterpret_cast<void*>(target + 1), 4); - // I'd like to just say "target = target + 5 + relative_offset" here, but - // I can't, because the new target will need to have its protections set. - return RawPatchWithStubAndProtections(target + 5 + relative_offset, - replacement_function, preamble_stub, - stub_size, bytes_needed); - } - - // Let's disassemble the preamble of the target function to see if we can - // patch, and to see how much of the preamble we need to take. We need 5 - // bytes for our jmp instruction, so let's find the minimum number of - // instructions to get 5 bytes. - MiniDisassembler disassembler; - unsigned int preamble_bytes = 0; - while (preamble_bytes < 5) { - InstructionType instruction_type = - disassembler.Disassemble(target + preamble_bytes, preamble_bytes); - if (IT_JUMP == instruction_type) { - ASSERT(false, "Unable to patch because there is a jump instruction " - "in the first 5 bytes."); - return SIDESTEP_JUMP_INSTRUCTION; - } else if (IT_RETURN == instruction_type) { - ASSERT(false, "Unable to patch because function is too short"); - return SIDESTEP_FUNCTION_TOO_SMALL; - } else if (IT_GENERIC != instruction_type) { - ASSERT(false, "Disassembler encountered unsupported instruction " - "(either unused or unknown)"); - return SIDESTEP_UNSUPPORTED_INSTRUCTION; - } - } - - if (NULL != bytes_needed) - *bytes_needed = preamble_bytes + 5; - - // Inv: cbPreamble is the number of bytes (at least 5) that we need to take - // from the preamble to have whole instructions that are 5 bytes or more - // in size total. The size of the stub required is cbPreamble + size of - // jmp (5) - if (preamble_bytes + 5 > stub_size) { - ASSERT1(false); - return SIDESTEP_INSUFFICIENT_BUFFER; - } - - // First, copy the preamble that we will overwrite. - memcpy(reinterpret_cast<void*>(preamble_stub), - reinterpret_cast<void*>(target), preamble_bytes); - - // Now, make a jmp instruction to the rest of the target function (minus the - // preamble bytes we moved into the stub) and copy it into our preamble-stub. - // find address to jump to, relative to next address after jmp instruction -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable:4244) -#endif - int relative_offset_to_target_rest - = ((reinterpret_cast<unsigned char*>(target) + preamble_bytes) - - (preamble_stub + preamble_bytes + 5)); -#ifdef _MSC_VER -#pragma warning(pop) -#endif - // jmp (Jump near, relative, displacement relative to next instruction) - preamble_stub[preamble_bytes] = ASM_JMP32REL; - // copy the address - memcpy(reinterpret_cast<void*>(preamble_stub + preamble_bytes + 1), - reinterpret_cast<void*>(&relative_offset_to_target_rest), 4); - - // Inv: preamble_stub points to assembly code that will execute the - // original function by first executing the first cbPreamble bytes of the - // preamble, then jumping to the rest of the function. - - // Overwrite the first 5 bytes of the target function with a jump to our - // replacement function. - // (Jump near, relative, displacement relative to next instruction) - target[0] = ASM_JMP32REL; - - // Find offset from instruction after jmp, to the replacement function. -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable:4244) -#endif - int offset_to_replacement_function = - reinterpret_cast<unsigned char*>(replacement_function) - - reinterpret_cast<unsigned char*>(target) - 5; -#ifdef _MSC_VER -#pragma warning(pop) -#endif - // complete the jmp instruction - memcpy(reinterpret_cast<void*>(target + 1), - reinterpret_cast<void*>(&offset_to_replacement_function), 4); - // Set any remaining bytes that were moved to the preamble-stub to INT3 so - // as not to cause confusion (otherwise you might see some strange - // instructions if you look at the disassembly, or even invalid - // instructions). Also, by doing this, we will break into the debugger if - // some code calls into this portion of the code. If this happens, it - // means that this function cannot be patched using this patcher without - // further thought. - if (preamble_bytes > 5) { - memset(reinterpret_cast<void*>(target + 5), ASM_INT3, preamble_bytes - 5); - } - - // Inv: The memory pointed to by target_function now points to a relative - // jump instruction that jumps over to the preamble_stub. The preamble - // stub contains the first stub_size bytes of the original target - // function's preamble code, followed by a relative jump back to the next - // instruction after the first cbPreamble bytes. - - return SIDESTEP_SUCCESS; -} - -}; // namespace sidestep diff --git a/tools/memory_watcher/scripts/finditem.pl b/tools/memory_watcher/scripts/finditem.pl deleted file mode 100755 index 36838ebc73..0000000000 --- a/tools/memory_watcher/scripts/finditem.pl +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/perl -# Copyright (c) 2012 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -sub process_raw($$) { - my $file = shift; - my $search = shift; - - my %leaks = (); - - my $save = 0; - my $print = 0; - my $bytes = 0; - my $calls = 0; - my $sum_bytes = 0; - my $sum_calls = 0; - - open (LOGFILE, "$file") or die("could not open $file"); - while(<LOGFILE>) { - my $line = $_; - if ($line =~ m/([0-9]*) bytes, ([0-9]*) allocs/) { - $save = ""; - $print = 0; - $bytes = $1; - $calls = $2; - } - elsif ($line =~ m/$search/) { - $print = 1; - } - elsif ($line =~ m/=============/) { - $save .= $line; - if ($print) { - print "$bytes bytes ($calls calls)\n"; - print $save; - $sum_bytes += $bytes; - $sum_calls += $calls; - $save = ""; - $print = 0; - $calls = 0; - } - } - $save .= $line; - } - print("TOTAL: $sum_bytes bytes ($sum_calls calls)\n"); -} - - -# ----- Main ------------------------------------------------ - -# Get the command line argument -my $filename = shift; -my $search = shift; - -# Process the file. -process_raw($filename, $search); diff --git a/tools/memory_watcher/scripts/memprof.pl b/tools/memory_watcher/scripts/memprof.pl deleted file mode 100755 index d902e5e4fa..0000000000 --- a/tools/memory_watcher/scripts/memprof.pl +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/perl -# Copyright (c) 2012 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -# -# Given a memwatcher logfile, group memory allocations by callstack. -# -# Usage: -# -# memprof.pl <logfile> -# -# logfile -- The memwatcher.logXXXX file to summarize. -# -# -# -# Sample output: -# -# 54,061,617 100.00% AllocationStack::AllocationStack -# 41,975,368 77.64% malloc -# 11,886,592 21.99% VirtualAlloc -# 7,168,000 13.26% v8::internal::OS::Allocate -# 7,168,000 13.26% v8::internal::MemoryAllocator::AllocateRawMemory -# 5,976,184 11.05% WebCore::V8Bridge::evaluate -# 5,767,168 10.67% v8::internal::MemoryAllocator::AllocatePages -# 5,451,776 10.08% WebCore::V8Proxy::initContextIfNeeded -# .... -# -# -# -# ******** -# Note: The output is currently sorted by decreasing size. -# ******** -# - -sub process_raw($$) { - my $file = shift; - my $filter = shift; - - my %leaks = (); - my %stackframes = (); - - my $blamed = 0; - my $bytes = 0; - my $hits = 0; - open (LOGFILE, "$file") or die("could not open $file"); - while(<LOGFILE>) { - my $line = $_; -#print "$line"; - chomp($line); - if ($line =~ m/([0-9]*) bytes, ([0-9]*) allocs/) { - - # If we didn't find any frames to account this to, log that. - if ($blamed == 0) { - $leaks{"UNACCOUNTED"} += $bytes; - } - -#print "START\n"; - #print("stackframe " . $1 . ", " . $2 . "\n"); - $hits = $2; - $bytes = $1; - %stackframes = (); # we have a new frame, clear the list. - $blamed = 0; # we haven't blamed anyone yet - } - elsif ($line =~ m/Total Bytes:[ ]*([0-9]*)/) { - $total_bytes += $1; - } - elsif ($line =~ m/=============/) { - next; - } - elsif ($line =~ m/[ ]*([\-a-zA-Z_\\0-9\.]*) \(([0-9]*)\):[ ]*([<>_a-zA-Z_0-9:]*)/) { -# print("junk: " . $line . "\n"); -# print("file: $1\n"); -# print("line: $2\n"); -# print("function: $3\n"); -# - - # blame the function - my $pig = $3; -# my $pig = $1; - - # only add the memory if this function is not yet on our callstack - if (!exists $stackframes{$pig}) { - $leaks{$pig} += $bytes; - } - - $stackframes{$pig}++; - $blamed++; - } - } - - # now dump our hash table - my $sum = 0; - my @keys = sort { $leaks{$b} <=> $leaks{$a} }keys %leaks; - for ($i=0; $i<@keys; $i++) { - my $key = @keys[$i]; - printf "%11s\t%3.2f%%\t%s\n", comma_print($leaks{$key}), (100* $leaks{$key} / $total_bytes), $key; - $sum += $leaks{$key}; - } - printf("TOTAL: %s\n", comma_print($sum)); -} - -# Insert commas into an integer after each three digits for printing. -sub comma_print { - my $num = "$_[0]"; - $num =~ s/(\d{1,3}?)(?=(\d{3})+$)/$1,/g; - return $num; -} - -# ----- Main ------------------------------------------------ - -# Get the command line argument -my $filename = shift; -my $filter = shift; - -# Process the file. -process_raw($filename, $filter); diff --git a/tools/memory_watcher/scripts/memtrace.pl b/tools/memory_watcher/scripts/memtrace.pl deleted file mode 100755 index 04a70fd8c2..0000000000 --- a/tools/memory_watcher/scripts/memtrace.pl +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/perl -# Copyright (c) 2012 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -# -# Blame callstacks for each memory allocation. -# Similar to memprof.pl, will also try to filter out unuseful stacks. -# TODO: better describe how these tools differ. -# -# Usage: -# -# memtrace.pl <logfile> -# -# logfile -- The memwatcher.logXXXX file to summarize. -# -# -# -# Sample output: -# -# 41,975,368 77.64% f:\sp\vctools\crt_bld\self_x86\crt\src\malloc.c (163): malloc -# 2,097,152 3.88% c:\src\chrome1\src\webkit\pending\frameloader.cpp (3300): WebCore::FrameLoader::committedLoad -# 1,572,864 2.91% c:\src\chrome1\src\webkit\port\bridge\v8bridge.cpp (214): WebCore::V8Bridge::evaluate -# 1,572,864 2.91% c:\src\chrome1\src\webkit\glue\webframeloaderclient_impl.cc (1071): WebFrameLoaderClient::committedLoad -# 1,572,864 2.91% c:\src\chrome1\src\v8\src\ast.h (1181): v8::internal::Visitor::Visit -# -# -# - - -sub process_raw($) { - my $file = shift; - - my %leaks = (); - - my $location_bytes = 0; - my $location_hits = 0; - my $location_blame = ""; - my $location_last = ""; - my $contains_load_lib = 0; - my $total_bytes = 0; - open (LOGFILE, "$file") or die("could not open $file"); - while(<LOGFILE>) { - my $line = $_; -#print "$line"; - chomp($line); - if ($line =~ m/([0-9]*) bytes, ([0-9]*) allocs/) { - -#print "START\n"; - # Dump "prior" frame here - if ($location_bytes > 0) { -#print("GOTLEAK: $location_bytes ($location_hits) $location_blame\n"); - if ($location_blame eq "") { - $location_blame = $location_last; - } - if (!$contains_load_lib) { - $leaks{$location_blame} += $location_bytes; - } - $location_bytes = 0; - $location_blame = ""; - $contains_load_lib = 0; - } - - #print("stackframe " . $1 . ", " . $2 . "\n"); - $location_hits = $2; - $location_bytes = $1; - } - elsif ($line =~ m/Total Bytes:[ ]*([0-9]*)/) { - $total_bytes += $1; - } - elsif ($line =~ m/LoadLibrary/) { - # skip these, they contain false positives. - $contains_load_lib = 1; - next; - } - elsif ($line =~ m/=============/) { - next; - } - elsif ($line =~ m/Untracking untracked/) { - next; - } - elsif ($line =~ m/[ ]*([a-z]:\\[a-z]*\\[a-zA-Z_\\0-9\.]*) /) { - my $filename = $1; - if ($filename =~ m/memory_watcher/) { - next; - } - if ($filename =~ m/skmemory_stdlib.cpp/) { - next; - } - if ($filename =~ m/stringimpl.cpp/) { - next; - } - if ($filename =~ m/stringbuffer.h/) { - next; - } - if ($filename =~ m/fastmalloc.h/) { - next; - } - if ($filename =~ m/microsoft visual studio 8/) { - next; - } - if ($filename =~ m/platformsdk_win2008_6_1/) { - next; - } - if ($location_blame eq "") { - # use this to blame the line - $location_blame = $line; - - # use this to blame the file. - # $location_blame = $filename; - -#print("blaming $location_blame\n"); - } - } else { -# print("junk: " . $line . "\n"); - if (! ($line =~ m/GetModuleFileNameA/) ) { - $location_last = $line; - } - } - } - - # now dump our hash table - my $sum = 0; - my @keys = sort { $leaks{$b} <=> $leaks{$a} }keys %leaks; - for ($i=0; $i<@keys; $i++) { - my $key = @keys[$i]; - if (0 == $total_bytes) { $total_bytes = 1; } - printf "%11s\t%3.2f%%\t%s\n", comma_print($leaks{$key}), (100* $leaks{$key} / $total_bytes), $key; - $sum += $leaks{$key}; - } - printf("TOTAL: %s\n", comma_print($sum)); -} - -# Insert commas into an integer after each three digits for printing. -sub comma_print { - my $num = "$_[0]"; - $num =~ s/(\d{1,3}?)(?=(\d{3})+$)/$1,/g; - return $num; -} - -# ----- Main ------------------------------------------------ - -# Get the command line argument -my $filename = shift; - -# Process the file. -process_raw($filename); diff --git a/tools/memory_watcher/scripts/summary.pl b/tools/memory_watcher/scripts/summary.pl deleted file mode 100755 index aaf09b9452..0000000000 --- a/tools/memory_watcher/scripts/summary.pl +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/perl -# Copyright (c) 2012 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -# -# Read a memtrace logfile from stdin and group memory allocations by logical -# code component. The code component is guessed from the callstack, and -# is something like {v8, sqlite, disk cache, skia, etc..} -# -# Usage: -# -# summary.pl -# -# [STDIN] -- The memwatcher.logXXXX file to summarize. -# - -sub process_stdin() { - my %leaks = (); - my $total_bytes = 0; - - while(<STDIN>) { - my $line = $_; - chomp($line); - my $bytes, $loc; - ($bytes, $loc) = ($line =~ m/[ \t]*([0-9]*)[ \t]*[0-9\.%]*[ \t]*(.*)/); - chomp($loc); - while(<STDIN>) { - my $cont = $_; - chomp($cont); - last if $cont =~ m/=====/; - $loc .= "\n" . $cont; - } - my $location_blame = ""; - -# print "Found: $bytes, $loc\n"; - - if ($loc =~ m/v8::internal::Snapshot::Deserialize/) { - $location_blame = "v8 Snapshot Deserialize"; - } elsif ($loc =~ m/RenderStyle::create/) { - $location_blame = "RenderStyle::create"; - } elsif ($loc =~ m/v8::internal::OldSpace::SlowAllocateRaw/) { - $location_blame = "v8 OldSpace"; - } elsif ($loc =~ m/sqlite/) { - $location_blame = "sqlite"; - } elsif ($loc =~ m/ TransportDIB::Map/) { - $location_blame = "Shared Memory Backing Store"; - } elsif ($loc =~ m/imagedecoder/) { - $location_blame = "img decoder"; - } elsif ($loc =~ m/SkBitmap/) { - $location_blame = "skia"; - } elsif ($loc =~ m/disk_cache/) { - $location_blame = "disk cache"; - } elsif ($loc =~ m/skia/) { - $location_blame = "skia"; - } elsif ($loc =~ m/:WSA/) { - $location_blame = "net"; - } elsif ($loc =~ m/dns/) { - $location_blame = "net"; - } elsif ($loc =~ m/trunk\\net/) { - $location_blame = "net"; - } elsif ($loc =~ m/WinHttp/) { - $location_blame = "WinHttp"; - } elsif ($loc =~ m/:I_Crypt/) { - $location_blame = "WinHttpSSL"; - } elsif ($loc =~ m/CryptGetTls/) { - $location_blame = "WinHttpSSL"; - } elsif ($loc =~ m/WinVerifyTrust/) { - $location_blame = "WinHttpSSL"; - } elsif ($loc =~ m/Cert/) { - $location_blame = "WinHttpSSL"; - } elsif ($loc =~ m/plugin/) { - $location_blame = "plugin"; - } elsif ($loc =~ m/NP_/) { - $location_blame = "plugin"; - } elsif ($loc =~ m/hunspell/) { - $location_blame = "hunspell"; - } elsif ($loc =~ m/TextCodec/) { - $location_blame = "fonts"; - } elsif ($loc =~ m/glyph/) { - $location_blame = "fonts"; - } elsif ($loc =~ m/cssparser/) { - $location_blame = "webkit css"; - } elsif ($loc =~ m/::CSS/) { - $location_blame = "webkit css"; - } elsif ($loc =~ m/Arena/) { - $location_blame = "webkit arenas"; - } elsif ($loc =~ m/WebCore::.*ResourceLoader::addData/) { - $location_blame = "WebCore *ResourceLoader addData"; - } elsif ($loc =~ m/OnUpdateVisitedLinks/) { - $location_blame = "OnUpdateVisitedLinks"; - } elsif ($loc =~ m/IPC/) { - $location_blame = "ipc"; - } elsif ($loc =~ m/trunk\\chrome\\browser/) { - $location_blame = "browser"; - } elsif ($loc =~ m/trunk\\chrome\\renderer/) { - $location_blame = "renderer"; - } elsif ($loc =~ m/webcore\\html/) { - $location_blame = "webkit webcore html"; - } elsif ($loc =~ m/webkit.*string/) { - $location_blame = "webkit strings"; - } elsif ($loc =~ m/htmltokenizer/) { - $location_blame = "webkit HTMLTokenizer"; - } elsif ($loc =~ m/javascriptcore/) { - $location_blame = "webkit javascriptcore"; - } elsif ($loc =~ m/webkit/) { - $location_blame = "webkit other"; - } elsif ($loc =~ m/safe_browsing/) { - $location_blame = "safe_browsing"; - } elsif ($loc =~ m/VisitedLinkMaster/) { - $location_blame = "VisitedLinkMaster"; - } elsif ($loc =~ m/NewDOMUI/) { - $location_blame = "NewDOMUI"; - } elsif ($loc =~ m/RegistryControlledDomainService/) { - $location_blame = "RegistryControlledDomainService"; - } elsif ($loc =~ m/URLRequestChromeJob::DataAvailable/) { - $location_blame = "URLRequestChromeJob DataAvailable"; - } else { - $location_blame = "unknown"; - } - - # Surface large outliers in an "interesting" group. - my $interesting_group = "unknown"; - my $interesting_size = 10000000; # Make this smaller as needed. - # TODO(jar): Add this as a pair of shell arguments. - if ($bytes > $interesting_size && $location_blame eq $interesting_group) { - # Create a special group for the exact stack that contributed so much. - $location_blame = $loc; - } - - $total_bytes += $bytes; - $leaks{$location_blame} += $bytes; - } - - # now dump our hash table - my $sum = 0; - my @keys = sort { $leaks{$b} <=> $leaks{$a} }keys %leaks; - for ($i=0; $i<@keys; $i++) { - my $key = @keys[$i]; - printf "%11s\t(%3.2f%%)\t%s\n", comma_print($leaks{$key}), (100* $leaks{$key} / $total_bytes), $key; - $sum += $leaks{$key}; - } - printf("TOTAL: %s\n", comma_print($sum)); -} - -# Insert commas into an integer after each three digits for printing. -sub comma_print { - my $num = "$_[0]"; - $num =~ s/(\d{1,3}?)(?=(\d{3})+$)/$1,/g; - return $num; -} - -# ----- Main ------------------------------------------------ - -process_stdin(); diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index a2b557784f..192890baec 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -1574,6 +1574,16 @@ Therefore, the affected-histogram name has to have at least one dot in it. </summary> </histogram> +<histogram name="Autofill.AddressBook.AccessSkipped" enum="BooleanSkipped"> + <owner>erikchen@chromium.org</owner> + <summary> + Whether an attempt to access the Mac AddressBook was skipped because doing + so would incorrectly cause the appearance of the permissions dialog. This + happens when Chrome auto-update changes the binary on disk before the first + AddressBook access attempt. + </summary> +</histogram> + <histogram name="Autofill.AddressBookAvailable" enum="BooleanAvailable"> <owner>isherman@chromium.org</owner> <summary> @@ -2703,9 +2713,7 @@ Therefore, the affected-histogram name has to have at least one dot in it. <histogram name="CloudPrint.XmppPingTry"> <owner>vitalybuka@chromium.org</owner> - <summary> - Number of tries before successfull ping. 99 means giving up. - </summary> + <summary>Number of tries before successful ping. 99 means giving up.</summary> </histogram> <histogram name="Compositing.CopyFromSurfaceTime" units="ms"> @@ -8170,6 +8178,13 @@ Therefore, the affected-histogram name has to have at least one dot in it. </summary> </histogram> +<histogram name="GoogleSearch.AccessPoint" enum="SearchAccessPoint"> + <owner>kmadhusu@chromium.org</owner> + <summary> + Counts number of Google searches from various access points in the browser. + </summary> +</histogram> + <histogram name="GoogleUpdate.EffectivePolicy" enum="UpdatePolicy"> <owner>gab@chromium.org</owner> <summary> @@ -13498,10 +13513,19 @@ Therefore, the affected-histogram name has to have at least one dot in it. </histogram> <histogram name="Net.FtpServerTypeCount" enum="FtpServerType"> + <obsolete> + Replaced by Net.FtpServerTypeCount2 on 2012-11-03. + </obsolete> + <owner>phajdan.jr@chromium.org</owner> + <summary> + Each bucket is the number of times the FTP server type was encountered. + </summary> +</histogram> + +<histogram name="Net.FtpServerTypeCount2" enum="FtpServerType2"> <owner>phajdan.jr@chromium.org</owner> <summary> - Each bucket is the number of FTP server types the user has encountered - during the session. + Each bucket is the number of times the FTP server type was encountered. </summary> </histogram> @@ -13562,10 +13586,21 @@ Therefore, the affected-histogram name has to have at least one dot in it. </histogram> <histogram name="Net.HadFtpServerType" enum="FtpServerType"> + <obsolete> + Replaced by Net.HadFtpServerType2 on 2012-11-13. + </obsolete> <owner>phajdan.jr@chromium.org</owner> <summary> - Each bucket is a boolean (0 or 1) indicating whether the user has had a - connection with an FTP server of that type during the session. + Each bucket is the number of sessions that encountered a given FTP server + type. Each session reports a given server type at most once. + </summary> +</histogram> + +<histogram name="Net.HadFtpServerType2" enum="FtpServerType2"> + <owner>phajdan.jr@chromium.org</owner> + <summary> + Each bucket is the number of sessions that encountered a given FTP server + type. Each session reports a given server type at most once. </summary> </histogram> @@ -15842,6 +15877,15 @@ Therefore, the affected-histogram name has to have at least one dot in it. </summary> </histogram> +<histogram name="Net.WebSocket.ErrorCodes" enum="NetErrorCodes"> + <owner>yhirano@chromium.org</owner> + <owner>ricea@chromium.org</owner> + <owner>tyoshino@chromium.org</owner> + <summary> + Positive net error codes that WebSockets end with, including OK and ABORTED. + </summary> +</histogram> + <histogram name="Net.WebSocket.HandshakeResult" enum="WebSocketNewHandshakeResult"> <owner>yhirano@chromium.org</owner> @@ -15853,6 +15897,13 @@ Therefore, the affected-histogram name has to have at least one dot in it. </summary> </histogram> +<histogram name="Net.WebSocket.ResponseCode" enum="HttpResponseCode"> + <owner>yhirano@chromium.org</owner> + <owner>ricea@chromium.org</owner> + <owner>tyoshino@chromium.org</owner> + <summary>All HTTP status codes seen during WebSocket handshakes.</summary> +</histogram> + <histogram name="Net.Wifi.InterfaceCount"> <owner>mvanouwerkerk@chromium.org</owner> <summary> @@ -22413,6 +22464,17 @@ Therefore, the affected-histogram name has to have at least one dot in it. </summary> </histogram> +<histogram name="Profile.Delete" enum="BooleanProfileSignedIn"> + <owner>mlerman@chromium.org</owner> + <summary> + The user used the settings page to delete a profile. Please note this + histogram tracks the user interaction, and not the actual delete of the + profile, which can happen much later. The parameter indicates if the profile + was signed in or not; true means the profile was signed in, false means the + profile was not signed in. + </summary> +</histogram> + <histogram name="Profile.DesktopMenu" enum="ProfileDesktopMenu"> <owner>mlerman@chromium.org</owner> <summary> @@ -25003,6 +25065,14 @@ Therefore, the affected-histogram name has to have at least one dot in it. </summary> </histogram> +<histogram name="SBIRS.DroppedIncident" enum="IncidentType"> + <owner>grt@google.com</owner> + <summary> + The type of incident given to the safe browsing incident reporting service + but dropped as a result of not participating in safe browsing. + </summary> +</histogram> + <histogram name="SBIRS.EnvCollectionTime" units="milliseconds"> <owner>grt@google.com</owner> <summary> @@ -25634,11 +25704,12 @@ Therefore, the affected-histogram name has to have at least one dot in it. </summary> </histogram> -<histogram name="Signin.Reconciler.DifferentPrimaryAccounts"> +<histogram name="Signin.Reconciler.DifferentPrimaryAccounts" + enum="DifferentPrimaryAccounts"> <owner>mlerman@chromium.org</owner> <summary> - After the first execution of the account reconciler, true if the token - service and cookie jar contained different primary accounts. + After execution of the account reconcilor, compares the primary account in + the token service to the primary GAIA account of the cookie jar. </summary> </histogram> @@ -28454,6 +28525,18 @@ Therefore, the affected-histogram name has to have at least one dot in it. </summary> </histogram> +<histogram name="SoftwareReporter.ExitCode" enum="SwReporterExitCode"> + <owner>mad@chromium.org</owner> + <summary>The exit code from the execution of the software reporter.</summary> +</histogram> + +<histogram name="SoftwareReporter.Step" enum="SwReporterStep"> + <owner>mad@chromium.org</owner> + <summary> + The registration and execution steps for the software reporter. + </summary> +</histogram> + <histogram name="SpellCheck.SpellingService.Enabled" enum="BooleanEnabled"> <owner>groby@chromium.org</owner> <owner>rlp@chromium.org</owner> @@ -33846,6 +33929,11 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="1" label="Orphan"/> </enum> +<enum name="BooleanProfileSignedIn" type="int"> + <int value="0" label="Profile was not Signed In"/> + <int value="1" label="Profile was Signed In"/> +</enum> + <enum name="BooleanRaced" type="int"> <int value="0" label="Did Not Race"/> <int value="1" label="Raced"/> @@ -33866,6 +33954,11 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="1" label="Selected"/> </enum> +<enum name="BooleanSkipped" type="int"> + <int value="0" label="Not skipped"/> + <int value="1" label="Skipped"/> +</enum> + <enum name="BooleanStale" type="int"> <int value="0" label="Fresh"/> <int value="1" label="Stale"/> @@ -34491,6 +34584,13 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="20" label="SQLite Integrity Web Data Test"/> </enum> +<enum name="DifferentPrimaryAccounts" type="int"> + <int value="0" label="Primary Accounts the same"/> + <int value="1" label="(obsolete) Primary Accounts different"/> + <int value="2" label="No GAIA account in cookie jar"/> + <int value="3" label="Primary accounts present but different"/> +</enum> + <enum name="DllHash" type="int"> <!-- Generated by chrome_elf/dll_hash_for_uma/dll_hash_for_uma_main.cc --> @@ -35491,6 +35591,8 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="266" label="Block developer mode"/> <int value="267" label="Show the apps shortcut in the bookmark bar"/> <int value="268" label="Register protocol handlers"/> + <int value="269" label="Enable virtual keyboard"/> + <int value="270" label="Enable deprecated web platform features"/> </enum> <enum name="EnterprisePolicyInvalidations" type="int"> @@ -36544,6 +36646,9 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="789" label="INPUTMETHODPRIVATE_SETCURRENTINPUTMETHOD"/> <int value="790" label="INPUTMETHODPRIVATE_GETINPUTMETHODS"/> <int value="791" label="IDENTITY_GETPROFILEUSERINFO"/> + <int value="792" label="VIRTUALKEYBOARDPRIVATE_OPENSETTINGS"/> + <int value="793" label="BLUETOOTHLOWENERGY_CONNECT"/> + <int value="794" label="BLUETOOTHLOWENERGY_DISCONNECT"/> </enum> <enum name="ExtensionInstallCause" type="int"> @@ -37315,6 +37420,13 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="462" label="EditingAppleTabSpanClass"/> <int value="463" label="HTMLImportsAsyncAttribute"/> <int value="464" label="FontFaceSetReady"/> + <int value="465" label="XMLHttpRequestSynchronous"/> + <int value="466" label="CSSSelectorPseudoUnresolved"/> + <int value="467" label="CSSSelectorPseudoShadow"/> + <int value="468" label="CSSSelectorPseudoContent"/> + <int value="469" label="CSSSelectorPseudoHost"/> + <int value="470" label="CSSSelectorPseudoHostContext"/> + <int value="471" label="CSSDeepCombinator"/> </enum> <enum name="FFmpegCodecs" type="int"> @@ -37771,8 +37883,12 @@ Therefore, the affected-histogram name has to have at least one dot in it. </enum> <enum name="FtpServerType" type="int"> + <obsolete> + Deprecated 2012-11-13. No longer generated. + </obsolete> <summary> - FTP server type as defined in net/ftp/ftp_server_type_histograms.h + Old FTP server type as previously defined in + net/ftp/ftp_server_type_histograms.h </summary> <int value="0" label="Unknown"> Unknown (could be a server we don't support, a broken server, or a security @@ -37792,6 +37908,18 @@ Therefore, the affected-histogram name has to have at least one dot in it. </int> </enum> +<enum name="FtpServerType2" type="int"> + <summary> + FTP server type as defined in net/ftp/ftp_server_type_histograms.h + </summary> + <int value="0" label="Unknown"/> + <int value="1" label="/bin/ls"/> + <int value="2" label="Windows"/> + <int value="3" label="VMS"/> + <int value="4" label="Netware"/> + <int value="5" label="OS/2"/> +</enum> + <enum name="GaiaSessionRestoreOutcome" type="int"> <int value="0" label="Undefined"/> <int value="1" label="Success"/> @@ -43464,6 +43592,7 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="20" label="APK"/> <int value="21" label="DMG"/> <int value="22" label="PKG"/> + <int value="23" label="TORRENT"/> </enum> <enum name="SBClientDownloadIsSignedBinary" type="int"> @@ -43534,6 +43663,19 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="3" label="SCT_STATUS_OK"/> </enum> +<enum name="SearchAccessPoint" type="int"> + <int value="0" label="Omnibox"/> + <int value="1" label="Omnibox Instant"/> + <int value="2" label="Direct Navigation"/> + <int value="3" label="Direct Navigation Instant"/> + <int value="4" label="Home Page"/> + <int value="5" label="Home Page Instant"/> + <int value="6" label="Search App"/> + <int value="7" label="Search App Instant"/> + <int value="8" label="Other"/> + <int value="9" label="Other Instant"/> +</enum> + <enum name="SearchEngine" type="int"> <obsolete> Deprecated 8/2013. No longer generated. @@ -44726,6 +44868,21 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="3" label="Attempted"/> </enum> +<enum name="SwReporterExitCode" type="int"> + <int value="0" label="Success / Found"/> + <int value="1" label="Failed"/> + <int value="2" label="Nothing Found"/> +</enum> + +<enum name="SwReporterStep" type="int"> + <int value="0" label="Explicit request"/> + <int value="1" label="Startup retry"/> + <int value="2" label="Retried too many times"/> + <int value="3" label="Start execution"/> + <int value="4" label="Failed to start"/> + <int value="5" label="Registry exit code"/> +</enum> + <enum name="SyncAuthError" type="int"> <int value="0" label="Number of times clients have encountered an Auth error."/> @@ -45059,6 +45216,7 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="14" label="DefaultSearchManager::kDefaultSearchProviderDataPrefName"/> <int value="15" label="prefs::kPreferenceResetTime"/> + <int value="16" label="prefs::kSafeBrowsingIncidentReportSent"/> </enum> <enum name="TranslateError" type="int"> @@ -46247,6 +46405,21 @@ Therefore, the affected-histogram name has to have at least one dot in it. <affected-histogram name="PLT.PT_StartToFinish"/> </histogram_suffixes> +<histogram_suffixes name="GoogleSearchVariations"> + <owner>kmadhusu@chromium.org</owner> + <suffix name="_PrerenderDisabled" + label="Counts number of Google searches from various access points in + the Android Chrome browser when prerendering is disabled via + "Bandwidth management" settings or "Privacy" + settings. Only recorded on Android."/> + <suffix name="_PrerenderEnabled" + label="Counts number of Google searches from various access points in + the Android Chrome browser when prerendering is enabled via + "Bandwidth management" settings or "Privacy" + settings. Only recorded on Android."/> + <affected-histogram name="GoogleSearch.AccessPoint"/> +</histogram_suffixes> + <histogram_suffixes name="GWSChromeJointExperiment"> <suffix name="Experiment1" label="Only page loads that are a result of a navigation from a web diff --git a/tools/perf/benchmarks/indexeddb_perf.py b/tools/perf/benchmarks/indexeddb_perf.py index e969d71b15..5949f36272 100644 --- a/tools/perf/benchmarks/indexeddb_perf.py +++ b/tools/perf/benchmarks/indexeddb_perf.py @@ -12,7 +12,6 @@ Indexes: create/delete Data access: Random read/write - Sporadic writes Read cache Cursors: Read & random writes diff --git a/tools/perf/benchmarks/smoothness.py b/tools/perf/benchmarks/smoothness.py index 9c8eaea221..3eea8ad1e4 100644 --- a/tools/perf/benchmarks/smoothness.py +++ b/tools/perf/benchmarks/smoothness.py @@ -115,7 +115,7 @@ class SmoothnessFastPathGpuRasterizationKeySilkCases( silk_flags.CustomizeBrowserOptionsForFastPath(options) -@test.Disabled # crbug.com/384730 +@test.Enabled('android') class SmoothnessToughPinchZoomCases(test.Test): """Measures rendering statistics for pinch-zooming into the tough pinch zoom cases diff --git a/tools/perf/measurements/image_decoding.py b/tools/perf/measurements/image_decoding.py index 8b03b1c0d2..ece8f0e9f5 100644 --- a/tools/perf/measurements/image_decoding.py +++ b/tools/perf/measurements/image_decoding.py @@ -27,8 +27,11 @@ class ImageDecoding(page_measurement.PageMeasurement): self._power_metric.Start(page, tab) # FIXME: bare 'devtools' is for compatibility with older reference versions # only and may eventually be removed. + # FIXME: Remove webkit.console when blink.console lands in chromium and + # the ref builds are updated. crbug.com/386847 tab.browser.StartTracing( - 'disabled-by-default-devtools.timeline*,devtools,webkit.console') + 'disabled-by-default-devtools.timeline*,' + + 'devtools,webkit.console,blink.console') def StopBrowserAfterPage(self, browser, page): return not browser.tabs[0].ExecuteJavaScript(""" diff --git a/tools/perf/measurements/smoothness_controller.py b/tools/perf/measurements/smoothness_controller.py index f220fab600..3bcd285bf5 100644 --- a/tools/perf/measurements/smoothness_controller.py +++ b/tools/perf/measurements/smoothness_controller.py @@ -26,7 +26,9 @@ class SmoothnessController(object): self._interaction = None def Start(self, page, tab): - custom_categories = ['webkit.console', 'benchmark'] + # FIXME: Remove webkit.console when blink.console lands in chromium and + # the ref builds are updated. crbug.com/386847 + custom_categories = ['webkit.console', 'blink.console', 'benchmark'] custom_categories += page.GetSyntheticDelayCategories() tab.browser.StartTracing(','.join(custom_categories), 60) if tab.browser.platform.IsRawDisplayFrameRateSupported(): diff --git a/tools/perf/measurements/smoothness_unittest.py b/tools/perf/measurements/smoothness_unittest.py index 80fa42ee33..00718abbd6 100644 --- a/tools/perf/measurements/smoothness_unittest.py +++ b/tools/perf/measurements/smoothness_unittest.py @@ -68,11 +68,16 @@ class SmoothnessUnitTest( 'DELAY(cc.BeginMainFrame;0.012000;static)', 'DELAY(cc.DrawAndSwap;0.012000;alternating)', 'DELAY(gpu.PresentingFrame;0.012000;static)', - 'benchmark', - 'webkit.console' + 'benchmark' ] actual_category_filter = tab.browser.category_filter.split(',') actual_category_filter.sort() + + # FIXME: Put blink.console into the expected above and remove these two + # remove entries when the blink.console change has rolled into chromium. + actual_category_filter.remove('webkit.console') + actual_category_filter.remove('blink.console') + if expected_category_filter != actual_category_filter: sys.stderr.write("Expected category filter: %s\n" % repr(expected_category_filter)) diff --git a/tools/perf/page_sets/data/key_silk_cases.json b/tools/perf/page_sets/data/key_silk_cases.json index c3952548fc..c772e58eca 100644 --- a/tools/perf/page_sets/data/key_silk_cases.json +++ b/tools/perf/page_sets/data/key_silk_cases.json @@ -4,6 +4,9 @@ "key_silk_cases_009.wpr": [ "http://jsfiddle.net/TLXLu/2/embedded/result/" ], + "key_silk_cases_006.wpr": [ + "http://jsfiddle.net/rF9Gh/3/embedded/result/" + ], "key_silk_cases_000.wpr": [ "http://staff.tumblr.com/", "http://jsfiddle.net/mdxJ7/3/show", @@ -32,8 +35,8 @@ "http://jankfree.org/silk/text-mask.html", "http://jankfree.org/silk/rectangle_transition.html" ], - "key_silk_cases_006.wpr": [ - "http://jsfiddle.net/rF9Gh/3/embedded/result/" + "key_silk_cases_015.wpr": [ + "http://jsfiddle.net/bNp2h/3/show/" ], "key_silk_cases_008.wpr": [ "http://jsfiddle.net/jx5De/13/embedded/result" diff --git a/tools/perf/page_sets/data/key_silk_cases_015.wpr.sha1 b/tools/perf/page_sets/data/key_silk_cases_015.wpr.sha1 new file mode 100644 index 0000000000..3bedd11086 --- /dev/null +++ b/tools/perf/page_sets/data/key_silk_cases_015.wpr.sha1 @@ -0,0 +1 @@ +d317bc3db8953750f769dde1943e45e28d93052f
\ No newline at end of file diff --git a/tools/perf/page_sets/key_silk_cases.py b/tools/perf/page_sets/key_silk_cases.py index b5bbe7203c..36f8ed3b10 100644 --- a/tools/perf/page_sets/key_silk_cases.py +++ b/tools/perf/page_sets/key_silk_cases.py @@ -249,7 +249,7 @@ class Page14(KeySilkCasesPage): def __init__(self, page_set): super(Page14, self).__init__( - url='http://jsfiddle.net/bNp2h/2/show/', + url='http://jsfiddle.net/bNp2h/3/show/', page_set=page_set) self.gpu_raster = True diff --git a/tools/perf/page_sets/top_10.py b/tools/perf/page_sets/top_10.py index d234c5144d..0eb4e7ca80 100644 --- a/tools/perf/page_sets/top_10.py +++ b/tools/perf/page_sets/top_10.py @@ -97,7 +97,8 @@ class Top10PageSet(page_set_module.PageSet): self.AddPage(Google(self)) # productivity, top google properties - self.AddPage(Gmail(self)) + # TODO(dominikg): fix crbug.com/386152 + #self.AddPage(Gmail(self)) # productivity, top google properties self.AddPage(GoogleCalendar(self)) diff --git a/tools/perf/page_sets/tough_energy_cases.py b/tools/perf/page_sets/tough_energy_cases.py index fe08f7a5d4..bf1eceb058 100644 --- a/tools/perf/page_sets/tough_energy_cases.py +++ b/tools/perf/page_sets/tough_energy_cases.py @@ -46,7 +46,8 @@ class ToughEnergyCasesPageSet(page_set_module.PageSet): self.AddPage(ToughEnergyCasesPage( 'file://tough_energy_cases/above-fold-animated-gif.html', self)) - self.AddPage(GmailPage(self)) + # TODO(dominikg): fix crbug.com/386152 + #self.AddPage(GmailPage(self)) # Why: Below the fold animated gif self.AddPage(ToughEnergyCasesPage( 'file://tough_energy_cases/below-fold-animated-gif.html', diff --git a/tools/perf_expectations/perf_expectations.json b/tools/perf_expectations/perf_expectations.json index 09373c536d..0eb56f3aa0 100644 --- a/tools/perf_expectations/perf_expectations.json +++ b/tools/perf_expectations/perf_expectations.json @@ -363,7 +363,7 @@ "linux-release/media_tests_av_perf/ttp/Wifi_dartmoor2.wav": {"reva": 155180, "revb": 155280, "type": "absolute", "better": "lower", "improve": 6893, "regress": 7758, "sha1": "7a3ab979"}, "linux-release/media_tests_av_perf/ttp/Wifi_roller.webm": {"reva": 175328, "revb": 176157, "type": "absolute", "better": "lower", "improve": 867.35, "regress": 1041.075, "sha1": "d99ce51c"}, "linux-release/sizes/chrome-bss/bss": {"reva": 260243, "revb": 260270, "type": "absolute", "better": "lower", "improve": 324470, "regress": 358626, "sha1": "85f07232"}, - "linux-release/sizes/chrome-data/data": {"reva": 278187, "revb": 278187, "type": "absolute", "better": "lower", "improve": 2244568, "regress": 2481041, "sha1": "4a22b665"}, + "linux-release/sizes/chrome-data/data": {"reva": 278701, "revb": 278731, "type": "absolute", "better": "lower", "improve": 2357189, "regress": 2605382, "sha1": "58df287b"}, "linux-release/sizes/chrome-si/initializers": {"reva": 271424, "revb": 271424, "type": "absolute", "better": "lower", "improve": 9, "regress": 9, "tolerance": 0, "sha1": "38bcd080"}, "linux-release/sizes/chrome-text/text": {"reva": 270042, "revb": 270042, "type": "absolute", "better": "lower", "improve": 94239231, "regress": 104159151, "sha1": "31ad82ec"}, "linux-release/sizes/chrome-textrel/textrel": {"reva": 234134, "revb": 234142, "type": "absolute", "better": "lower", "improve": 0, "regress": 0, "sha1": "61db9eaf"}, diff --git a/tools/post_perf_builder_job.py b/tools/post_perf_builder_job.py index 00262c95e5..97c6eccb02 100644 --- a/tools/post_perf_builder_job.py +++ b/tools/post_perf_builder_job.py @@ -20,13 +20,13 @@ BUILDER_JSON_URL = ('%(server_url)s/json/builders/%(bot_name)s/builds/' BUILDER_HTML_URL = ('%(server_url)s/builders/%(bot_name)s/builds/%(build_num)s') # Tryserver buildbots status page -TRY_SERVER_URL = 'http://build.chromium.org/p/tryserver.chromium' +TRY_SERVER_URL = 'http://build.chromium.org/p/tryserver.chromium.perf' # Hostname of the tryserver where perf bisect builders are hosted. This is used # for posting build request to tryserver. BISECT_BUILDER_HOST = 'master4.golo.chromium.org' # 'try_job_port' on tryserver to post build request. -BISECT_BUILDER_PORT = 8328 +BISECT_BUILDER_PORT = 8341 # From buildbot.status.builder. diff --git a/tools/resources/optimize-png-files.sh b/tools/resources/optimize-png-files.sh index c40e78d4cd..ee2225c0a3 100755 --- a/tools/resources/optimize-png-files.sh +++ b/tools/resources/optimize-png-files.sh @@ -18,6 +18,7 @@ readonly ALL_DIRS=" ash/resources +chrome/android/java/res chrome/app/theme chrome/browser/resources chrome/renderer/resources diff --git a/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py b/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py index 7717df6459..9fa00e5f9e 100644 --- a/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py +++ b/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py @@ -15,9 +15,12 @@ DEFAULT_TRACE_CATEGORIES = None # Categories for absolute minimum overhead tracing. This contains no # sub-traces of thread tasks, so it's only useful for capturing the # cpu-time spent on threads (as well as needed benchmark traces) +# FIXME: Remove webkit.console when blink.console lands in chromium and +# the ref builds are updated. crbug.com/386847 MINIMAL_TRACE_CATEGORIES = ("toplevel," "benchmark," "webkit.console," + "blink.console," "trace_event_overhead") diff --git a/tools/telemetry/telemetry/core/platform/__init__.py b/tools/telemetry/telemetry/core/platform/__init__.py index 70c423f7f7..f183454f0f 100644 --- a/tools/telemetry/telemetry/core/platform/__init__.py +++ b/tools/telemetry/telemetry/core/platform/__init__.py @@ -133,7 +133,7 @@ class Platform(object): def IsApplicationRunning(self, application): """Returns whether an application is currently running.""" - return self._platform_backend.IsApplicationLaunchning(application) + return self._platform_backend.IsApplicationRunning(application) def CanLaunchApplication(self, application): """Returns whether the platform can launch the given application.""" diff --git a/tools/telemetry/telemetry/core/platform/posix_platform_backend.py b/tools/telemetry/telemetry/core/platform/posix_platform_backend.py index 9a867fd040..4990452600 100644 --- a/tools/telemetry/telemetry/core/platform/posix_platform_backend.py +++ b/tools/telemetry/telemetry/core/platform/posix_platform_backend.py @@ -31,7 +31,7 @@ class PosixPlatformBackend(desktop_platform_backend.DesktopPlatformBackend): Args: columns: A list of require columns, e.g., ['pid', 'pss']. - pid: If nont None, returns only the information of the process + pid: If not None, returns only the information of the process with the pid. """ args = ['ps'] @@ -71,6 +71,12 @@ class PosixPlatformBackend(desktop_platform_backend.DesktopPlatformBackend): def CanLaunchApplication(self, application): return bool(distutils.spawn.find_executable(application)) + def IsApplicationRunning(self, application): + ps_output = self._GetPsOutput(['command']) + application_re = re.compile( + '(.*%s|^)%s(\s|$)' % (os.path.sep, application)) + return any(application_re.match(cmd) for cmd in ps_output) + def LaunchApplication( self, application, parameters=None, elevate_privilege=False): assert application, 'Must specify application to launch' diff --git a/tools/telemetry/telemetry/core/platform/posix_platform_backend_unittest.py b/tools/telemetry/telemetry/core/platform/posix_platform_backend_unittest.py index 4a58e60731..b41cd52ea7 100644 --- a/tools/telemetry/telemetry/core/platform/posix_platform_backend_unittest.py +++ b/tools/telemetry/telemetry/core/platform/posix_platform_backend_unittest.py @@ -1,8 +1,12 @@ # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import os +import sys import unittest +from telemetry import test +from telemetry.core.platform import factory from telemetry.core.platform import posix_platform_backend @@ -46,3 +50,13 @@ class PosixPlatformBackendTest(unittest.TestCase): backend.SetMockPsOutput([' 1 0 S ', ' 2 1', '3 2 ']) result = backend.GetChildPids(1) self.assertEquals(set(result), set([2, 3])) + + @test.Enabled('linux', 'mac') + def testIsApplicationRunning(self): + backend = factory.GetPlatformBackendForCurrentOS() + + self.assertFalse(backend.IsApplicationRunning('This_Is_A_Bad___App__Name')) + sys_exe = os.path.basename(sys.executable) + self.assertTrue(backend.IsApplicationRunning(sys_exe)) + self.assertFalse( + backend.IsApplicationRunning('%s append_bad_after_space' % sys_exe)) diff --git a/tools/telemetry/telemetry/core/platform/profiler/perf_profiler.py b/tools/telemetry/telemetry/core/platform/profiler/perf_profiler.py index 6b460d98f6..139cd3783b 100644 --- a/tools/telemetry/telemetry/core/platform/profiler/perf_profiler.py +++ b/tools/telemetry/telemetry/core/platform/profiler/perf_profiler.py @@ -172,7 +172,7 @@ class PerfProfiler(profiler.Profiler): device = browser_backend.adb.device() perf_binary = android_profiling_helper.PrepareDeviceForPerf(device) self._perf_control = perf_control.PerfControl(device) - self._perf_control.ForceAllCpusOnline(True) + self._perf_control.SetPerfProfilingMode() else: _PrepareHostForPerf() @@ -185,7 +185,7 @@ class PerfProfiler(profiler.Profiler): perf_binary, perfhost_binary)) except: if self._is_android: - self._perf_control.ForceAllCpusOnline(False) + self._perf_control.SetDefaultPerfMode() raise @classmethod @@ -209,7 +209,7 @@ class PerfProfiler(profiler.Profiler): def CollectProfile(self): if self._is_android: - self._perf_control.ForceAllCpusOnline(False) + self._perf_control.SetDefaultPerfMode() output_files = [] for single_process in self._process_profilers: output_files.append(single_process.CollectProfile()) diff --git a/tools/telemetry/telemetry/page/cloud_storage.py b/tools/telemetry/telemetry/page/cloud_storage.py index 2c54785748..78f7db2bc2 100644 --- a/tools/telemetry/telemetry/page/cloud_storage.py +++ b/tools/telemetry/telemetry/page/cloud_storage.py @@ -13,6 +13,7 @@ import sys import tarfile import urllib2 +from telemetry.core.backends.chrome import cros_interface from telemetry.core import util @@ -23,7 +24,9 @@ INTERNAL_BUCKET = 'chrome-telemetry' _GSUTIL_URL = 'http://storage.googleapis.com/pub/gsutil.tar.gz' _DOWNLOAD_PATH = os.path.join(util.GetTelemetryDir(), 'third_party', 'gsutil') - +# TODO(tbarzic): A workaround for http://crbug.com/386416 and +# http://crbug.com/359293. See |_RunCommand|. +_CROS_GSUTIL_HOME_WAR = '/home/chromeos-test/' class CloudStorageError(Exception): @staticmethod @@ -31,6 +34,8 @@ class CloudStorageError(Exception): if SupportsProdaccess(gsutil_path) and _FindExecutableInPath('prodaccess'): return 'Run prodaccess to authenticate.' else: + if cros_interface.IsRunningOnCrosDevice(): + gsutil_path = ('HOME=%s %s' % (_CROS_GSUTIL_HOME_WAR, gsutil_path)) return ('To configure your credentials:\n' ' 1. Run "%s config" and follow its instructions.\n' ' 2. If you have a @google.com account, use that account.\n' @@ -99,8 +104,21 @@ def SupportsProdaccess(gsutil_path): def _RunCommand(args): gsutil_path = FindGsutil() + # On cros device, as telemetry is running as root, home will be set to /root/, + # which is not writable. gsutil will attempt to create a download tracker dir + # in home dir and fail. To avoid this, override HOME dir to something writable + # when running on cros device. + # + # TODO(tbarzic): Figure out a better way to handle gsutil on cros. + # http://crbug.com/386416, http://crbug.com/359293. + gsutil_env = None + if cros_interface.IsRunningOnCrosDevice(): + gsutil_env = os.environ.copy() + gsutil_env['HOME'] = _CROS_GSUTIL_HOME_WAR + gsutil = subprocess.Popen([sys.executable, gsutil_path] + args, - stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + env=gsutil_env) stdout, stderr = gsutil.communicate() if gsutil.returncode: @@ -110,7 +128,8 @@ def _RunCommand(args): raise CredentialsError(gsutil_path) if 'status=403' in stderr or 'status 403' in stderr: raise PermissionError(gsutil_path) - if stderr.startswith('InvalidUriError') or 'No such object' in stderr: + if (stderr.startswith('InvalidUriError') or 'No such object' in stderr or + 'No URLs matched' in stderr): raise NotFoundError(stderr) raise CloudStorageError(stderr) diff --git a/tools/telemetry/telemetry/results/gtest_test_results.py b/tools/telemetry/telemetry/results/gtest_test_results.py index 2764ed9b43..5f30a7b141 100644 --- a/tools/telemetry/telemetry/results/gtest_test_results.py +++ b/tools/telemetry/telemetry/results/gtest_test_results.py @@ -5,7 +5,6 @@ import logging import sys import time -import unittest from telemetry.results import page_test_results @@ -22,46 +21,37 @@ class GTestTestResults(page_test_results.PageTestResults): def num_errors(self): return len(self.errors) + len(self.failures) - @staticmethod - def _formatTestname(test): - if isinstance(test, unittest.TestCase): - chunks = test.id().split('.')[2:] - return '.'.join(chunks) - else: - return str(test) - - def _emitFailure(self, test, err): - print >> self._output_stream, self._exc_info_to_string(err, test) - test_name = GTestTestResults._formatTestname(test) - print >> self._output_stream, '[ FAILED ]', test_name, ( + def _emitFailure(self, page, err): + print >> self._output_stream, self._GetStringFromExcInfo(err) + print >> self._output_stream, '[ FAILED ]', page.display_name, ( '(%0.f ms)' % self._GetMs()) sys.stdout.flush() - def addError(self, test, err): - super(GTestTestResults, self).addError(test, err) - self._emitFailure(test, err) + def AddError(self, page, err): + super(GTestTestResults, self).AddError(page, err) + self._emitFailure(page, err) - def addFailure(self, test, err): - super(GTestTestResults, self).addFailure(test, err) - self._emitFailure(test, err) + def AddFailure(self, page, err): + super(GTestTestResults, self).AddFailure(page, err) + self._emitFailure(page, err) - def startTest(self, test): - super(GTestTestResults, self).startTest(test) + def StartTest(self, page): + super(GTestTestResults, self).StartTest(page) print >> self._output_stream, '[ RUN ]', ( - GTestTestResults._formatTestname(test)) + page.display_name) sys.stdout.flush() self._timestamp = time.time() - def addSuccess(self, test): - super(GTestTestResults, self).addSuccess(test) - test_name = GTestTestResults._formatTestname(test) + def AddSuccess(self, page): + super(GTestTestResults, self).AddSuccess(page) + test_name = page.display_name print >> self._output_stream, '[ OK ]', test_name, ( '(%0.f ms)' % self._GetMs()) sys.stdout.flush() - def addSkip(self, test, reason): - super(GTestTestResults, self).addSkip(test, reason) - test_name = GTestTestResults._formatTestname(test) + def AddSkip(self, page, reason): + super(GTestTestResults, self).AddSkip(page, reason) + test_name = page.display_name logging.warning('===== SKIPPING TEST %s: %s =====', test_name, reason) if self._timestamp == None: self._timestamp = time.time() @@ -79,10 +69,9 @@ class GTestTestResults(page_test_results.PageTestResults): unit = 'test' if len(all_errors) == 1 else 'tests' print >> self._output_stream, '[ FAILED ]', ( '%d %s, listed below:' % (len(all_errors), unit)) - for test, _ in all_errors: + for page, _ in all_errors: print >> self._output_stream, '[ FAILED ] ', ( - GTestTestResults._formatTestname(test)) - if not self.wasSuccessful(): + page.display_name) print >> self._output_stream count = len(self.errors) + len(self.failures) unit = 'TEST' if count == 1 else 'TESTS' diff --git a/tools/telemetry/telemetry/results/gtest_test_results_unittest.py b/tools/telemetry/telemetry/results/gtest_test_results_unittest.py index 7175f10aa5..b7ad5a85ea 100644 --- a/tools/telemetry/telemetry/results/gtest_test_results_unittest.py +++ b/tools/telemetry/telemetry/results/gtest_test_results_unittest.py @@ -86,6 +86,18 @@ class GTestTestResultsTest( '1 FAILED TEST\n\n' % exception_trace) self.assertEquals(expected, ''.join(results.output_data)) + def testSingleSkippedPage(self): + test_page_set = _MakePageSet() + results = SummaryGtestTestResults() + results.StartTest(test_page_set.pages[0]) + self._mock_timer.SetTime(0.007) + results.AddSkip(test_page_set.pages[0], 'Page skipped for testing reason') + results.PrintSummary() + expected = ('[ RUN ] http://www.foo.com/\n' + '[ OK ] http://www.foo.com/ (7 ms)\n' + '[ PASSED ] 0 tests.\n\n') + self.assertEquals(expected, ''.join(results.output_data)) + def testPassAndFailedPages(self): test_page_set = _MakePageSet() results = SummaryGtestTestResults() @@ -126,5 +138,27 @@ class GTestTestResultsTest( '2 FAILED TESTS\n\n' % (exception_trace, exception_trace)) self.assertEquals(expected, ''.join(results.output_data)) + def testStreamingResults(self): + test_page_set = _MakePageSet() + results = SummaryGtestTestResults() + exception = self.CreateException() + + results.StartTest(test_page_set.pages[0]) + self._mock_timer.SetTime(0.007) + results.AddSuccess(test_page_set.pages[0]) + expected = ('[ RUN ] http://www.foo.com/\n' + '[ OK ] http://www.foo.com/ (7 ms)\n') + self.assertEquals(expected, ''.join(results.output_data)) + + results.StartTest(test_page_set.pages[1]) + self._mock_timer.SetTime(0.009) + exception_trace = ''.join(traceback.format_exception(*exception)) + results.AddError(test_page_set.pages[1], exception) + expected = ('[ RUN ] http://www.foo.com/\n' + '[ OK ] http://www.foo.com/ (7 ms)\n' + '[ RUN ] http://www.bar.com/\n' + '%s\n' + '[ FAILED ] http://www.bar.com/ (2 ms)\n' % exception_trace) + def tearDown(self): gtest_test_results.time.time = self._real_gtest_time_time diff --git a/tools/telemetry/telemetry/results/page_test_results.py b/tools/telemetry/telemetry/results/page_test_results.py index f9cb0f8486..f6314d9768 100644 --- a/tools/telemetry/telemetry/results/page_test_results.py +++ b/tools/telemetry/telemetry/results/page_test_results.py @@ -7,15 +7,17 @@ import copy import logging import sys import traceback -import unittest -class PageTestResults(unittest.TestResult): + +class PageTestResults(object): def __init__(self, output_stream=None): super(PageTestResults, self).__init__() self._output_stream = output_stream self.pages_that_had_errors = set() self.pages_that_had_failures = set() self.successes = [] + self.errors = [] + self.failures = [] self.skipped = [] def __copy__(self): @@ -32,38 +34,28 @@ class PageTestResults(unittest.TestResult): return self.pages_that_had_errors.union( self.pages_that_had_failures) - def _exc_info_to_string(self, err, test): - if isinstance(test, unittest.TestCase): - return super(PageTestResults, self)._exc_info_to_string(err, test) - else: - return ''.join(traceback.format_exception(*err)) - - def addSuccess(self, test): - self.successes.append(test) - - def addSkip(self, test, reason): # Python 2.7 has this in unittest.TestResult - logging.warning('%s\n%s\nSkipping page.', test, reason) - self.skipped.append((test, reason)) + def _GetStringFromExcInfo(self, err): + return ''.join(traceback.format_exception(*err)) def StartTest(self, page): - self.startTest(page.display_name) + pass def StopTest(self, page): - self.stopTest(page.display_name) + pass def AddError(self, page, err): self.pages_that_had_errors.add(page) - self.addError(page.display_name, err) + self.errors.append((page, self._GetStringFromExcInfo(err))) def AddFailure(self, page, err): self.pages_that_had_failures.add(page) - self.addFailure(page.display_name, err) - - def AddSuccess(self, page): - self.addSuccess(page.display_name) + self.failures.append((page, self._GetStringFromExcInfo(err))) def AddSkip(self, page, reason): - self.addSkip(page.display_name, reason) + self.skipped.append((page, reason)) + + def AddSuccess(self, page): + self.successes.append(page) def AddFailureMessage(self, page, message): try: @@ -79,10 +71,13 @@ class PageTestResults(unittest.TestResult): def PrintSummary(self): if self.failures: - logging.error('Failed pages:\n%s', '\n'.join(zip(*self.failures)[0])) + logging.error('Failed pages:\n%s', '\n'.join( + p.display_name for p in zip(*self.failures)[0])) if self.errors: - logging.error('Errored pages:\n%s', '\n'.join(zip(*self.errors)[0])) + logging.error('Errored pages:\n%s', '\n'.join( + p.display_name for p in zip(*self.errors)[0])) if self.skipped: - logging.warning('Skipped pages:\n%s', '\n'.join(zip(*self.skipped)[0])) + logging.warning('Skipped pages:\n%s', '\n'.join( + p.display_name for p in zip(*self.skipped)[0])) diff --git a/tools/telemetry/telemetry/results/page_test_results_unittest.py b/tools/telemetry/telemetry/results/page_test_results_unittest.py index 2aef9ed8a7..482d02077c 100644 --- a/tools/telemetry/telemetry/results/page_test_results_unittest.py +++ b/tools/telemetry/telemetry/results/page_test_results_unittest.py @@ -32,8 +32,7 @@ class PageTestResultsTest(base_test_results_unittest.BaseTestResultsUnittest): results.AddSuccess(self.pages[1]) self.assertEquals(results.pages_that_had_failures, set([self.pages[0]])) - self.assertEquals(results.successes, - [self.pages[1].display_name]) + self.assertEquals(results.successes, [self.pages[1]]) def test_errors(self): results = NonPrintingPageTestResults() @@ -41,8 +40,7 @@ class PageTestResultsTest(base_test_results_unittest.BaseTestResultsUnittest): results.AddSuccess(self.pages[1]) self.assertEquals(results.pages_that_had_errors, set([self.pages[0]])) - self.assertEquals(results.successes, - [self.pages[1].display_name]) + self.assertEquals(results.successes, [self.pages[1]]) def test_errors_and_failures(self): results = NonPrintingPageTestResults() @@ -51,5 +49,4 @@ class PageTestResultsTest(base_test_results_unittest.BaseTestResultsUnittest): results.AddSuccess(self.pages[2]) self.assertEquals(results.pages_that_had_errors_or_failures, set([self.pages[0], self.pages[1]])) - self.assertEquals(results.successes, - [self.pages[2].display_name]) + self.assertEquals(results.successes, [self.pages[2]]) diff --git a/tools/telemetry/telemetry/test.py b/tools/telemetry/telemetry/test.py index c89ba8ef86..4df4bde0b4 100644 --- a/tools/telemetry/telemetry/test.py +++ b/tools/telemetry/telemetry/test.py @@ -38,11 +38,7 @@ class Test(command_line.Command): if hasattr(cls, 'tag'): name += '.' + cls.tag if hasattr(cls, 'page_set'): - if isinstance(cls.page_set, basestring): - # TODO(dtu): Remove this code path after crbug.com/362293. - name += '.' + os.path.basename(os.path.splitext(cls.page_set)[0]) - else: - name += '.' + cls.page_set.Name() + name += '.' + cls.page_set.Name() return name @classmethod @@ -186,14 +182,7 @@ class Test(command_line.Command): By default, it will create a page set from the file at this test's page_set attribute. Override to generate a custom page set. """ - if not hasattr(cls, 'page_set'): - raise NotImplementedError('This test has no "page_set" attribute.') - if isinstance(cls.page_set, basestring): - # TODO(dtu): Remove this code path after crbug.com/362293. - return page_set.PageSet.FromFile( - file_path=os.path.join(util.GetBaseDir(), cls.page_set)) - else: - return cls.PageSetClass()() + return cls.PageSetClass()() @classmethod def CreateExpectations(cls, ps): # pylint: disable=W0613 diff --git a/tools/valgrind/chrome_tests.py b/tools/valgrind/chrome_tests.py index 84e4573fb8..c619dfed45 100755 --- a/tools/valgrind/chrome_tests.py +++ b/tools/valgrind/chrome_tests.py @@ -418,6 +418,9 @@ class ChromeTests: return self.SimpleTest("mojo_view_manager_lib", "mojo_view_manager_lib_unittests") + def TestDisplay(self): + return self.SimpleTest("display", "display_unittests") + # Valgrind timeouts are in seconds. UI_VALGRIND_ARGS = ["--timeout=14400", "--trace_children", "--indirect"] # UI test timeouts are in milliseconds. @@ -661,6 +664,7 @@ class ChromeTests: "mojo_service_manager": TestMojoServiceManager, "mojo_view_manager": TestMojoViewManager, "mojo_view_manager_lib": TestMojoViewManagerLib, + "display": TestDisplay, } diff --git a/tools/valgrind/drmemory/suppressions.txt b/tools/valgrind/drmemory/suppressions.txt index b85decbdd9..4536e2e4fc 100644 --- a/tools/valgrind/drmemory/suppressions.txt +++ b/tools/valgrind/drmemory/suppressions.txt @@ -604,3 +604,20 @@ npapi_test_plugin.dll!NP_Initialize *!content::PluginLib::NP_Initialize *!content::PluginThread::PluginThread *!content::PluginMain + +UNADDRESSABLE ACCESS +name=http://crbug.com/313788 +*!InProcessBrowserTest::AddBlankTabAndShow +*!InProcessBrowserTest::CreateBrowser +*!*::RunTestOnMainThread +*!InProcessBrowserTest::RunTestOnMainThreadLoop +*!ChromeBrowserMainParts::PreMainMessageLoopRunImpl +*!ChromeBrowserMainParts::PreMainMessageLoopRun + +UNADDRESSABLE ACCESS +name=http://crbug.com/386711 +*!IntranetRedirectDetector::FinishSleep + +UNADDRESSABLE ACCESS +name=http://crbug.com/386741 +*!WebResourceService::StartFetch diff --git a/tools/valgrind/gtest_exclude/browser_tests.gtest-drmemory_win32.txt b/tools/valgrind/gtest_exclude/browser_tests.gtest-drmemory_win32.txt index 1030193039..15c73b9b09 100644 --- a/tools/valgrind/gtest_exclude/browser_tests.gtest-drmemory_win32.txt +++ b/tools/valgrind/gtest_exclude/browser_tests.gtest-drmemory_win32.txt @@ -8,12 +8,46 @@ # it takes too long to run all browser_tests with Dr.Memory, # and we only select subset to run -# A*: ~120 tests -A* -#B* -C* -D* -E* +# A* +Act* +Adv* +All* +AppA* +AppL* +AppW* +Autof*.Do* +Autof*.Hi* +Autof*Edit* +AutofillTest.* +# B* +BackgroundApp*.R* +Bluetooth* +BitmapFetcher* +BookmarksT* +BrowserAcc* +BrowserActionA*.* +BrowserCloseM* +BrowserN* +BrowserT* +# C* +Cap* +Cas* +Clear* +Click* +Com* +ChromeC* +ChromeR* +Con*UITest.* +Con*.Re* +# D* +Dec* +Dev* +DnsP* +DoNot* +Down*Ext*.* +DownloadTest.* +Drive* +# E* F* G* H* diff --git a/tools/valgrind/gtest_exclude/content_unittests.gtest_mac.txt b/tools/valgrind/gtest_exclude/content_unittests.gtest_mac.txt index 14514d7a42..f341d691e3 100644 --- a/tools/valgrind/gtest_exclude/content_unittests.gtest_mac.txt +++ b/tools/valgrind/gtest_exclude/content_unittests.gtest_mac.txt @@ -54,3 +54,6 @@ GamepadProviderTest.UserGesture AppCacheRequestHandlerTest.* AppCacheResponseTest.* AppCacheStorageImplTest.* +AppCacheStorageImplTest.* +AppCacheUpdateJobTest.AlreadyChecking +AppCacheUpdateJobTest.ManifestMissingMimeTypeTest diff --git a/tools/valgrind/gtest_exclude/media_unittests.gtest-tsan.txt b/tools/valgrind/gtest_exclude/media_unittests.gtest-tsan.txt index aa38916dc0..2ebf65d291 100644 --- a/tools/valgrind/gtest_exclude/media_unittests.gtest-tsan.txt +++ b/tools/valgrind/gtest_exclude/media_unittests.gtest-tsan.txt @@ -1,4 +1,2 @@ # Times out. http://crbug.com/385222 -FFmpegVideoDecoderTest.Initialize_Normal -FFmpegVideoDecoderTest.Reinitialize_Failure -FFmpegVideoDecoderTest.Reinitialize_Normal +FFmpegVideoDecoderTest.* diff --git a/tools/valgrind/gtest_exclude/remoting_unittests.gtest-tsan.txt b/tools/valgrind/gtest_exclude/remoting_unittests.gtest-tsan.txt index 2634bb2821..24df38d7f0 100644 --- a/tools/valgrind/gtest_exclude/remoting_unittests.gtest-tsan.txt +++ b/tools/valgrind/gtest_exclude/remoting_unittests.gtest-tsan.txt @@ -1,4 +1,4 @@ # Times out. http://crbug.com/385222 VideoDecoderVp8Test.* VideoEncoderVpxTest.* -ChromotingHostTest.Connect +ChromotingHostTest.* diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt index bd70d57c76..68621d8bfe 100644 --- a/tools/valgrind/memcheck/suppressions.txt +++ b/tools/valgrind/memcheck/suppressions.txt @@ -4635,28 +4635,6 @@ fun:_ZN11dom_storage17DomStorageContext18DeleteLocalStorageERK4GURL } { - bug_181082 - Memcheck:Leak - fun:_Znw* - fun:_ZN12_GLOBAL__N_124ResourceLoaderBridgeImpl5StartEPN11webkit_glue20ResourceLoaderBridge4PeerE - fun:_ZN11webkit_glue16WebURLLoaderImpl7Context5StartERKN5blink13WebURLRequestEPNS_20ResourceLoaderBridge16SyncLoadResponseEPNS_25WebKitPlatformSupportImplE - fun:_ZN11webkit_glue16WebURLLoaderImpl18loadAsynchronouslyERKN5blink13WebURLRequestEPNS1_18WebURLLoaderClientE - fun:_ZN7WebCore22ResourceHandleInternal5start* - ... - fun:_ZN7WebCore14CachedResource4loadEPNS_20CachedResourceLoaderERKNS_21ResourceLoaderOptionsE - fun:_ZN7WebCore20CachedResourceLoader15requestResourceENS_14CachedResource4TypeERNS_21CachedResourceRequestE -} -{ - bug_181680 - Memcheck:Leak - fun:_Znw* - fun:_ZN7WebCore11ScriptState10forContextEN2v85LocalINS1_7ContextEEE - fun:_ZN7WebCore17ScriptDebugServer12breakProgramEN2v86HandleINS1_6ObjectEEENS2_INS1_5ValueEEE - fun:_ZN7WebCore17ScriptDebugServer18handleV8DebugEventERKN2v85Debug12EventDetailsE - fun:_ZN7WebCore17ScriptDebugServer20v8DebugEventCallbackERKN2v85Debug12EventDetailsE - fun:_ZN2v88internal8Debugger18CallCEventCallbackENS_10DebugEventENS0_6HandleINS0_6ObjectEEES5_PNS_5Debug10ClientDataE -} -{ bug_181680b Memcheck:Leak fun:_Znw* @@ -4738,18 +4716,6 @@ fun:_ZN12TokenService10InitializeEPKcP7Profile } { - bug_222880 - Memcheck:Leak - fun:malloc - fun:_ZN3WTF10fastMallocEm - fun:_ZN3WTF16VectorBufferBaseINS_6RefPtrIN7WebCore7ArchiveEEEE14allocateBufferEm - ... - fun:_ZN7WebCore7Archive18addSubframeArchiveEN3WTF10PassRefPtrIS0_EE - fun:_ZN7WebCore11MHTMLParser22parseArchiveWithHeaderEPNS_10MIMEHeaderE - fun:_ZN7WebCore11MHTMLParser12parseArchiveEv - fun:_ZN7WebCore12MHTMLArchive6createERKNS_4KURLEPNS_12SharedBufferE -} -{ bug_222883 Memcheck:Uninitialized fun:_ZN2v88internal15ScavengeVisitor15ScavengePointerEPPNS0_6ObjectE.isra.* @@ -4760,16 +4726,6 @@ fun:_ZN2v88internal4Heap24PerformGarbageCollectionENS0_16GarbageCollectorEPNS0_8GCTracer* } { - bug_222887 - Memcheck:Leak - fun:_Znw* - fun:_ZN6webkit3gpu18GLInProcessContext10InitializeERKN3gfx4SizeEPS1_PKcPKiNS2_13GpuPreferenceE - fun:_ZN6webkit3gpu18GLInProcessContext22CreateOffscreenContextEPS1_RKN3gfx4SizeES2_PKcPKiNS3_13GpuPreferenceE - fun:_ZN6webkit3gpu46WebGraphicsContext3DInProcessCommandBufferImpl10InitializeEN5blink20WebGraphicsContext3D10AttributesEPS3_ - fun:_ZN25TestWebKitPlatformSupport32createOffscreenGraphicsContext3DERKN5blink20WebGraphicsContext3D10AttributesE - fun:_ZN7WebCore17GraphicsContext3D6createENS0_10AttributesEPNS_10HostWindowENS0_11RenderStyleE -} -{ bug_222898 Memcheck:Leak fun:malloc @@ -4946,23 +4902,6 @@ fun:_ZN7content14RenderViewImpl20SetWebkitPreferencesERK14WebPreferences } { - bug_241932 - Memcheck:Leak - fun:calloc - fun:_ZN3WTF13tryFastCallocEmm - fun:_ZN3WTF9RawBufferC1EjjNS0_20InitializationPolicyE - fun:_ZN3WTF19ArrayBufferContentsC1EjjNS_9RawBuffer20InitializationPolicyE - fun:_ZN3WTF11ArrayBuffer6createEPKvj - fun:_ZN7WebCore12_GLOBAL__N_16Reader17doReadArrayBufferEv - fun:_ZN7WebCore12_GLOBAL__N_16Reader15readArrayBufferEPN2v86HandleINS2_5ValueEEE - fun:_ZN7WebCore12_GLOBAL__N_16Reader4readEPN2v86HandleINS2_5ValueEEERNS0_16CompositeCreatorE - fun:_ZN7WebCore12_GLOBAL__N_112Deserializer13doDeserializeEv - fun:_ZN7WebCore12_GLOBAL__N_112Deserializer11deserializeEv - fun:_ZN7WebCore21SerializedScriptValue11deserializeEPN2v87IsolateEPN3WTF6VectorINS4_6RefPtrINS_11MessagePortEEELm1EEE - fun:_ZN7WebCore14V8MessageEvent20dataAttrGetterCustomEN2v85LocalINS1_6StringEEERKNS1_12AccessorInfoE - fun:_ZN7WebCore22MessageEventV8InternalL22dataAttrGetterCallbackEN2v85LocalINS1_6StringEEERKNS1_12AccessorInfoE -} -{ bug_242672 Memcheck:Leak fun:malloc @@ -4989,18 +4928,6 @@ fun:_ZN7WebCore27CSSComputedStyleDeclaration16getPropertyValueERKN3WTF6StringE } { - bug_243137 - Memcheck:Leak - fun:_Znw* - fun:_ZN7WebCore11RenderStyle6createEv - fun:_ZN7WebCore13StyleResolver15styleForElementEPNS_7ElementEPNS_11RenderStyle* - fun:_ZN7WebCore7Element16styleForRendererEv - fun:_ZN7WebCore20NodeRenderingContext32createRendererForElementIfNeededEv - fun:_ZN7WebCore7Element22createRendererIfNeededEv - fun:_ZN7WebCore7Element6attachEv - fun:_ZN7WebCore22HTMLPlugInImageElement6attachEv -} -{ bug_243753 Memcheck:Leak fun:_Znw* @@ -5296,21 +5223,6 @@ fun:_ZN8autofill12_GLOBAL__N_149AutofillQueryXmlParserTest_ParseAutofillFlow_Test8TestBodyEv } { - bug_255718 - Memcheck:Leak - fun:_Znw* - fun:_ZN4base4BindIMNS_12_GLOBAL__N_121PostTaskAndReplyRelayEFvvENS_8internal17UnretainedWrapperIS2_EEEENS_8CallbackINS5_9BindStateINS5_13FunctorTraitsIT_E12RunnableTypeENSC_7RunTypeEFvNS5_19CallbackParamTraitsIT0_E11StorageTypeEEE14UnboundRunTypeEEESB_RKSG_ - fun:_ZN4base8internal20PostTaskAndReplyImpl16PostTaskAndReplyERKN15tracked_objects8LocationERKNS_8CallbackIFvvEEESA_ - fun:_ZN4base10TaskRunner16PostTaskAndReplyERKN15tracked_objects8LocationERKNS_8CallbackIFvvEEES9_ - fun:_ZN4base26PostTaskAndReplyWithResultIN5quota15QuotaStatusCodeES2_EEbPNS_10TaskRunnerERKN15tracked_objects8LocationERKNS_8CallbackIFT_vEEERKNS9_IFvT0_EEE - fun:_ZN7fileapi21FileSystemQuotaClient16DeleteOriginDataERK4GURLN5quota11StorageTypeERKN4base8CallbackIFvNS4_15QuotaStatusCodeEEEE - fun:_ZN5quota12QuotaManager17OriginDataDeleter3RunEv - fun:_ZN5quota9QuotaTask5StartEv - fun:_ZN5quota12QuotaManager16DeleteOriginDataERK4GURLNS_11StorageTypeEiRKN4base8CallbackIFvNS_15QuotaStatusCodeEEEE - fun:_ZN7content12_GLOBAL__N_134ClearQuotaManagedOriginsOnIOThreadERK13scoped_refptrIN5quota12QuotaManagerEERKSt3setI4GURLSt4lessIS8_ESaIS8_EENS2_11StorageTypeE - fun:_ZN7content12_GLOBAL__N_121ClearOriginOnIOThreadEjRK4GURLRK13scoped_refptrIN3net23URLRequestContextGetterEERKS4_IN5quota12QuotaManagerEE -} -{ bug_258132a Memcheck:Leak fun:_Znw* @@ -5479,34 +5391,6 @@ fun:_ZN18chrome_browser_net27HttpServerPropertiesManager24UpdatePrefsFromCacheOnIOEv } { - bug_290364 - Memcheck:Leak - fun:_Znw* - fun:_ZN4base13WaitableEventC1Ebb - fun:_ZN4base12_GLOBAL__N_112ThreadParamsC1Ev - fun:_ZN4base12_GLOBAL__N_112CreateThreadEmbPNS_14PlatformThread8DelegateEPNS_20PlatformThreadHandleENS_14ThreadPriorityE - fun:_ZN4base14PlatformThread6CreateEmPNS0_8DelegateEPNS_20PlatformThreadHandleE - fun:_ZN4base12SimpleThread5StartEv - fun:_ZN4base19SequencedWorkerPool6WorkerC1ERK13scoped_refptrIS0_EiRKSs - fun:_ZN4base19SequencedWorkerPool5Inner30FinishStartingAdditionalThreadEi - fun:_ZN4base19SequencedWorkerPool5Inner10ThreadLoopEPNS0_6WorkerE - fun:_ZN4base19SequencedWorkerPool6Worker3RunEv - fun:_ZN4base12SimpleThread10ThreadMainEv - fun:_ZN4base12_GLOBAL__N_110ThreadFuncEPv -} -{ - bug_290405 - Memcheck:Uninitialized - fun:_ZNK16GrGradientEffect9onIsEqualERK8GrEffect - fun:_ZNK8GrEffect7isEqualERKS_ - fun:_ZNK13GrEffectStage13DeferredStage7isEqualERKS_b - fun:_ZNK11GrDrawState13DeferredState7isEqualERKS_ - fun:_ZNK19GrInOrderDrawBuffer13needsNewStateEv - fun:_ZN19GrInOrderDrawBuffer6onDrawERKN12GrDrawTarget8DrawInfoE - fun:_ZN12GrDrawTarget20drawIndexedInstancesE15GrPrimitiveTypeiiiPK6SkRect - fun:_ZN13GrTextContext11flushGlyphsEv -} -{ bug_290407 Memcheck:Leak fun:calloc @@ -5528,48 +5412,6 @@ fun:_ZN7WebCore27OfflineAudioDestinationNode13offlineRenderEv } { - bug_290440 - Memcheck:Leak - fun:_Znw* - fun:_ZN7WebCore11ScriptState10forContextEN2v86HandleINS1_7ContextEEE - fun:_ZN7WebCore32scriptStateFromWorkerGlobalScopeEPNS_17WorkerGlobalScopeE - ... - fun:_ZN7WebCore13WorkerRunLoop9runInModeEPNS_17WorkerGlobalScopeERKNS_13ModePredicateENS0_8WaitModeE - fun:_ZN7WebCore13WorkerRunLoop3runEPNS_17WorkerGlobalScopeE - fun:_ZN7WebCore12WorkerThread12runEventLoopEv -} -{ - bug_290443 - Memcheck:Leak - fun:_Znw* - fun:_ZN7WebCore11ScriptState10forContextEN2v86HandleINS1_7ContextEEE - fun:_ZN7WebCore11ScriptState7currentEv - fun:_ZN7WebCore20ImageBitmapFactories17ImageBitmapLoaderC1EPS0_N3WTF10PassRefPtrINS_21ScriptPromiseResolverEEERKNS_7IntRectE - fun:_ZN7WebCore20ImageBitmapFactories17ImageBitmapLoader6createEPS0_N3WTF10PassRefPtrINS_21ScriptPromiseResolverEEERKNS_7IntRectE - fun:_ZN7WebCore20ImageBitmapFactories17createImageBitmapEPNS_11EventTargetEPNS_4BlobERNS_14ExceptionStateE - fun:_ZN7WebCore27WorkerGlobalScopeV8InternalL24createImageBitmap1MethodERKN2v820FunctionCallbackInfoINS1_5ValueEEE - fun:_ZN7WebCore27WorkerGlobalScopeV8InternalL23createImageBitmapMethodERKN2v820FunctionCallbackInfoINS1_5ValueEEE - fun:_ZN7WebCore27WorkerGlobalScopeV8InternalL31createImageBitmapMethodCallbackERKN2v820FunctionCallbackInfoINS1_5ValueEEE -} -{ - bug_290559a - Memcheck:Leak - fun:_Znw* - fun:_ZN7content12_GLOBAL__N_123WaitableCallbackResultsC1Ev - fun:_ZN7content12_GLOBAL__N_123WaitableCallbackResults11MaybeCreateEN5blink22WebFileSystemCallbacksE - ... - fun:_ZN2v88internal25FunctionCallbackArguments4Call* -} -{ - bug_290559b - Memcheck:Leak - fun:_Znw* - fun:_ZN7content12_GLOBAL__N_123WaitableCallbackResultsC1Ev - fun:_ZN7content12_GLOBAL__N_123WaitableCallbackResults11MaybeCreateEN5blink22WebFileSystemCallbacksE - ... - fun:_ZN7WebCore*SyncV8Internal*FunctionCallbackInfo* -} -{ bug_293024_b Memcheck:Leak fun:malloc @@ -5581,15 +5423,6 @@ fun:_ZN2v88internal25FunctionCallbackArguments4CallEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEE } { - bug_293033 - Memcheck:Leak - fun:_Znw* - fun:_ZN7WebCore11ScriptState10forContextEN2v86HandleINS1_7ContextEEE - ... - fun:_ZN7WebCore*V8InternalL*MethodERKN2v820FunctionCallbackInfoINS1_5ValueEEE - fun:_ZN7WebCore*V8InternalL*MethodCallbackERKN2v820FunctionCallbackInfoINS1_5ValueEEE -} -{ bug_293088 Memcheck:Unaddressable fun:_ZNK3WTF6RefPtrIN7WebCore19TextResourceDecoderEE3getEv @@ -5679,15 +5512,6 @@ fun:_ZN7WebCore34CanvasRenderingContext2DV8InternalL26getImageDataMethodCallbackERKN2v820FunctionCallbackInfoINS1_5ValueEEE } { - bug_309468 - Memcheck:Leak - fun:_Znw* - fun:_ZN19TranslateBubbleView25CreateViewBeforeTranslateEv - fun:_ZN19TranslateBubbleView4InitEv - fun:_ZN5views18BubbleDelegateView12CreateBubbleEPS0_ - fun:_ZN23TranslateBubbleViewTest5SetUpEv -} -{ bug_309477 Memcheck:Uninitialized fun:_ZN13WebTestRunner11EventSender5resetEv @@ -5834,17 +5658,6 @@ fun:_ZN2v88internal25FunctionCallbackArguments4CallEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEE } { - bug_332329 - Memcheck:Leak - fun:malloc - fun:_ZN3WTF10fastMallocEm - fun:_ZN3WTF24ThreadSafeRefCountedBasenwEm - fun:_ZN7WebCore7RawData6createEv - fun:_ZN7WebCore6Stream7addDataEPKcm - fun:_ZN7WebCore14XMLHttpRequest14didReceiveDataEPKci - fun:_ZN7WebCore24DocumentThreadableLoader14didReceiveDataEPKci -} -{ bug_332330 Memcheck:Leak fun:malloc @@ -6378,3 +6191,13 @@ fun:_ZN7WebCore11ImageLoader19doUpdateFromElementEb fun:_ZN7WebCore11ImageLoader4Task3runEv } +{ + bug_386418 + Memcheck:Leak + fun:_Znw* + fun:_ZN4base8internal20PostTaskAndReplyImpl16PostTaskAndReplyERKN15tracked_objects8LocationERKNS_8CallbackIFvvEEESA_ + fun:_ZN4base10WorkerPool16PostTaskAndReplyERKN15tracked_objects8LocationERKNS_8CallbackIFvvEEES9_b + fun:_ZN3net16HostResolverImpl16LoopbackProbeJobC1ERKN4base7WeakPtrIS0_EE + fun:_ZN3net16HostResolverImplC1ERKNS_12HostResolver7OptionsEPNS_6NetLogE + fun:_ZN8chromeos24HostResolverImplChromeOSC1E13* +} |