VIXL Release 1.7

Refer to the README.md and LICENCE files for details.
diff --git a/examples/custom-disassembler.cc b/examples/custom-disassembler.cc
index ce381af..32e448f 100644
--- a/examples/custom-disassembler.cc
+++ b/examples/custom-disassembler.cc
@@ -32,6 +32,7 @@
 #define __ masm->
 
 
+// We override this method to specify how register names should be disassembled.
 void CustomDisassembler::AppendRegisterNameToOutput(
     const Instruction* instr,
     const CPURegister& reg) {
@@ -51,7 +52,7 @@
         AppendToOutput(reg.Is64Bits() ? "x_stack_pointer" : "w_stack_pointer");
         return;
       case 31:
-        AppendToOutput(reg.Is64Bits() ? "x_zero_reg" : "w_zero-reg");
+        AppendToOutput(reg.Is64Bits() ? "x_zero_reg" : "w_zero_reg");
         return;
       default:
         // Fall through.
@@ -63,28 +64,37 @@
 }
 
 
-static const char* FakeLookupAddressDescription(const void* address) {
+static const char* FakeLookupTargetDescription(const void* address) {
   USE(address);
-  // We fake looking up the address in a table. We behave as if the first and
-  // third address we are asked about were function entries.
+  // We fake looking up the address.
   static int i = 0;
   const char* desc = NULL;
   if (i == 0) {
-    desc = "function: foo";
+    desc = "label: somewhere";
   } else if (i == 2) {
-    desc = "function: bar";
+    desc = "label: somewhere else";
   }
   i++;
   return desc;
 }
 
 
-void CustomDisassembler::AppendCodeAddressToOutput(
+// We override this method to add a description to addresses that we know about.
+// In this example we fake looking up a description, but in practice one could
+// for example use a table mapping addresses to function names.
+void CustomDisassembler::AppendCodeRelativeCodeAddressToOutput(
     const Instruction* instr, const void* addr) {
   USE(instr);
-  const char* address_desc = FakeLookupAddressDescription(addr);
-  // Print the raw address and - if available - its description.
-  AppendToOutput("(addr %p", addr);
+  // Print the address.
+  int64_t rel_addr = CodeRelativeAddress(addr);
+  if (rel_addr >= 0) {
+    AppendToOutput("(addr 0x%" PRIx64, rel_addr);
+  } else {
+    AppendToOutput("(addr -0x%" PRIx64, -rel_addr);
+  }
+
+  // If available, print a description of the address.
+  const char* address_desc = FakeLookupTargetDescription(addr);
   if (address_desc != NULL) {
     Disassembler::AppendToOutput(" ; %s", address_desc);
   }
@@ -92,6 +102,9 @@
 }
 
 
+// We override this method to add a comment to this type of instruction. Helpers
+// from the vixl::Instruction class can be used to analyse the instruction being
+// disasssembled.
 void CustomDisassembler::VisitAddSubShifted(const Instruction* instr) {
   vixl::Disassembler::VisitAddSubShifted(instr);
   if (instr->Rd() == vixl::x10.code()) {
@@ -143,13 +156,29 @@
   decoder.AppendVisitor(&disasm);
   decoder.AppendVisitor(&custom_disasm);
 
+  // In our custom disassembler, disassemble as if the base address was -0x8.
+  // Note that this can also be achieved with
+  //   custom_disasm.MapCodeAddress(0x0, instr_start + 2 * kInstructionSize);
+  // Users may generally want to map the start address to 0x0. Mapping to a
+  // negative offset can be used to focus on the section of the
+  // disassembly at address 0x0.
+  custom_disasm.MapCodeAddress(-0x8, instr_start);
+
   // Iterate through the instructions to show the difference in the disassembly.
   Instruction* instr;
   for (instr = instr_start; instr < instr_end; instr += kInstructionSize) {
     decoder.Decode(instr);
     printf("\n");
-    printf("VIXL disasm:   %s\n", disasm.GetOutput());
-    printf("custom disasm: %s\n", custom_disasm.GetOutput());
+    printf("VIXL disasm\t %p:\t%s\n",
+           reinterpret_cast<void*>(instr), disasm.GetOutput());
+    int64_t rel_addr =
+        custom_disasm.CodeRelativeAddress(reinterpret_cast<void*>(instr));
+    char rel_addr_sign_char = rel_addr < 0 ? '-' : ' ';
+    rel_addr = labs(rel_addr);
+    printf("custom disasm\t%c0x%" PRIx64 ":\t%s\n",
+           rel_addr_sign_char,
+           rel_addr,
+           custom_disasm.GetOutput());
   }
 }
 
diff --git a/examples/custom-disassembler.h b/examples/custom-disassembler.h
index 12d1a7f..382a55d 100644
--- a/examples/custom-disassembler.h
+++ b/examples/custom-disassembler.h
@@ -33,6 +33,10 @@
 
 void TestCustomDisassembler();
 
+// We want to change three things in the disassembly:
+// - Add comments to some add/sub instructions.
+// - Use aliases for register names.
+// - Add descriptions for code addresses.
 class CustomDisassembler: public Disassembler {
  public:
   CustomDisassembler() : Disassembler() { }
@@ -41,13 +45,11 @@
   virtual void VisitAddSubShifted(const Instruction* instr);
 
  protected:
-  // We print custom register names.
   virtual void AppendRegisterNameToOutput(const Instruction* instr,
                                           const CPURegister& reg);
 
-  // We fake looking up addresses in a table and printing useful names.
-  virtual void AppendCodeAddressToOutput(const Instruction* instr,
-                                         const void* addr);
+  virtual void AppendCodeRelativeCodeAddressToOutput(const Instruction* instr,
+                                                     const void* addr);
 };
 
 
diff --git a/examples/non-const-visitor.cc b/examples/non-const-visitor.cc
index 9e07cc1..bd02239 100644
--- a/examples/non-const-visitor.cc
+++ b/examples/non-const-visitor.cc
@@ -53,7 +53,7 @@
   simulator.set_xreg(1, b);
   simulator.RunFrom(start_instr);
   int64_t res = simulator.xreg(0);
-  printf("foo(%ld, %ld) = %ld\n", a, b, res);
+  printf("foo(%" PRId64", %" PRId64") = %" PRId64"\n", a, b, res);
 
   return res;
 #else