diffkemp icon indicating copy to clipboard operation
diffkemp copied to clipboard

Logger: Disable logging during relocation search

Open PLukas2018 opened this issue 1 year ago • 0 comments

As mentioned in issue #261, when comparing instructions to find possible relocation, most of the comparisons is expected to fail. To avoid polluting log output with logs of these unsuccessful comparisons, this commit enables to temporarily turn off the logger unless SimpLL is run with extra verbose debugging flag.

Now when running diffkemp the log output looks like this:

  • for bin/diffkemp -d compare (does not contain logging of instructions when searching for relocation)

    ; UNSUCCESSFUL RELOCATION
    ;...
    Comparing "deferred_free_range" and "deferred_free_range" {
      L instruction:   call void @__free_pages_boot_core(ptr %.02, i32 noundef 0)
      R instruction:   call void @__free_pages_core(ptr %.02, i32 noundef 0)
      ; ...
      Trying to find possible relocation:
        FAILURE: Possible relocation was NOT found
    } not equal
    ; ...
    
    ; SUCCESSFUL RELOCATION
    ; ...
    Comparing "dequeue_task" and "dequeue_task" {
      ; ...
      L instruction:   br label %11, !dbg !30739
      R instruction:   %11 = and i32 %2, 1, !dbg !31374
      Trying to find possible relocation:
        SUCCESS: Possible relocation found:
          from:  %11 = and i32 %2, 1, !dbg !31374
          to:    call void @psi_dequeue(ptr noundef %1, i1 noundef zeroext %12), !dbg !31376
    } not equal
    
  • for bin/diffkemp -dd compare (contains logging of instructions when searching for relocation)

    ; UNSUCCESSFUL RELOCATION
    ; ...
    Comparing "deferred_free_range" and "deferred_free_range" {
      ; ...
      L instruction:   call void @__free_pages_boot_core(ptr %.02, i32 0)
      R instruction:   call void @__free_pages_core(ptr %.02, i32 0)
      ; ...
      Trying to find possible relocation:
        L instruction:   call void @__free_pages_boot_core(ptr %.02, i32 0)
        R instruction:   %19 = add i64 %.03, 1, !dbg !25749
        ; ...
        L instruction:   br label %12, !dbg !25128, !llvm.loop !25129
        R instruction:   call void @__free_pages_core(ptr %.02, i32 0)
        FAILURE: Possible relocation was NOT found
      ; ...
    } not equal
    ; ...
    
    ; SUCCESSFUL RELOCATION
    ; ...
    Comparing "dequeue_task" and "dequeue_task" {
      ; ...
      L instruction:   br label %11, !dbg !30739
      R instruction:   %11 = and i32 %2, 1, !dbg !31374
      ; ...
      Trying to find possible relocation:
        L instruction:   br label %11, !dbg !30739
        R instruction:   %12 = icmp ne i32 %11, 0, !dbg !31375
        L instruction:   br label %11, !dbg !30739
        R instruction:   call void @psi_dequeue(ptr %1, i1 %12)
        L instruction:   br label %11, !dbg !30739
        R instruction:   br label %13, !dbg !31377
        SUCCESS: Possible relocation found:
          from:  %11 = and i32 %2, 1, !dbg !31374
          to:    call void @psi_dequeue(ptr %1, i1 %12)
      ; ...
    } not equal
    

PLukas2018 avatar Aug 15 '24 10:08 PLukas2018