class IntelliJNativeFrameSymbolizer implements NativeFrameSymbolizer {

  @NotNull
  @Override
  public NativeCallStack.NativeFrame symbolize(String abi, NativeCallStack.NativeFrame unsymbolizedFrame) {
    Symbol symbol = null;
    long instructionOffset = getOffsetOfPreviousInstruction(unsymbolizedFrame.getModuleOffset());
    try {
      symbol = mySymbolizer.symbolize(abi, unsymbolizedFrame.getModuleName(), instructionOffset);
    }
    catch (IOException | RuntimeException e) {
      getLogger().warn(e);
    }

    NativeCallStack.NativeFrame.Builder builder = unsymbolizedFrame.toBuilder();
    if (symbol == null) {
      String unfoundSymbolName = String.format("0x%x", instructionOffset);
      builder.setSymbolName(unfoundSymbolName);
    }
    else {
      builder.setSymbolName(symbol.getName())
        .setModuleName(symbol.getModule())
        .setFileName(symbol.getSourceFile())
        .setLineNumber(symbol.getLineNumber());
    }
    return builder.build();
  }

  public  IntelliJNativeFrameSymbolizer(@NotNull NativeSymbolizer symbolizer);

}