Giter Club home page Giter Club logo

cross-indexer's Introduction

  • What we have in the folder: file1.c file2.c file2.h xref.rb

  • Compile instructions: while in directory $ gcc -g3 -o myprogram file1.c file2.c $ ruby xref.rb myprogram // A new HTML file index.html will be generated, please evaluate

  • Implementation details: Understanding the project requirements is HARD. Learning Ruby is HARD, too. We started out by constructing the data structures that will be used in the whole matching process. In this case, it will mainly be hashmaps and if/else statements We decided to first filter out information we need from llvm-dwarfdump. First, we use regular expression to extract informations from the output. Then we construct hashmaps that maps [file_number, file_name], [assembly_addr, (sourceline_number,file_number)] that results in a conclusive map [assembly_addr, actual_sourceline] We decided to iterate through the entire objdump output and keep printing each assembly lines while check if there's any sourceline that corrolates with particular assembly address by referring to the map we created from previous step. If there is a match, we will print the sourceline to the html. After the above steps, we have a skeleton program that works with desired output. TO finalize the project, we organize the html to make it tidier, add the hyperlink to each assembly line, "greyed-out" the source line that appears more than once, support multi-file by printing out matching file_name next to the sourceline.

  • Negative aspects: 1)In order to make the hyperlink work, we would not be able to use the "prettify" build-in JavaScript to make the layout prettier 2)This regular expression matching for llvm-dwarfdump and objdump will only work if the appearance of the information we require appears in particular order.

  • Positive aspects: 1)The structure is straightforward and tidy. ALl desired information is scraped out and stored in different maps for future use. 2)The regular expression matching works perfectly. 3)The HTML file provides all the information side-by-side

Cheers

cross-indexer's People

Contributors

wendybalaja avatar

Stargazers

TC Tiancheng Xu avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.