This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:discrete:fall2022:projects:bdb0 [2022/09/08 17:48] – [SPECIFICATIONS] abarbcal | notes:discrete:fall2022:projects:bdb0 [2022/09/14 23:30] (current) – [PROGRAM] zswartwo | ||
---|---|---|---|
Line 5: | Line 5: | ||
Therefore, this week, for bdb0 we are tasked to write a debug tool that will be used in future rleX projects. This debug tool will compare two binary files, one being the output of our encoder/ | Therefore, this week, for bdb0 we are tasked to write a debug tool that will be used in future rleX projects. This debug tool will compare two binary files, one being the output of our encoder/ | ||
=====SPECIFICATIONS===== | =====SPECIFICATIONS===== | ||
- | BDB0 will take two arguments, two different files to compare with each other: | + | BDB0 will take two arguments, two different files that will be compared |
<cli> | <cli> | ||
./ | ./ | ||
Line 11: | Line 11: | ||
</ | </ | ||
- | //These files are not necessarily RLE-specific | + | //These files are not necessarily RLE-specific, |
- | The output should be the line byte of discrepancy, | + | The main focus of this program is to help us compare binaries, displayed in hexadecimal values, similar to a hex editor, only displaying the mismatched data. Hence, the output should be the line byte of discrepancy, |
- | Our task is to ask questions on Discord or in class and document our findings on this wiki page collaboratively, | ||
- | For anybody interested in editing the wiki page, here is the dokuwiki user guide: https:// | ||
- | =====PROGRAM===== | ||
+ | *Our task is to ask questions on Discord or in class and document our findings on this wiki page collaboratively, | ||
+ | |||
+ | **WIKI EDGE PAGE** | ||
+ | *For anybody interested in editing the wiki page, here is the dokuwiki user guide: https:// | ||
+ | =====PROGRAM===== | ||
+ | When checking to verify that one's project functions as intended, it should be borne in mind that the verify program included in the grabit does not work, so it will ultimately be up to you to check the program. Ways this may be done include using the diff and xxd commands, and testing your project with with the files included in the in sub-directory. I myself found it useful to custom-create a few files in order to ensure certain edge cases occurred, such that they may be tested for (bear in mind this project is a debugger to assist us in future projects, so leaving flaws is likely sub-optimal). | ||
=====OUTPUT SPECIFICATIONS===== | =====OUTPUT SPECIFICATIONS===== | ||
This is an example of the output of the program: | This is an example of the output of the program: | ||
+ | <cli> | ||
+ | lab46: | ||
+ | ============================================================================================================== | ||
+ | |000000e0 | 5325 2525 2525 2574 2525 7474 2574 7474 | ||
+ | |000000f0 | 5252 5252 5252 5245 4545 4545 4545 4545 | ||
+ | |00000100 | 5b30 3b31 3b33 363b 3437 6d53 1b5b 303b | ||
+ | ============================================================================================================== | ||
+ | </ | ||
{{ : | {{ : | ||
This is the structure: | This is the structure: | ||
{{ : | {{ : | ||
+ | |||
+ | The middle line, called mismatch, is the focus of the program, and it should be displayed in a different color with the use of ANSI escape codes. | ||
+ | |||
+ | The program is to display 16 bytes prior to, 16 bytes of, and 16 bytes after the first byte of difference detected in the two files. If either the 16 bytes prior or 16 bytes after the mismatch are not data from the file, in other words, you've reached the end of the file and there is no more data to display, you may display it with a NULL character (0x00, ' | ||
+ | |||
+ | Example: | ||
+ | {{ : | ||
+ | //In this example you see a mismatch happening right on the very first bytes of the file. Since there is no previous data to fetch, this lack of data is then displayed as NULL.// | ||
+ | |||
+ | The **address** portion is a line count in hexadecimal format. | ||
+ | |||
+ | The colors you use are up to you, but some coloring has to happen. So far it is required that three parts of the output are displayed in different colors, the addresses (on both sides), the data (both sides), and the mismatched bytes line. | ||
+ | |||
+ | ====== Important ====== | ||
+ | |||
+ | Your program should only print the **FIRST** mismatch, __**NOT**__ the entire document neither every mismatched line of bytes. JUST THE FIRST ONE along the previous and next bytes. | ||
+ | Also make sure that you deal with edge cases in your program. Your file should be able to handle mismatches at the very start of the compared files and the very end of the compared files. | ||
+ | |||
+ | |||
=====VERIFICATION===== | =====VERIFICATION===== | ||
+ | When running the program with two DIFFERENT files, the program should display the line containing the first byte that is mismatched, with the leading/ | ||
+ | |||
+ | When running the program with two SAME files, the program should display nothing. | ||
+ | The normal process of using **make check** to check your file against the desired result won't work in this case. The verify file is that of a different year when different specifications were desired. Running it this time around will lead you to many mismatches and headaches. You can check your output against the pictures provided above as a general guideline but other than that it is essential that if you have any questions to just ask in discord instead of guessing and hoping it is what is desired. Most of the desired output is already located on the project page. | ||
+ | |||
+ | =====Approaches===== | ||
+ | I think there are two approaches people have taken with the display of information with this project: | ||
+ | \\ | ||
+ | {{: | ||
+ | \\ | ||
+ | ===or=== | ||
+ | \\ | ||
+ | {{: | ||
+ | \\ | ||
+ | The main thing of note here is the position of the first mismatched bit in its line. In the first implementation, |