DOC PREVIEW
Purdue CS 59000 - Matching Program Versions

This preview shows page 1-2-20-21 out of 21 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Problem StatementMotivationsApproachesStatic ApproachesMOSSSlide 7Slide 8Slide 9Slide 10Slide 11Slide 12AST based matchingDECKARD (ICSE 2007)DECKARDCFG matchingCFG matchingSemantic Based MatchedSemantic BasedSlide 20Wrap UpCS590 Z Matching Program VersionsXiangyu ZhangCS590ZProblem StatementSuppose a program P’ is created by modifying P. Determine the difference between P and P’. For an artifact c’ in P’, decide if c’ belongs to the difference, if not, find the correspondence of c’ in P.•Static mapping•Non-trivialName comparison?What if •Clone analysis, comparison checkingCS590ZMotivationsValidate compiler transformationsFacilitate regression testingReverse obfuscationInformation propagationDebuggingCode plagiarism detectionInformation AssuranceCS590ZApproachesStatic Approaches•Entity name based•String based (MOSS)•AST based (DECKARD)•CFG based (JDIFF)•PDG based (PDIFF)•Binary based (BMAT)•Log based (editor plugin, comparison checking)Dynamic Approaches (not today)CS590ZStatic ApproachesEntity name matching•Model a function/field as tuples•Coarse grained matchingString matching•Diff (CVS, Subservion)•Longest common subsequence (LCS)Available operations are addition and deletionMatched pairs can not cross one anotherPrograms are far more complicated than stringsCopy, paste, move•CP-Miner (scale to linux kernel clone detection)Frequent subsequence miningCS590ZMOSSCode plagiarism detection•It also handles other digital contents Challenges•White space (variable name)•Noise (“the”, “int i”);•Order scrambling (paragraph reorders)Problem statement•Given a set of documents, identify substring matches that satisfy two properties:If there is a substring match at least as long as the guarantee threshold t, then this match is detected;Do not detect any matches shorter than the noise threshold, k.CS590ZMOSSk-gram•A continuous substring of length kCS590ZMOSSIncremental hashing•Hashing strings of length k is expensive for large k.•“rolling” hash function The (i+1)th k-gram hash = F (the i th k-gram hash, …)CS590ZMOSSFingerprint selection•A subset of hash values•Our goals: find all matching substrings >t; ignore matchings <k)•One of every tth hash values•0 mod pCS590ZMOSSWinnowing•Observation: given a sequence of hashes h1,…hn, if n>t-k, then at least one of the hi must be chosen•Have a sliding window with size w=t-k+1•In each window select the minimum hash value, break ties by select the rightmost occurrence.CS590ZMOSSAlgorithm•Build an index mapping fingerprints to locations for all documents.•Each document is fingerprinted a second time and the selected fingerprints are looked up in the index; this gives the list of all matching fingerprints for each document.•Sort (d,d1,fx), (d, d2,fy) by the first two elements. •Matches between documents are rank-ordered by size (number of fingerprints)CS590ZMOSSAdvantages•Guarantee to detect any >t substring matchesLimitations•Minor edits fail MOSS.x= a*b + c vs. z= c + a*b•Insertion, deletionCS590ZAST based matching[YANG, 1991, Software Practice and Experience]•Given two functions, build the ASTs•Match the roots•If so, apply LCS to align subtrees•Continue recursivelyFragileCS590ZDECKARD (ICSE 2007)CS590ZDECKARDAdvantages•Scalability•Insensitive to minor structural changes such as reordering, insertion, deletionLimitations•Structural similarity only•Insertion that incurs structure change.CS590ZCFG matching Hammock graph (JDIFF ,ASE 2004)•Match classes by names•Match fields by types•Match methods by signatures•Match instruction in methods by hammock graphsA hammock is a single entry single exit subgraph of a CFG.CS590ZCFG matchingPros•OrthogonalCan be combined with other matching techniques•SimpleCons•Coarse grained matching onlyNot good at clone detection•In case of code transformationCS590ZSemantic Based MatchedUsing PDG (SAS’01)CS590ZSemantic BasedCS590ZSemantic BasedPros•Non-contiguous, intertwined, reordered•Insensitive to code transformations.Cons•ScalabilityPoints-to analysis•Starting from a matching pair seems to be a problemCS590ZWrap UpFor clone detection•Maybe structural / text similarity is a good ideaFor whole program matching / method matching with code transformations•Semantic based is more appropriateScalability •PDG < CFG | AST < STRING <


View Full Document

Purdue CS 59000 - Matching Program Versions

Documents in this Course
Lecture 4

Lecture 4

42 pages

Lecture 6

Lecture 6

38 pages

Load more
Download Matching Program Versions
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Matching Program Versions and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Matching Program Versions 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?