From e01a76ac7154df0ca49cf1d7501215fdad9f44fd Mon Sep 17 00:00:00 2001 From: Gregory Shimansky Date: Fri, 15 Feb 2008 20:52:36 +0300 Subject: [PATCH] Added frame info header for iteration in compiled stack frames from crash handler --- vm/port/include/port_crash_handler.h | 11 +++-- vm/port/include/port_frame_info.h | 82 ++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 vm/port/include/port_frame_info.h diff --git a/vm/port/include/port_crash_handler.h b/vm/port/include/port_crash_handler.h index 33594b5..9f2bbb2 100644 --- a/vm/port/include/port_crash_handler.h +++ b/vm/port/include/port_crash_handler.h @@ -23,10 +23,8 @@ * @file Interface to signal handling and crash handling functions. */ -#include "open/types.h" -// FIXME: needed for Register structure. Should be changed to another -// header when Registers defition is moved to. -#include "vm_core_types.h" +#include "open/platform_types.h" +#include "port_frame_info.h" #ifdef __cplusplus extern "C" @@ -119,12 +117,15 @@ typedef struct * @param registrations - Pointer to an array of * port_signal_handler_registration structures. * @param count - number of signal registrations. Zero is allowed + * @param unwind_callback - VM function for unwinding compiled + * stack frames. * @return TRUE if initalization is successful. * FALSE if initialization failed. */ Boolean port_init_crash_handler( port_signal_handler_registration *registrations, - unsigned count); + unsigned count + port_unwind_compiled_frame unwind_callback); /** * Crash handler output flags. diff --git a/vm/port/include/port_frame_info.h b/vm/port/include/port_frame_info.h new file mode 100644 index 0000000..781620a --- /dev/null +++ b/vm/port/include/port_frame_info.h @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifdef _PORT_FRAME_INFO_ +#define _PORT_FRAME_INFO_ + +#include "open/platform_types.h" + +/** + * @file Interface to stack iteration from inside of port library + * subcomponents + */ + +/** + * Structure describing stack frame information for stack iteration + */ +typedef struct { + /** + * Method class name executed at specified stack frame + */ + char *method_class_name; + /** + * Method name executed at specified stack frame + */ + char *method_name; + /** + * Method signature executed at specified stack frame + */ + char *method_signature; + /** + * Method source file executed at specified stack frame + */ + char *source_file_name; + /** + * Source line number + */ + int source_line_number; + /** + * Stack iteration internal state. It should be initialized with + * NULL when structure is created. In case + * port_unwind_compiled_frame returns value greater than zero, it + * should be initialized with a pointer to a buffer of memory of + * this value size, and this buffer should be filled with + * zeroes. When iteration goes on, this buffer contains iteration + * internal data, like information about inlined methods depth. + */ + void *iteration_state; +} port_stack_frame_info; + +/** + * Callback function type for unwinding stack frames. Function is + * specific to the stack type and can unwind only the stack types of + * its component. + * + * @param regs - Register context of the current stack frame, function + * updates it to a new stack frame if unwinding succeeds. + * @param frame_info - Pointer to stack frame information structure, + * it is filled in with information for the current (not unwound!) stack + * frame. + * @return Positive number in case stack iterator buffer has to be + * allocated in frame_info->iteration_state. Zero if unwinding is + * successful and -1 if unwinding is not successful. + */ +typedef int (port_unwind_compiled_frame *)(Registers *regs, + port_stack_frame_info *frame_info); + +#endif // _PORT_FRAME_INFO_ + -- 1.5.3.7