Hi, The attached patches allow GDB to display full stack traces when unwinding through JITted code. To use this, you need gdb 7.4.
The first step is to build the plugin in Tool/gdb/JSCPlugin using the Makefile. The compile flags may need to be adjusted if gdb is installed in a non-standard location, since gdb installs jit-reader.h which is required to build the plugin. JSPlugin.so then needs to be copied to `$(installdir)/lib/gdb', after which it can be loaded from within GDB using `jit-reader-load JSCPlugin.so'. Once this is done GDB should be able to display prettier stack traces when ENABLE_GDB_JIT_INTEGRATION is defined to 1 in JIT.h. I've not included ChangeLog entries since they are a pain to rebase, I'll add them once the code has been reviewed. Thanks! -- Sanjoy Das http://playingwithpointers.com
>From 8b957334fcb28d36d84d2f7bf20ffd9379399d87 Mon Sep 17 00:00:00 2001 From: Sanjoy Das <[email protected]> Date: Wed, 28 Dec 2011 14:45:38 +0530 Subject: [PATCH 1/3] Allow unwinding through ctiTrampoline. Adds DWARF information to ctiTrampoline's assembly using .cfi directives. --- Source/JavaScriptCore/jit/JITStubs.cpp | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Source/JavaScriptCore/jit/JITStubs.cpp b/Source/JavaScriptCore/jit/JITStubs.cpp index eda8c8f..5581342 100644 --- a/Source/JavaScriptCore/jit/JITStubs.cpp +++ b/Source/JavaScriptCore/jit/JITStubs.cpp @@ -370,6 +370,12 @@ asm ( ".globl " SYMBOL_STRING(ctiTrampoline) "\n" HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" + ".cfi_startproc" "\n" + ".cfi_def_cfa %rbp, 8" "\n" + ".cfi_offset %rip, 0" "\n" + ".cfi_offset %rbp, -8" "\n" + ".cfi_register %rsp, %rbp" "\n" + "pushq %rbp" "\n" "movq %rsp, %rbp" "\n" "pushq %r12" "\n" @@ -398,6 +404,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" "popq %r12" "\n" "popq %rbp" "\n" "ret" "\n" + ".cfi_endproc" "\n" ); asm ( -- 1.7.7.3
>From 4fdb47298ccd2420cb406b89d5ee5402fdd65045 Mon Sep 17 00:00:00 2001 From: Sanjoy Das <[email protected]> Date: Wed, 28 Dec 2011 15:11:14 +0530 Subject: [PATCH 2/3] New GDB plugin for JSCore. Adds a new GDB plugin in the Tools directory for reporting code objects generated by JSCore and unwinding through them. --- Source/JavaScriptCore/jit/GDBInterfaceABI.h | 43 ++++++ Tools/gdb/JSCPlugin/JSCPlugin.cc | 218 +++++++++++++++++++++++++++ Tools/gdb/JSCPlugin/Makefile | 10 ++ 3 files changed, 271 insertions(+), 0 deletions(-) create mode 100644 Source/JavaScriptCore/jit/GDBInterfaceABI.h create mode 100644 Tools/gdb/JSCPlugin/JSCPlugin.cc create mode 100644 Tools/gdb/JSCPlugin/Makefile diff --git a/Source/JavaScriptCore/jit/GDBInterfaceABI.h b/Source/JavaScriptCore/jit/GDBInterfaceABI.h new file mode 100644 index 0000000..758ee16 --- /dev/null +++ b/Source/JavaScriptCore/jit/GDBInterfaceABI.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef GDBInterfaceABI_h +#define GDBInterfaceABI_h + +#define JSC_GDB_MAGIC 0xf395114c + +namespace JSC { + + // The interface which JSC uses to communicate with GDB. + struct DebugInformation { + unsigned Magic; + void *CodeStart, *CodeEnd; + char *FunctionName; + unsigned FunctionNameLen; + }; + +} + +#endif diff --git a/Tools/gdb/JSCPlugin/JSCPlugin.cc b/Tools/gdb/JSCPlugin/JSCPlugin.cc new file mode 100644 index 0000000..6935c63 --- /dev/null +++ b/Tools/gdb/JSCPlugin/JSCPlugin.cc @@ -0,0 +1,218 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "GDBInterfaceABI.h" +#include <gdb/jit-reader.h> + +#include <cassert> +#include <cstdlib> +#include <cstdio> +#include <cstring> +#include <string> +#include <stdint.h> +#include <vector> + +using namespace std; +using namespace JSC; + +GDB_DECLARE_GPL_COMPATIBLE_READER + +class JSCPlugin { +public: + gdb_status RegisterCode(DebugInformation *, gdb_symbol_callbacks *); + bool PCExists(uintptr_t) const; + uintptr_t GetBegin(uintptr_t) const; + +private: + struct ParsedInfo { + uintptr_t Begin; + uintptr_t End; + }; + + vector<ParsedInfo> m_data; +}; + +gdb_status JSCPlugin::RegisterCode(DebugInformation *DebugInfo, gdb_symbol_callbacks *Callbacks) +{ + if (DebugInfo->Magic != JSC_GDB_MAGIC) { + fprintf(stderr, "Warning: Incorrect magic number for DebugInformation at %p\n", DebugInfo); + return GDB_FAIL; + } + + ParsedInfo PInfo; + PInfo.Begin = (uintptr_t) DebugInfo->CodeStart; + PInfo.End = (uintptr_t) DebugInfo->CodeEnd; + + m_data.push_back(PInfo); + + char FunctionName[DebugInfo->FunctionNameLen + 1]; + Callbacks->target_read((GDB_CORE_ADDR) DebugInfo->FunctionName, FunctionName, DebugInfo->FunctionNameLen); + FunctionName[DebugInfo->FunctionNameLen] = 0; + + // Now create a new object file and tell it what you've seen. + gdb_object *Object = Callbacks->object_open(Callbacks); + gdb_symtab *Symtab = Callbacks->symtab_open(Callbacks, Object, ""); + Callbacks->block_open(Callbacks, Symtab, NULL, PInfo.Begin, PInfo.End, FunctionName); + Callbacks->symtab_close(Callbacks, Symtab); + Callbacks->object_close(Callbacks, Object); + + return GDB_SUCCESS; +} + +bool JSCPlugin::PCExists(uintptr_t PC) const +{ + for (vector<ParsedInfo>::const_iterator i = m_data.begin(), end = m_data.end(); i != end; i++) { + if (i->Begin <= PC && i->End > PC) + return true; + } + return false; +} + +uintptr_t JSCPlugin::GetBegin(uintptr_t PC) const +{ + for (vector<ParsedInfo>::const_iterator i = m_data.begin(), end = m_data.end(); i != end; i++) { + if (i->Begin <= PC && i->End > PC) + return i->Begin; + } + + assert(0 && "GetBegin called on incorrect PC."); + return 0; +} + +static gdb_status ReadDebugInfo(gdb_reader_funcs *Self, gdb_symbol_callbacks *Callbacks, void *Memory, long) +{ + JSCPlugin *Plugin = static_cast<JSCPlugin *>(Self->priv_data); + return Plugin->RegisterCode(static_cast<DebugInformation *>(Memory), Callbacks); +} + +enum RegisterMapping { + AMD64_RA = 16, + AMD64_R13 = 13, + AMD64_RBP = 6, + AMD64_RSP = 7, +}; + +static bool ReadRegister(gdb_unwind_callbacks *Callbacks, int Register, uintptr_t &Value, int Size) +{ + gdb_reg_value *RValue = Callbacks->reg_get(Callbacks, Register); + if (RValue->size != Size || !RValue->defined) { + RValue->free(RValue); + return false; + } + memcpy(&Value, RValue->value, Size); + RValue->free(RValue); + return true; +} + +static void FreeRegValue(gdb_reg_value *Value) +{ + free(Value); +} + +static void WriteRegister(gdb_unwind_callbacks *Callbacks, int Register, uintptr_t Value, int Size) +{ + gdb_reg_value *RValue = static_cast<gdb_reg_value *>(malloc(sizeof(gdb_reg_value) + Size - 1)); + RValue->defined = 1; + RValue->free = FreeRegValue; + + memcpy(RValue->value, &Value, Size); + Callbacks->reg_set(Callbacks, Register, RValue); +} + +static bool ReadMemory(gdb_unwind_callbacks *Callbacks, uintptr_t Address, uintptr_t &Value, int Size) +{ + gdb_status Result = Callbacks->target_read(Address, &Value, Size); + return Result == GDB_SUCCESS; +} + +static gdb_status UnwindFrameLinuxX64(gdb_reader_funcs *Self, gdb_unwind_callbacks *Callbacks) +{ + JSCPlugin *Plugin = static_cast<JSCPlugin *>(Self->priv_data); + uintptr_t CurrentPC; + + if (!ReadRegister(Callbacks, AMD64_RA, CurrentPC, 8)) + return GDB_FAIL; + + if (!Plugin->PCExists(CurrentPC)) + return GDB_FAIL; + + const int RAOffset = -(0x10), R13Offset = -(0x28); + uintptr_t CurrentR13, PrevPC, PrevR13, CurrentRBP, CurrentRSP; + + if (!ReadRegister(Callbacks, AMD64_R13, CurrentR13, 8) || !ReadRegister(Callbacks, AMD64_RBP, CurrentRBP, 8) || !ReadRegister(Callbacks, AMD64_RSP, CurrentRSP, 8)) + return GDB_FAIL; + + if (!ReadMemory(Callbacks, CurrentR13 + RAOffset, PrevPC, 8) || !ReadMemory(Callbacks, CurrentR13 + R13Offset, PrevR13, 8)) + return GDB_FAIL; + + WriteRegister(Callbacks, AMD64_RA, PrevPC, 8); + WriteRegister(Callbacks, AMD64_R13, PrevR13, 8); + WriteRegister(Callbacks, AMD64_RBP, CurrentRBP, 8); + WriteRegister(Callbacks, AMD64_RSP, CurrentRSP, 8); + + return GDB_SUCCESS; +} + +static gdb_frame_id FrameIDLinuxX64(gdb_reader_funcs *Self, gdb_unwind_callbacks *Callbacks) +{ + uintptr_t RSP, RA; + JSCPlugin *Plugin = static_cast<JSCPlugin *>(Self->priv_data); + + bool Result = ReadRegister(Callbacks, AMD64_RA, RA, 8); + assert(Result); + Result = ReadRegister(Callbacks, AMD64_RSP, RSP, 8); + assert(Result); + + gdb_frame_id ID; + ID.code_address = Plugin->GetBegin(RA); + ID.stack_address = RSP; + + return ID; +} + +#if defined(__x86_64__) && defined(linux) +#define UNWIND_FRAME UnwindFrameLinuxX64 +#define FRAME_ID FrameIDLinuxX64 +#else +#error "Platform not supported!" +#endif + +static void DestroyReader(gdb_reader_funcs *Functions) +{ +} + +gdb_reader_funcs *gdb_init_reader() { + JSCPlugin *Plugin = new JSCPlugin; + gdb_reader_funcs *plugin_functions = new gdb_reader_funcs; + + plugin_functions->reader_version = GDB_READER_INTERFACE_VERSION; + plugin_functions->priv_data = Plugin; + plugin_functions->read = ReadDebugInfo; + plugin_functions->unwind = UNWIND_FRAME; + plugin_functions->get_frame_id = FRAME_ID; + plugin_functions->destroy = DestroyReader; + + return plugin_functions; +} diff --git a/Tools/gdb/JSCPlugin/Makefile b/Tools/gdb/JSCPlugin/Makefile new file mode 100644 index 0000000..126a440 --- /dev/null +++ b/Tools/gdb/JSCPlugin/Makefile @@ -0,0 +1,10 @@ +# JSPlugin.so is the plugin GCC will load. + +CXX=g++ +LDFLAGS= +CXXFLAGS= +defaultldflags=-shared -fPIC +defaultcxxflags=-I../../../Source/JavaScriptCore/jit -O2 -g -Wall -Werror + +JSCPlugin.so : JSCPlugin.cc + $(CXX) $(LDFLAGS) $(CXXFLAGS) $(defaultldflags) $(defaultcxxflags) JSCPlugin.cc -o JSCPlugin.so -- 1.7.7.3
>From 5c26c5f6d85ffbcb353c9f9617bfe19d44296aac Mon Sep 17 00:00:00 2001 From: Sanjoy Das <[email protected]> Date: Wed, 28 Dec 2011 15:18:08 +0530 Subject: [PATCH 3/3] Have JSCore register generated code. JSCore will now tell GDB about the functions it JITs using the plugin added in the last commit. --- Source/JavaScriptCore/GNUmakefile.list.am | 3 + Source/JavaScriptCore/jit/GDBInterface.cpp | 88 ++++++++++++++++++++++++++ Source/JavaScriptCore/jit/GDBInterface.h | 38 +++++++++++ Source/JavaScriptCore/jit/JIT.h | 2 + Source/JavaScriptCore/runtime/Executable.cpp | 7 ++ 5 files changed, 138 insertions(+), 0 deletions(-) create mode 100644 Source/JavaScriptCore/jit/GDBInterface.cpp create mode 100644 Source/JavaScriptCore/jit/GDBInterface.h diff --git a/Source/JavaScriptCore/GNUmakefile.list.am b/Source/JavaScriptCore/GNUmakefile.list.am index ff56560..ea8dd70 100644 --- a/Source/JavaScriptCore/GNUmakefile.list.am +++ b/Source/JavaScriptCore/GNUmakefile.list.am @@ -253,6 +253,9 @@ javascriptcore_sources += \ Source/JavaScriptCore/jit/CompactJITCodeMap.h \ Source/JavaScriptCore/jit/ExecutableAllocator.cpp \ Source/JavaScriptCore/jit/ExecutableAllocator.h \ + Source/JavaScriptCore/jit/GDBInterface.h \ + Source/JavaScriptCore/jit/GDBInterface.cpp \ + Source/JavaScriptCore/jit/GDBInterfaceABI.h \ Source/JavaScriptCore/jit/JITArithmetic32_64.cpp \ Source/JavaScriptCore/jit/JITArithmetic.cpp \ Source/JavaScriptCore/jit/JITCall32_64.cpp \ diff --git a/Source/JavaScriptCore/jit/GDBInterface.cpp b/Source/JavaScriptCore/jit/GDBInterface.cpp new file mode 100644 index 0000000..b361521 --- /dev/null +++ b/Source/JavaScriptCore/jit/GDBInterface.cpp @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "GDBInterfaceABI.h" +#include "GDBInterface.h" +#include "config.h" +#include "JITStubs.h" + +#include <cstring> +#include <cstdlib> +#include <cstdio> +#include <stdint.h> + +using namespace JSC; +using namespace std; + +extern "C" { + +enum JITAction { + JIT_NOACTION = 0, + JIT_REGISTER_FN, + JIT_UNREGISTER_FN +}; + +struct JITCodeEntry { + JITCodeEntry *NextEntry; + JITCodeEntry *PreviousEntry; + const char *SymfileAddress; + uint64_t SymfileSize; +}; + +struct JITDescriptor { + uint32_t Version; + uint32_t ActionFlag; + JITCodeEntry *RelevantEntry; + JITCodeEntry *FirstEntry; +}; + +void __attribute__((noinline)) __jit_debug_register_code() { }; + +JITDescriptor __jit_debug_descriptor = { 1, 0, 0, 0 }; + +}; + +void GDBJITInterface::RegisterFunction(void *CodeStart, int CodeSize, const char *Name) +{ + JITCodeEntry *Entry = reinterpret_cast<JITCodeEntry *>(malloc(sizeof(JITCodeEntry) + sizeof(DebugInformation))); + Entry->SymfileAddress = reinterpret_cast<const char *>(Entry + 1); + Entry->SymfileSize = sizeof(DebugInformation); + DebugInformation *DebugInfo = (DebugInformation *) Entry->SymfileAddress; + + DebugInfo->Magic = JSC_GDB_MAGIC; + DebugInfo->CodeStart = CodeStart; + DebugInfo->CodeEnd = CodeStart + CodeSize; + DebugInfo->FunctionName = strdup(Name); + DebugInfo->FunctionNameLen = strlen(Name); + + Entry->NextEntry = __jit_debug_descriptor.FirstEntry; + if (Entry->NextEntry != NULL) + Entry->NextEntry->PreviousEntry = Entry; + + __jit_debug_descriptor.FirstEntry = __jit_debug_descriptor.RelevantEntry = Entry; + + __jit_debug_descriptor.ActionFlag = JIT_REGISTER_FN; + __jit_debug_register_code(); +} diff --git a/Source/JavaScriptCore/jit/GDBInterface.h b/Source/JavaScriptCore/jit/GDBInterface.h new file mode 100644 index 0000000..996a0da --- /dev/null +++ b/Source/JavaScriptCore/jit/GDBInterface.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef GDBInterface_h +#define GDBInterface_h + +namespace JSC { + + class GDBJITInterface { + public: + static void RegisterFunction(void *CodeStart, int CodeSize, const char *Name); + }; + +} + +#endif diff --git a/Source/JavaScriptCore/jit/JIT.h b/Source/JavaScriptCore/jit/JIT.h index 750b9d8..25f8f18 100644 --- a/Source/JavaScriptCore/jit/JIT.h +++ b/Source/JavaScriptCore/jit/JIT.h @@ -32,6 +32,8 @@ #define ENABLE_JIT_VERBOSE 0 // Verbose logging for OSR-related code. #define ENABLE_JIT_VERBOSE_OSR 0 +// Tell GDB about generated code. +#define ENABLE_GDB_JIT_INTEGRATION 0 // We've run into some problems where changing the size of the class JIT leads to // performance fluctuations. Try forcing alignment in an attempt to stabalize this. diff --git a/Source/JavaScriptCore/runtime/Executable.cpp b/Source/JavaScriptCore/runtime/Executable.cpp index ad86463..04ebf4e 100644 --- a/Source/JavaScriptCore/runtime/Executable.cpp +++ b/Source/JavaScriptCore/runtime/Executable.cpp @@ -29,6 +29,7 @@ #include "BytecodeGenerator.h" #include "CodeBlock.h" #include "DFGDriver.h" +#include "GDBInterface.h" #include "JIT.h" #include "Parser.h" #include "UStringBuilder.h" @@ -367,6 +368,9 @@ JSObject* ProgramExecutable::compileInternal(ExecState* exec, ScopeChainNode* sc return 0; } m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_programCodeBlock.get()); +#if ENABLE(GDB_JIT_INTEGRATION) + GDBJITInterface::RegisterFunction(m_jitCodeForCall.start(), m_jitCodeForCall.size(), "PROGRAM"); +#endif } #if !ENABLE(OPCODE_SAMPLING) if (!BytecodeGenerator::dumpsGeneratedCode()) @@ -555,6 +559,9 @@ JSObject* FunctionExecutable::compileForCallInternal(ExecState* exec, ScopeChain return 0; } m_jitCodeForCall = JIT::compile(globalData, m_codeBlockForCall.get(), &m_jitCodeForCallWithArityCheck); +#if ENABLE(GDB_JIT_INTEGRATION) + GDBJITInterface::RegisterFunction(m_jitCodeForCall.start(), m_jitCodeForCall.size(), m_name.ascii().data()); +#endif } #if !ENABLE(OPCODE_SAMPLING) if (!BytecodeGenerator::dumpsGeneratedCode()) -- 1.7.7.3
_______________________________________________ webkit-dev mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

