From: John Hodge Date: Thu, 16 Jun 2011 11:00:11 +0000 (+0800) Subject: AxWin2 - Debugging and misc X-Git-Tag: rel0.10~63 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=f737fb47a583fca5c922604d419ab744609308df;p=tpg%2Facess2.git AxWin2 - Debugging and misc - Added DWARF support to the linker script - Fixed 100% CPU usage due to not reading from terminal --- diff --git a/Usermode/Applications/Makefile.tpl b/Usermode/Applications/Makefile.tpl index 424d865d..c9409174 100644 --- a/Usermode/Applications/Makefile.tpl +++ b/Usermode/Applications/Makefile.tpl @@ -21,8 +21,11 @@ clean: @$(RM) $(OBJ) $(DEPFILES) $(_BIN) $(BIN).dsm Map.txt install: $(_BIN) + @echo [xCP] $(DISTROOT)/$(DIR)/$(BIN) @$(xMKDIR) $(DISTROOT)/$(DIR); true - $(xCP) $(_BIN) $(DISTROOT)/$(DIR)/ + @$(STRIP) $(_BIN) -o $(_BIN)_ + @$(xCP) $(_BIN)_ $(DISTROOT)/$(DIR)/$(BIN) + @$(RM) $(_BIN)_ $(_BIN): $(OBJ) @mkdir -p $(dir $(_BIN)) diff --git a/Usermode/Applications/axwin2_src/WM/input.c b/Usermode/Applications/axwin2_src/WM/input.c index cb6a03ce..c75e0a05 100644 --- a/Usermode/Applications/axwin2_src/WM/input.c +++ b/Usermode/Applications/axwin2_src/WM/input.c @@ -18,7 +18,12 @@ void Input_HandleSelect(fd_set *set) { if(FD_ISSET(giTerminalFD, set)) { - // TODO: + uint32_t codepoint; + if( read(giTerminalFD, sizeof(codepoint), &codepoint) != sizeof(codepoint) ) + { + // oops, error + } + // TODO: pass on to message handler } if(FD_ISSET(giMouseFD, set)) diff --git a/Usermode/Applications/axwin2_src/WM/messages.c b/Usermode/Applications/axwin2_src/WM/messages.c index 7c7c7178..6fd01c55 100644 --- a/Usermode/Applications/axwin2_src/WM/messages.c +++ b/Usermode/Applications/axwin2_src/WM/messages.c @@ -66,11 +66,11 @@ void IPC_HandleSelect(fd_set *set) readlen = read(giNetworkFileHandle, sizeof(staticBuf), staticBuf); - // Assume that all connections are from localhost identlen = 4 + Net_GetAddressSize( ((uint16_t*)staticBuf)[1] ); msg = staticBuf + identlen; IPC_Handle(&gIPC_Type_Datagram, staticBuf, readlen - identlen, (void*)msg); + _SysDebug("IPC_HandleSelect: UDP handled"); } while(SysGetMessage(NULL, NULL)) @@ -81,6 +81,7 @@ void IPC_HandleSelect(fd_set *set) SysGetMessage(NULL, data); IPC_Handle(&gIPC_Type_SysMessage, &tid, len, (void*)data); + _SysDebug("IPC_HandleSelect: Message handled"); } } @@ -89,6 +90,9 @@ void IPC_Handle(tIPC_Type *IPCType, void *Ident, size_t MsgLen, tAxWin_Message * tApplication *app; tElement *ele; + _SysDebug("IPC_Handle: (IPCType=%p, Ident=%p, MsgLen=%i, Msg=%p)", + IPCType, Ident, MsgLen, Msg); + if( MsgLen < sizeof(tAxWin_Message) ) return ; if( MsgLen < sizeof(tAxWin_Message) + Msg->Size ) @@ -100,6 +104,7 @@ void IPC_Handle(tIPC_Type *IPCType, void *Ident, size_t MsgLen, tAxWin_Message * { // --- Ping message (reset timeout and get server version) case MSG_SREQ_PING: + _SysDebug(" IPC_Handle: MSG_SREQ_PING"); if( MsgLen < sizeof(tAxWin_Message) + 4 ) return; Msg->ID = MSG_SRSP_VERSION; Msg->Size = 4; @@ -112,8 +117,10 @@ void IPC_Handle(tIPC_Type *IPCType, void *Ident, size_t MsgLen, tAxWin_Message * // --- Register an application case MSG_SREQ_REGISTER: + _SysDebug(" IPC_Handle: MSG_SREQ_REGISTER"); if( Msg->Data[Msg->Size-1] != '\0' ) { // Invalid message + _SysDebug("IPC_Handle: RETURN - Not NULL terminated"); return ; } @@ -128,6 +135,7 @@ void IPC_Handle(tIPC_Type *IPCType, void *Ident, size_t MsgLen, tAxWin_Message * // --- Create a window case MSG_SREQ_ADDWIN: + _SysDebug(" IPC_Handle: MSG_SREQ_ADDWIN"); if( Msg->Data[Msg->Size-1] != '\0' ) { // Invalid message return ; @@ -139,11 +147,13 @@ void IPC_Handle(tIPC_Type *IPCType, void *Ident, size_t MsgLen, tAxWin_Message * // --- Set a window's icon case MSG_SREQ_SETICON: + _SysDebug(" IPC_Handle: MSG_SREQ_SETICON"); // TODO: Find a good way of implementing this break; // --- Create an element case MSG_SREQ_INSERT: { + _SysDebug(" IPC_Handle: MSG_SREQ_INSERT"); struct sAxWin_SReq_NewElement *info = (void *)Msg->Data; if( Msg->Size != sizeof(*info) ) return; diff --git a/Usermode/Applications/axwin2_src/WM/wm.c b/Usermode/Applications/axwin2_src/WM/wm.c index bb8d7f27..b0732235 100644 --- a/Usermode/Applications/axwin2_src/WM/wm.c +++ b/Usermode/Applications/axwin2_src/WM/wm.c @@ -139,7 +139,7 @@ tElement *AxWin_CreateAppWindow(tApplication *App, const char *Name) win = calloc(1, sizeof(tWindow) + 1); if(!win) return NULL; - ret = &win->Element; + ret = &win->RootElement; ret->Type = ELETYPE_WINDOW; ret->Data = win; ret->Parent = &App->MetaElement; diff --git a/Usermode/Applications/axwin2_src/WM/wm.h b/Usermode/Applications/axwin2_src/WM/wm.h index d07d44b0..5977fd68 100644 --- a/Usermode/Applications/axwin2_src/WM/wm.h +++ b/Usermode/Applications/axwin2_src/WM/wm.h @@ -15,6 +15,7 @@ #define DEFAULT_ELEMENTS_PER_APP 128 typedef struct sAxWin_Element tElement; +typedef struct sMenuItem tMenuItem; typedef struct sWindow tWindow; typedef struct sApplication tApplication; @@ -57,14 +58,28 @@ struct sAxWin_Element char DebugName[]; }; +struct sMenuItem +{ + tMenuItem *Next; + int Flags; + int ID; //!< ID number sent to application + const char *Label; + const char *Right; + tMenuItem *FirstChild; +}; + struct sWindow { int X, Y, W, H; void *Icon; + tApplication *App; + tWindow *OrderNext; // Render order - tElement Element; + tMenuItem *Menus; + + tElement RootElement; }; struct sApplication @@ -79,7 +94,7 @@ struct sApplication int MaxElementIndex; //!< Number of entries in \a EleIndex tElement **EleIndex; //!< Array of pointers to elements owned by this application - tElement MetaElement; //!< Windows child off this + tElement MetaElement; //!< Tabs child off this }; // === FUNCTIONS === diff --git a/Usermode/Libraries/Makefile.tpl b/Usermode/Libraries/Makefile.tpl index 1bb96a21..29129b6b 100644 --- a/Usermode/Libraries/Makefile.tpl +++ b/Usermode/Libraries/Makefile.tpl @@ -19,8 +19,14 @@ clean: $(RM) $(_BIN) $(_XBIN) $(OBJ) $(_BIN).dsm $(DEPFILES) install: all + @echo [xCP] $(DISTROOT)/Libs/$(BIN) @$(xMKDIR) $(DISTROOT)/Libs; true - $(xCP) $(_BIN) $(_XBIN) $(DISTROOT)/Libs/ + @$(STRIP) $(_BIN) -o $(_BIN)_ + @$(xCP) $(_BIN)_ $(DISTROOT)/Libs/$(BIN) + @$(RM) $(_BIN)_ +ifneq ($(_XBIN),) + $(xCP) $(_XBIN) $(DISTROOT)/Libs/ +endif $(_BIN): $(OBJ) @mkdir -p $(dir $(_BIN)) diff --git a/Usermode/Libraries/ld-acess.so_src/arch/x86.ld b/Usermode/Libraries/ld-acess.so_src/arch/x86.ld index 3ab4f1a9..eb28d901 100644 --- a/Usermode/Libraries/ld-acess.so_src/arch/x86.ld +++ b/Usermode/Libraries/ld-acess.so_src/arch/x86.ld @@ -47,7 +47,10 @@ SECTIONS { .text : AT(ADDR(.text)) { code = .; *(.text) - *(.rodata*) + } + + .rodata : AT(ADDR(.rodata)) { + *(.rodata .rodata.*) } .data ALIGN (0x1000) : AT(ADDR(.data)) { @@ -63,4 +66,32 @@ SECTIONS { bss = .; } _end = .; + + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } + /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) } } diff --git a/Usermode/Libraries/libaxwin2.so_src/main.c b/Usermode/Libraries/libaxwin2.so_src/main.c index f71a73ce..de08442f 100644 --- a/Usermode/Libraries/libaxwin2.so_src/main.c +++ b/Usermode/Libraries/libaxwin2.so_src/main.c @@ -11,7 +11,7 @@ // === GLOBALS === int giAxWin_Mode = 0; - int giAxWin_PID = 0; + int giAxWin_PID = 9; // HACK! tAxWin_MessageCallback *gAxWin_DefaultCallback; // === CODE === diff --git a/Usermode/Libraries/libaxwin2.so_src/messages.c b/Usermode/Libraries/libaxwin2.so_src/messages.c index 7b43bda8..a314703c 100644 --- a/Usermode/Libraries/libaxwin2.so_src/messages.c +++ b/Usermode/Libraries/libaxwin2.so_src/messages.c @@ -53,7 +53,7 @@ tAxWin_Message *AxWin_WaitForMessage() { int length; pid_t src; - tAxWin_Message *ret; + tAxWin_Message *ret = NULL; switch( giAxWin_Mode ) { @@ -65,7 +65,7 @@ tAxWin_Message *AxWin_WaitForMessage() default: break; } - return 0; + return ret; } /**