QVBoxLayout * MENU_KERNEL::CREATE_NEW_MENU_COLUMN ( QLayout * layout,QList<QMenu *> * action_menu,QLayout * parent_layout,int index) { if ( layout NE NULL ) { action_menu->clear(); } QFrame * container = new QFrame ( this ) ; QVBoxLayout * vertical_layout = new QVBoxLayout ( container ); container->setLayout ( vertical_layout ); if ( M_KERNEL_MENU_SECENEGI[index].is_visible EQ true AND ( M_KERNEL_MENU_SECENEGI [ index ].menu_column_visibility EQ MENU_HERYERDE OR M_KERNEL_MENU_SECENEGI[index].menu_column_visibility EQ MENU_SAYFADA) ) { parent_layout->addWidget ( container ); if (M_KERNEL_MENU_SECENEGI [ index ].num_of_childs EQ 0 ) { container->hide(); QHBoxLayout * box_layout = static_cast< QHBoxLayout * > ( parent_layout ) ; box_layout->addSpacerItem ( new QSpacerItem ( 40,20,QSizePolicy::Expanding,QSizePolicy::Fixed ) ); } } else { container->hide(); } QMenu * menu = new QMenu ( M_KERNEL_MENU_SECENEGI[index].text_to_display ); *action_menu << menu; if ( M_KERNEL_MENU_SECENEGI[index].is_visible EQ true AND ( M_KERNEL_MENU_SECENEGI [ index ].menu_column_visibility EQ MENU_HERYERDE OR M_KERNEL_MENU_SECENEGI[index].menu_column_visibility EQ MENU_TOPMENUDE) ) { this->menuBar()->addMenu ( menu ); } SET_WIDGET_DEFAULTS( action_menu->last(),index ); menu->hide(); QVBoxLayout * menu_header_vertical_layout = ADD_FRAME ( vertical_layout,container,MENU_HEADER_ITEM,index ); QVBoxLayout * menu_body_vertical_layout = ADD_FRAME ( vertical_layout,container,MENU_BODY_ITEM ,index ); if ( M_KERNEL_MENU_SECENEGI[index].num_of_childs NE 0 ) { ADD_MENU_KERNEL_LABEL ( menu_header_vertical_layout,MENU_HEADER_ITEM,M_KERNEL_MENU_SECENEGI [index].tab_str + M_KERNEL_MENU_SECENEGI[index].text_to_display,index); } else { ADD_MENU_KERNEL_BUTTON ( menu_header_vertical_layout,MENU_HEADER_ITEM,M_KERNEL_MENU_SECENEGI[index].tab_str + M_KERNEL_MENU_SECENEGI[index].text_to_display,index); } return menu_body_vertical_layout; }
/* Caller has to free the return value. */ char *stack_trace(conf_object_t *cpu, int eip, int tid) { char *buf = MM_XMALLOC(MAX_TRACE_LEN, char); int pos = 0, old_pos; int stack_offset = 0; /* Counts by 1 - READ_STACK already multiplies */ ADD_STR(buf, pos, MAX_TRACE_LEN, "TID%d at 0x%.8x in ", tid, eip); ADD_FRAME(buf, pos, MAX_TRACE_LEN, eip); int stop_ebp = 0; int ebp = GET_CPU_ATTR(cpu, ebp); int rabbit = ebp; int frame_count = 0; while (ebp != 0 && (unsigned)ebp < USER_MEM_START && frame_count++ < 1024) { bool extra_frame; do { int eip_offset; bool iret_block = false; extra_frame = false; /* at the beginning or end of a function, there is no * frame, but a return address is still on the stack. */ if (function_eip_offset(eip, &eip_offset)) { if (eip_offset == 0) { extra_frame = true; } else if (eip_offset == 1 && READ_BYTE(cpu, eip - 1) == OPCODE_PUSH_EBP) { stack_offset++; extra_frame = true; } } if (!extra_frame) { int opcode = READ_BYTE(cpu, eip); if (opcode == OPCODE_RET) { extra_frame = true; } else if (opcode == OPCODE_IRET) { iret_block = true; extra_frame = true; } } if (extra_frame) { eip = READ_STACK(cpu, stack_offset); ADD_STR(buf, pos, MAX_TRACE_LEN, "%s0x%.8x in ", STACK_TRACE_SEPARATOR, eip); ADD_FRAME(buf, pos, MAX_TRACE_LEN, eip); if (iret_block) stack_offset += IRET_BLOCK_WORDS; else stack_offset++;; } } while (extra_frame); /* pushed return address behind the base pointer */ eip = READ_MEMORY(cpu, ebp + WORD_SIZE); stack_offset = ebp + 2; ADD_STR(buf, pos, MAX_TRACE_LEN, "%s0x%.8x in ", STACK_TRACE_SEPARATOR, eip); old_pos = pos; ADD_FRAME(buf, pos, MAX_TRACE_LEN, eip); /* special-case termination condition */ if (pos - old_pos >= strlen(ENTRY_POINT) && strncmp(buf + old_pos, ENTRY_POINT, strlen(ENTRY_POINT)) == 0) { break; } if (rabbit != stop_ebp) rabbit = READ_MEMORY(cpu, ebp); if (rabbit == ebp) stop_ebp = ebp; if (rabbit != stop_ebp) rabbit = READ_MEMORY(cpu, ebp); if (rabbit == ebp) stop_ebp = ebp; ebp = READ_MEMORY(cpu, ebp); } char *buf2 = MM_XSTRDUP(buf); /* truncate to save space */ MM_FREE(buf); return buf2; }