Announcement

Collapse
No announcement yet.

Comparing disassembly listing, but only in parts where C source has changed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • robgee1964
    replied
    Hi Aaton

    Thanks so much for your reply. Actually in the end I found a diff engine which runs under .net, so I've created a simple C# utility for this particular job.

    I do appreciate the great support though, and thanks again.

    Leave a comment:


  • Aaron
    replied
    Hello,

    The two main tools that BC4 can offer are the regex Grammar definitions (which run through the whole file, looking for matches) or pre-processing Conversion (which can run any command line app, taking an input, and presenting back a processed output; in this case, an output striped of all unimportant text).

    Our reference material for general Unimportance is here:
    http://www.scootersoftware.com/suppo..._unimportantv3
    while Conversion is covered here:
    http://www.scootersoftware.com/suppo...rnalconversion

    We don't have a predefined format that can detect C Souce within another file type; if you are familiar with any command line app which could process this, then using the Conversion process is probably best to separate your data. We don't have an If This/Then logic for the grammars, so the regular expressions can't match on "if C Source Above, then match on assembly below"; the regEx would need to match on the specific text you are trying to find or not find, and then that match can be made Important or Unimportant.

    Leave a comment:


  • Comparing disassembly listing, but only in parts where C source has changed

    I have two sets of disassembly listings, produced with objdump -S- so the original C source is interleaved with the asm output.

    What I want to do is compare only those assembly lines for which the C source has changed, in other words if a change is detected in the C source then compare the following lines of disassembly. The object of the exercise is to find what effect patches (carried out to meet a coding standard) are having on the generated object code.

    typical output of the disassembly listing is this

    Code:
     	
      for (i = LCD_WIDTH * LCD_HEIGHT * 2 / 4; i < LCD_WIDTH * LCD_HEIGHT * 3 / 4; i++)
      fc:	697b      	ldr	r3, [r7, #20]
      fe:	3301      	adds	r3, #1
     100:	617b      	str	r3, [r7, #20]
    Obviously regex's can be written to match the C source and disassembled lines, and as a start I created a regex which allows the C source lines to be marked as "unimportant text". The trouble is the logic I really want is shown in the pseudo code below

    Code:
    if((line.type ==  Csource) && (line.this != line.that)) {
       while(1) {
          line =  getNextLine();
          if(line.type == Disassembly {
             if(line.this != line.other) {
                 writeToDiffLog(line);
             }
          }
          else if(line.type == Csource) {
             break;
          }
       }
    }
    I feel this could well be doable, but am quite at a loss as to how! Therefore if anyone knows how this might be acheived I would be most grateful.
Working...
X