Bug 1515963 - Add vixl::GdbDisassembleInstruction. r=sstangl
authorNicolas B. Pierron <nicolas.b.pierron@nbp.name>
Fri, 21 Dec 2018 17:50:47 +0100
changeset 509113 3487b5f2f426760ebc402e42755dcb164644f022
parent 509112 89834b056ca0e1969845185d0d007a695b03c503
child 509114 ee0e1df960c436578db1e92627b2c768c253c2a3
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstangl
bugs1515963
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1515963 - Add vixl::GdbDisassembleInstruction. r=sstangl This add a simple function made to be called from gdb, which uses the vixl decoder to output in a static buffer the string corresponding to a single instruction. This is useful when breaking at vixl::Simulator::ExecuteInstruction function, as follow: (gdb) b vixl::Simulator::ExecuteInstruction Breakpoint 1 at 0x...: file ../jit/arm64/vixl/MozSimulator-vixl.cpp. (gdb) command 1 > call vixl::GdbDisassembleInstruction(this->pc_) > end
js/src/jit/arm64/vixl/Disasm-vixl.cpp
js/src/jit/arm64/vixl/Disasm-vixl.h
--- a/js/src/jit/arm64/vixl/Disasm-vixl.cpp
+++ b/js/src/jit/arm64/vixl/Disasm-vixl.cpp
@@ -3498,9 +3498,16 @@ void DisassembleInstruction(char* buffer
 {
     vixl::Disassembler disasm(buffer, bufsize-1);
     vixl::Decoder decoder;
     decoder.AppendVisitor(&disasm);
     decoder.Decode(instr);
     buffer[bufsize-1] = 0;      // Just to be safe
 }
 
+char* GdbDisassembleInstruction(const Instruction* instr)
+{
+    static char buffer[1024];
+    DisassembleInstruction(buffer, sizeof(buffer), instr);
+    return buffer;
+}
+
 }  // namespace vixl
--- a/js/src/jit/arm64/vixl/Disasm-vixl.h
+++ b/js/src/jit/arm64/vixl/Disasm-vixl.h
@@ -169,12 +169,13 @@ class PrintDisassembler: public Disassem
  protected:
   virtual void ProcessOutput(const Instruction* instr) override;
 
  private:
   FILE *stream_;
 };
 
 void DisassembleInstruction(char* buffer, size_t bufsize, const Instruction* instr);
+char* GdbDisassembleInstruction(const Instruction* instr);
 
 }  // namespace vixl
 
 #endif  // VIXL_A64_DISASM_A64_H