forked from KolibriOS/kolibrios
Compare commits
1 Commits
libc.ob--u
...
egor00f-pa
| Author | SHA1 | Date | |
|---|---|---|---|
| bc9ebe2262 |
@@ -722,7 +722,6 @@ tup.append_table(img_files, {
|
||||
{"SHELL", VAR_PROGS .. "/system/shell/shell"},
|
||||
{"GAMES/DINO", VAR_PROGS .. "/games/dino/dino"},
|
||||
{"GAMES/FLPYBIRD", VAR_PROGS .. "/games/flpybird/flpybird"},
|
||||
{"LIB/LIBC.OBJ", VAR_PROGS .. "/develop/ktcc/trunk/libc.obj/source/libc.obj"},
|
||||
})
|
||||
tup.append_table(extra_files, {
|
||||
{"kolibrios/utils/thashview", VAR_PROGS .. "/other/TinyHashView/thashview"},
|
||||
@@ -746,6 +745,7 @@ if tup.getconfig('NO_GCC') ~= 'full' then
|
||||
tup.append_table(img_files, {
|
||||
{"GAMES/REVERSI", VAR_PROGS .. "/games/reversi/reversi"},
|
||||
{"LIB/BASE64.OBJ", VAR_PROGS .. "/develop/libraries/base64/base64.obj"},
|
||||
{"LIB/LIBC.OBJ", VAR_PROGS .. "/develop/ktcc/trunk/libc.obj/source/libc.obj"},
|
||||
{"LIB/ICONV.OBJ", VAR_PROGS .. "/develop/libraries/iconv/iconv.obj"},
|
||||
-- {"LIB/MTAR.OBJ", VAR_PROGS .. "/develop/libraries/microtar/mtar.obj"},
|
||||
})
|
||||
|
||||
@@ -47,9 +47,3 @@
|
||||
перемещение по тексту:
|
||||
(ctrl+)Home, (ctrl+)End, (ctrl+)PageUp, (ctrl+)PageDown
|
||||
ctrl+Left, ctrl+Right
|
||||
|
||||
перемещение в панели поиска:
|
||||
Tab к следующему полю ввода
|
||||
Shift-Tab к предыдущему полю ввода
|
||||
Enter поиск следующего вхождения
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ IMPORT
|
||||
RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
|
||||
|
||||
CONST
|
||||
HEADER = "CEdit (11-jan-2026)";
|
||||
HEADER = "CEdit (30-apr-2025)";
|
||||
|
||||
ShellFilter = "";
|
||||
EditFilter = "sh|inc|txt|asm|ob07|c|cpp|h|pas|pp|lua|ini|json";
|
||||
@@ -1750,15 +1750,7 @@ BEGIN
|
||||
ELSE
|
||||
IF EditBox_Focus(FindEdit) THEN
|
||||
IF keyCode = 15 THEN (* Tab *)
|
||||
IF shift THEN
|
||||
SetFocus(GotoEdit, TRUE)
|
||||
ELSE
|
||||
SetFocus(ReplaceEdit, TRUE)
|
||||
END
|
||||
ELSIF keyCode = 28 THEN (* Enter *)
|
||||
IF searchOpened & (searchText # "") THEN
|
||||
notFound := ~T.findNext(text, BKW.value)
|
||||
END
|
||||
SetFocus(ReplaceEdit, TRUE)
|
||||
ELSE
|
||||
EB.key(FindEdit, key);
|
||||
EditBox_Get(FindEdit, new_searchText);
|
||||
@@ -1769,26 +1761,14 @@ BEGIN
|
||||
END
|
||||
ELSIF EditBox_Focus(ReplaceEdit) THEN
|
||||
IF keyCode = 15 THEN (* Tab *)
|
||||
IF shift THEN
|
||||
SetFocus(FindEdit, TRUE)
|
||||
ELSE
|
||||
SetFocus(GotoEdit, TRUE)
|
||||
END
|
||||
ELSIF keyCode = 28 THEN (* Enter *)
|
||||
IF searchOpened & (searchText # "") THEN
|
||||
notFound := ~T.findNext(text, BKW.value)
|
||||
END
|
||||
SetFocus(GotoEdit, TRUE)
|
||||
ELSE
|
||||
EB.key(ReplaceEdit, key);
|
||||
EditBox_Get(ReplaceEdit, replaceText)
|
||||
END
|
||||
ELSIF EditBox_Focus(GotoEdit) THEN
|
||||
IF keyCode = 15 THEN (* Tab *)
|
||||
IF shift THEN
|
||||
SetFocus(ReplaceEdit, TRUE)
|
||||
ELSE
|
||||
SetFocus(FindEdit, TRUE)
|
||||
END
|
||||
SetFocus(FindEdit, TRUE)
|
||||
ELSE
|
||||
IF (key DIV 256) MOD 256 = 13 THEN
|
||||
goto
|
||||
|
||||
@@ -47,13 +47,11 @@ vsscanf
|
||||
ungetc
|
||||
;____STDLIB____
|
||||
abs
|
||||
abort
|
||||
atoi
|
||||
atol
|
||||
atoll
|
||||
atof
|
||||
calloc
|
||||
_exit
|
||||
exit
|
||||
free
|
||||
itoa
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
.tup
|
||||
*.o
|
||||
*.obj
|
||||
*.kex
|
||||
@@ -48,13 +48,7 @@ DLLAPI void free(void* ptr);
|
||||
|
||||
DLLAPI long int strtol(const char* str, char** endptr, int base);
|
||||
|
||||
DLLAPI void _exit(int status);
|
||||
#ifndef _Exit
|
||||
#define _Exit(status) _exit(status);
|
||||
#endif
|
||||
|
||||
DLLAPI void exit(int status);
|
||||
DLLAPI void abort();
|
||||
|
||||
DLLAPI void srand(unsigned s);
|
||||
DLLAPI int rand(void);
|
||||
|
||||
@@ -27,8 +27,7 @@ BIN = \
|
||||
libc_test.kex \
|
||||
pipe.kex \
|
||||
defgen.kex \
|
||||
futex.kex \
|
||||
atexit_test.kex
|
||||
futex.kex
|
||||
|
||||
all: $(BIN)
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void f()
|
||||
{
|
||||
static int c = 1;
|
||||
printf("exit #%d\n", c);
|
||||
c++;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
atexit(&f);
|
||||
atexit(&f);
|
||||
atexit(&f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -23,6 +23,5 @@ cp clayer/logo.png /tmp0/1/tcc_samples/logo.png
|
||||
../tcc defgen.c -o /tmp0/1/tcc_samples/defgen
|
||||
../tcc pipe.c -o /tmp0/1/tcc_samples/pipe
|
||||
../tcc futex.c -o /tmp0/1/tcc_samples/futex
|
||||
../tcc atexit_test.c -o /tmp0/1/tcc_samples/atexit_test
|
||||
"/sys/File managers/Eolite" /tmp0/1/tcc_samples
|
||||
exit
|
||||
|
||||
@@ -14,7 +14,6 @@ public start
|
||||
public start as '_start'
|
||||
|
||||
extrn main
|
||||
extrn exit
|
||||
|
||||
include '../../../../../../proc32.inc'
|
||||
include '../../../../../../macros.inc'
|
||||
@@ -39,36 +38,36 @@ start:
|
||||
call push_param
|
||||
; retrieving parameters
|
||||
mov esi, params
|
||||
xor edx, edx ; dl - is it a parameter (1) or delimiters (0)
|
||||
; dh - character with which the parameter started (1 quotes, 0 everything else)
|
||||
xor edx, edx ; dl - èä¸ò ïàðàìåòð(1) èëè ðàçäåëèòåëè(0)
|
||||
; dh - ñèìâîë ñ êîòîðîãî íà÷àëñÿ ïàðàìåòð (1 êàâû÷êè, 0 îñòàëüíîå)
|
||||
mov ecx, 1 ; cl = 1
|
||||
; ch = 0 just zero
|
||||
; ch = 0 ïðîñòî íîëü
|
||||
.parse:
|
||||
lodsb
|
||||
test al, al
|
||||
jz .run
|
||||
test dl, dl
|
||||
jnz .findendparam
|
||||
;{if it was a delimiter
|
||||
;{åñëè áûë ðàçäåëèòåëü
|
||||
cmp al, ' '
|
||||
jz .parse ; space loaded, load next character
|
||||
mov dl, cl ; parameter starts
|
||||
jz .parse ;çàãðóæåí ïðîáåë, ãðóçèì ñëåäóþùèé ñèìâîë
|
||||
mov dl, cl ;íà÷èíàåòñÿ ïàðàìåòð
|
||||
cmp al, '"'
|
||||
jz @f ; quotes loaded
|
||||
mov dh, ch ; parameter without quotes
|
||||
jz @f ;çàãðóæåíû êàâû÷êè
|
||||
mov dh, ch ;ïàðàìåòð áåç êàâû÷åê
|
||||
dec esi
|
||||
call push_param
|
||||
inc esi
|
||||
jmp .parse
|
||||
|
||||
@@:
|
||||
mov dh, cl ; parameter in quotes
|
||||
call push_param ; if not a space, then some parameter starts
|
||||
jmp .parse ; if it was a delimiter}
|
||||
mov dh, cl ;ïàðàìåòð â êàâû÷åêàõ
|
||||
call push_param ;åñëè íå ïðîáåë çíà÷èò íà÷èíàåòñÿ êàêîé òî ïàðàìåòð
|
||||
jmp .parse ;åñëè áûë ðàçäåëèòåëü}
|
||||
|
||||
.findendparam:
|
||||
test dh, dh
|
||||
jz @f ; without quotes
|
||||
jz @f ; áåç êàâû÷åê
|
||||
cmp al, '"'
|
||||
jz .clear
|
||||
jmp .parse
|
||||
@@ -87,9 +86,10 @@ start:
|
||||
push [argc]
|
||||
call main
|
||||
.exit:
|
||||
push eax
|
||||
call dword [exit]
|
||||
dd -1
|
||||
xor eax,eax
|
||||
dec eax
|
||||
int 0x40
|
||||
dd -1
|
||||
.crash:
|
||||
jmp .exit
|
||||
;============================
|
||||
|
||||
@@ -82,7 +82,6 @@
|
||||
#include "string/strstr.c"
|
||||
#include "string/strtok.c"
|
||||
#include "string/strxfrm.c"
|
||||
|
||||
#include "stdlib/abs.c"
|
||||
#include "stdlib/assert.c"
|
||||
#include "stdlib/atof.c"
|
||||
@@ -90,9 +89,7 @@
|
||||
#include "stdlib/atol.c"
|
||||
#include "stdlib/atoll.c"
|
||||
#include "stdlib/calloc.c"
|
||||
#include "stdlib/atexit.c"
|
||||
#include "stdlib/exit.c"
|
||||
#include "stdlib/_exit.c"
|
||||
#include "stdlib/free.c"
|
||||
#include "stdlib/itoa.c"
|
||||
#include "stdlib/labs.c"
|
||||
@@ -103,7 +100,6 @@
|
||||
#include "stdlib/realloc.c"
|
||||
#include "stdlib/strtod.c"
|
||||
#include "stdlib/strtol.c"
|
||||
#include "stdlib/abort.c"
|
||||
|
||||
#include "math/acosh.c"
|
||||
#include "math/asinh.c"
|
||||
@@ -174,9 +170,7 @@ ksys_dll_t EXPORTS[] = {
|
||||
{ "atoll", &atoll },
|
||||
{ "atof", &atof },
|
||||
{ "calloc", &calloc },
|
||||
{ "_exit", &_exit },
|
||||
{ "exit", &exit },
|
||||
{ "abort", &abort },
|
||||
{ "free", &free },
|
||||
{ "itoa", &itoa },
|
||||
{ "labs", &labs },
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
#include <conio.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
void _exit(int status)
|
||||
{
|
||||
__libc_exit(status, NULL);
|
||||
}
|
||||
|
||||
void __libc_exit(int status, void (*before_exit)(int status))
|
||||
{
|
||||
// return error and this is not abort
|
||||
if (status && status != 128) {
|
||||
fprintf(stderr, "\nexit code: %d\n", status);
|
||||
}
|
||||
|
||||
if (before_exit) {
|
||||
before_exit(status);
|
||||
}
|
||||
|
||||
if (__con_is_load) {
|
||||
con_exit(0);
|
||||
}
|
||||
|
||||
_ksys_exit();
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
* Copyright (C) 2026 KolibriOS team
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
void abort()
|
||||
{
|
||||
ksys_thread_t t;
|
||||
_ksys_thread_info(&t, -1);
|
||||
fprintf(stderr, "\nAbort in %d\n", t.pid);
|
||||
|
||||
_exit(128);
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
* Copyright (C) 2026 KolibriOS team
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
struct atexit_n {
|
||||
struct atexit_n* last;
|
||||
void (*func)(void);
|
||||
};
|
||||
|
||||
static struct atexit_n* __last_n = NULL;
|
||||
|
||||
int atexit(void (*func)(void))
|
||||
{
|
||||
struct atexit_n* n = malloc(sizeof(struct atexit_n));
|
||||
|
||||
if (n == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
n->last = __last_n;
|
||||
n->func = func;
|
||||
|
||||
__last_n = n;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __run_atexit()
|
||||
{
|
||||
struct atexit_n* n = __last_n;
|
||||
while (n != NULL) {
|
||||
n->func();
|
||||
struct atexit_n* to_free = n;
|
||||
n = n->last;
|
||||
free(to_free);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +1,12 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
* Copyright (C) 2021 Logaev Maxim
|
||||
* Copyright (C) 2026 KolibriOS team
|
||||
*/
|
||||
/* Copyright (C) 2021 Logaev Maxim (turbocat2001), GPLv2 */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <conio.h>
|
||||
#include <sys/ksys.h>
|
||||
#include "_exit.h"
|
||||
|
||||
/*
|
||||
TODO
|
||||
static void __close_all()
|
||||
{
|
||||
}
|
||||
|
||||
static void __free_all_mem()
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
void __normal_exit(int status)
|
||||
{
|
||||
__run_atexit();
|
||||
__close_all();
|
||||
__free_all_mem();
|
||||
}
|
||||
|
||||
void exit(int status)
|
||||
{
|
||||
__libc_exit(status, &__normal_exit);
|
||||
if (__con_is_load) {
|
||||
con_exit(status);
|
||||
}
|
||||
_ksys_exit();
|
||||
}
|
||||
|
||||
@@ -122,13 +122,7 @@ struc fpcvt
|
||||
.sizeof:
|
||||
}
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Command flags
|
||||
|
||||
CMD_WITHOUT_PARAM = 1b ; command may be called without parameters
|
||||
CMD_WITH_PARAM = 10b ; command may be called with parameters
|
||||
CMD_WITHOUT_LOADED_APP = 100b ; command may be called without loaded program
|
||||
CMD_WITH_LOADED_APP = 1000b ; command may be called with loaded program
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Entry point
|
||||
@@ -455,56 +449,63 @@ z1:
|
||||
mov esi, commands
|
||||
call find_cmd
|
||||
mov eax, aUnknownCommand
|
||||
jc .cmd_procg
|
||||
jc .x11
|
||||
|
||||
; check command requirements
|
||||
; flags field:
|
||||
; &1: command may be called without parameters
|
||||
; &2: command may be called with parameters
|
||||
; &4: command may be called without loaded program
|
||||
; &8: command may be called with loaded program
|
||||
mov eax, [esi+8]
|
||||
mov ecx, [curarg]
|
||||
cmp byte [ecx], 0
|
||||
jz .noargs
|
||||
test byte [esi+16], CMD_WITH_PARAM
|
||||
jz .cmd_procg
|
||||
test byte [esi+16], 2
|
||||
jz .x11
|
||||
jmp @f
|
||||
|
||||
.noargs:
|
||||
test byte [esi+16], CMD_WITHOUT_PARAM
|
||||
jz .cmd_procg
|
||||
test byte [esi+16], 1
|
||||
jz .x11
|
||||
|
||||
@@:
|
||||
cmp [debuggee_pid], 0
|
||||
jz .nodebuggee
|
||||
mov eax, aAlreadyLoaded
|
||||
test byte [esi+16], CMD_WITH_LOADED_APP
|
||||
jz .cmd_procg
|
||||
jmp .run_cmd
|
||||
test byte [esi+16], 8
|
||||
jz .x11
|
||||
jmp .x9
|
||||
|
||||
.nodebuggee:
|
||||
mov eax, need_debuggee
|
||||
test byte [esi+16], CMD_WITHOUT_LOADED_APP
|
||||
jnz .run_cmd
|
||||
test byte [esi+16], 4
|
||||
jnz .x9
|
||||
|
||||
.cmd_procg:
|
||||
.x11:
|
||||
xchg esi, eax
|
||||
call put_message
|
||||
|
||||
; store cmdline for repeating
|
||||
.cmd_procg_no_put_msg:
|
||||
.x10:
|
||||
mov esi, cmdline
|
||||
mov ecx, [cmdline_len]
|
||||
|
||||
@@:
|
||||
cmp ecx, 0
|
||||
jle .wait_event
|
||||
jle .we
|
||||
mov al, [esi + ecx]
|
||||
mov [cmdline_prev + ecx], al
|
||||
dec ecx
|
||||
jmp @b
|
||||
|
||||
.wait_event:
|
||||
.we:
|
||||
mov [cmdline_len], 0
|
||||
jmp waitevent
|
||||
|
||||
.run_cmd:
|
||||
.x9:
|
||||
call dword [esi+4]
|
||||
jmp .cmd_procg_no_put_msg
|
||||
jmp .x10
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Cmdline handling
|
||||
|
||||
@@ -2,10 +2,7 @@
|
||||
COLOR_THEME fix MOVIEOS
|
||||
|
||||
format binary as ""
|
||||
|
||||
include '../../macros.inc'
|
||||
include '../../KOSfuncs.inc'
|
||||
|
||||
use32
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
@@ -1148,105 +1145,6 @@ OnDump:
|
||||
.ret:
|
||||
ret
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Print Backtrace
|
||||
|
||||
struct STACK_FRAME
|
||||
prev_frame rd 1
|
||||
ret_addr rd 1
|
||||
ends
|
||||
|
||||
OnBacktrace:
|
||||
push ebp
|
||||
|
||||
; Set max depth counter
|
||||
xor eax, eax
|
||||
dec eax
|
||||
|
||||
mov esi, [curarg]
|
||||
cmp byte [esi], 0
|
||||
jz .save_depth
|
||||
|
||||
call get_hex_number
|
||||
mov esi, aParseError
|
||||
jc .exit
|
||||
|
||||
; If depth 0
|
||||
test eax, eax
|
||||
jz .done
|
||||
|
||||
.save_depth:
|
||||
mov [bt_depth], eax
|
||||
|
||||
; Get start frame addres
|
||||
mov ebp, [_ebp]
|
||||
test ebp, ebp
|
||||
jz .done
|
||||
|
||||
mov edi, stack_frame_dump
|
||||
|
||||
.next:
|
||||
mcall SF_DEBUG, SSF_READ_MEMORY, [debuggee_pid], sizeof.STACK_FRAME, ebp
|
||||
cmp eax, -1
|
||||
mov esi, read_mem_err
|
||||
jz .exit
|
||||
|
||||
; The address of the previous frame must be less than the current one
|
||||
mov eax, [edi + STACK_FRAME.prev_frame]
|
||||
test eax, eax
|
||||
jz .done
|
||||
|
||||
; Save stack_frame_dump
|
||||
push edi
|
||||
; Save previous frame
|
||||
push ebp
|
||||
; Save return address
|
||||
mov eax, [edi + STACK_FRAME.ret_addr]
|
||||
push eax
|
||||
|
||||
; Print frame address and return address
|
||||
push eax ; pop in put_message_nodraw
|
||||
push ebp ; pop in put_message_nodraw
|
||||
mov esi, aBacktraceFmt
|
||||
call put_message_nodraw
|
||||
|
||||
; Restore return address
|
||||
pop eax
|
||||
|
||||
; Find symbol by return address
|
||||
call find_near_symbol
|
||||
test esi, esi
|
||||
jnz .print_sym
|
||||
|
||||
mov esi, aBacktraceSymStub
|
||||
|
||||
.print_sym:
|
||||
call put_message_nodraw
|
||||
mov esi, newline
|
||||
call put_message_nodraw
|
||||
|
||||
; Restore previous frame
|
||||
pop ebp
|
||||
; Restore stack_frame_dump
|
||||
pop edi
|
||||
|
||||
; The address of the previous frame must be greater than the current one.
|
||||
cmp [edi + STACK_FRAME.prev_frame], ebp
|
||||
jna .done
|
||||
|
||||
; Set previous frame
|
||||
mov ebp, [edi + STACK_FRAME.prev_frame]
|
||||
dec [bt_depth]
|
||||
jnz .next
|
||||
|
||||
.done:
|
||||
mov esi, newline
|
||||
|
||||
.exit:
|
||||
call put_message
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Dissassemble block of executable event
|
||||
|
||||
@@ -1966,7 +1864,7 @@ include 'disasm.inc'
|
||||
|
||||
caption_str db 'Kolibri Debugger',0
|
||||
|
||||
begin_str db 'Kolibri Debugger, version 0.36',10
|
||||
begin_str db 'Kolibri Debugger, version 0.35',10
|
||||
db 'Hint: type "help" for help, "quit" to quit'
|
||||
newline db 10,0
|
||||
prompt db '> ',0
|
||||
@@ -1982,88 +1880,66 @@ help_groups:
|
||||
;-----------------------------------------------------------------------------
|
||||
; Commands format definitions
|
||||
|
||||
; TODO: make it with macros
|
||||
|
||||
; flags field:
|
||||
; &1: command may be called without parameters
|
||||
; &2: command may be called with parameters
|
||||
; &4: command may be called without loaded program
|
||||
; &8: command may be called with loaded program
|
||||
commands:
|
||||
dd _aH, OnHelp, HelpSyntax, HelpHelp
|
||||
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITHOUT_LOADED_APP or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Fh
|
||||
dd aHelp, OnHelp, HelpSyntax, HelpHelp
|
||||
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITHOUT_LOADED_APP or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Fh
|
||||
dd aQuit, OnQuit, QuitSyntax, QuitHelp
|
||||
db CMD_WITHOUT_PARAM or CMD_WITHOUT_LOADED_APP or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Dh
|
||||
dd aLoad, OnLoad, LoadSyntax, LoadHelp
|
||||
db CMD_WITH_PARAM or CMD_WITHOUT_LOADED_APP
|
||||
|
||||
db 6
|
||||
dd aReload, OnReload, ReloadSyntax, ReloadHelp
|
||||
db CMD_WITHOUT_PARAM or CMD_WITHOUT_LOADED_APP or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Dh
|
||||
dd aTerminate, OnTerminate, TerminateSyntax, TerminateHelp
|
||||
db CMD_WITHOUT_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 9
|
||||
dd aDetach, OnDetach, DetachSyntax, DetachHelp
|
||||
db CMD_WITHOUT_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 9
|
||||
dd aSuspend, OnSuspend, SuspendSyntax, SuspendHelp
|
||||
db CMD_WITHOUT_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 9
|
||||
dd aResume, OnResume, ResumeSyntax, ResumeHelp
|
||||
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Bh
|
||||
dd aStep, OnStepMultiple, StepSyntax, StepHelp
|
||||
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Bh
|
||||
dd aProceed, OnProceedMultiple, ProceedSyntax, ProceedHelp
|
||||
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Bh
|
||||
dd aCalc, OnCalc, CalcSyntax, CalcHelp
|
||||
db CMD_WITH_PARAM or CMD_WITHOUT_LOADED_APP or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Eh
|
||||
dd aDump, OnDump, DumpSyntax, DumpHelp
|
||||
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
dd aBacktrace, OnBacktrace, BacktraceSyntax, BacktraceHelp
|
||||
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Bh
|
||||
dd aUnassemble, OnUnassemble, UnassembleSyntax, UnassembleHelp
|
||||
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Bh
|
||||
dd aBp, OnBp, BpSyntax, BpHelp
|
||||
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Ah
|
||||
dd aBpm, OnBpmb, BpmSyntax, BpmHelp
|
||||
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Ah
|
||||
dd aBpmb, OnBpmb, BpmSyntax, BpmHelp
|
||||
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Ah
|
||||
dd aBpmw, OnBpmw, BpmSyntax, BpmHelp
|
||||
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Ah
|
||||
dd aBpmd, OnBpmd, BpmSyntax, BpmHelp
|
||||
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Ah
|
||||
dd aBl, OnBl, BlSyntax, BlHelp
|
||||
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Bh
|
||||
dd aBc, OnBc, BcSyntax, BcHelp
|
||||
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Ah
|
||||
dd aBd, OnBd, BdSyntax, BdHelp
|
||||
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Ah
|
||||
dd aBe, OnBe, BeSyntax, BeHelp
|
||||
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Ah
|
||||
dd aReg, OnReg, RSyntax, RHelp
|
||||
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Ah
|
||||
dd aUnpack, OnUnpack, UnpackSyntax, UnpackHelp
|
||||
db CMD_WITHOUT_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 9
|
||||
dd aLoadSymbols, OnLoadSymbols, LoadSymbolsSyntax, LoadSymbolsHelp
|
||||
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
|
||||
|
||||
db 0Ah
|
||||
dd 0
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
@@ -2104,8 +1980,7 @@ help_data_msg db 'List of data commands:',10
|
||||
db 'd [<expression>] - dump data at given address',10
|
||||
db 'u [<expression>] - unassemble instructions at given address',10
|
||||
db 'r <register> <expression> or',10
|
||||
db 'r <register>=<expression> - set register value',10
|
||||
db 'bt [<number>] - display backtrace / stacktrace',10,0
|
||||
db 'r <register>=<expression> - set register value',10,0
|
||||
|
||||
; Breakpoints commands group
|
||||
|
||||
@@ -2163,11 +2038,6 @@ DumpHelp db 'Dump data of debugged program',10
|
||||
DumpSyntax db 'Usage: d <expression> - dump data at specified address',10
|
||||
db ' or: d - continue current dump',10,0
|
||||
|
||||
aBacktrace db 3,'bt',0
|
||||
BacktraceHelp db 'Display backtrace / stacktrace',10
|
||||
BacktraceSyntax db 'Usage: bt <number> - display backtrace with depth',10
|
||||
db ' or: bt display all backtrace',10,0
|
||||
|
||||
aCalc db 2,'?',0
|
||||
CalcHelp db 'Calculate value of expression',10
|
||||
CalcSyntax db 'Usage: ? <expression>',10,0
|
||||
@@ -2232,11 +2102,6 @@ LoadSymbolsSyntax db 'Usage: load-symbols <symbols-file-name>',10,0
|
||||
|
||||
aUnknownCommand db 'Unknown command',10,0
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Info messages
|
||||
aBacktraceSymStub db '??',0
|
||||
aBacktraceFmt db '[0x%8X] 0x%8X in ',0
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Error messages
|
||||
|
||||
@@ -2609,13 +2474,11 @@ disasm_cur_pos dd ?
|
||||
disasm_cur_str dd ?
|
||||
disasm_string rb 256
|
||||
|
||||
stack_frame_dump rb sizeof.STACK_FRAME
|
||||
bt_depth rd 1
|
||||
thread_info process_information
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Coordinates and sizes for GUI
|
||||
|
||||
thread_info process_information
|
||||
data_x_size_dd dd ?, ?
|
||||
messages_x_size_dd dd ?, ?
|
||||
registers_x_pos_dd dd ?, ?
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
|
||||
include 'sort.inc'
|
||||
|
||||
struct DEBUG_SYMBOL
|
||||
addr rd 1
|
||||
string rd 0
|
||||
ends
|
||||
|
||||
; compare proc for sorter
|
||||
compare:
|
||||
cmpsd
|
||||
@@ -464,69 +459,4 @@ find_symbol_name:
|
||||
|
||||
@@:
|
||||
pop esi
|
||||
ret
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
;
|
||||
; Find the nearest symol using binary search
|
||||
;
|
||||
; in: eax - target addres
|
||||
; out: esi - symbol name
|
||||
; destroys: ebx, ecx, edx, edi, ebp
|
||||
;
|
||||
find_near_symbol:
|
||||
mov edi, [symbols]
|
||||
|
||||
xor esi, esi ; Result
|
||||
mov ecx, esi ; Left
|
||||
mov edx, [num_symbols] ; Right
|
||||
dec edx
|
||||
js .end
|
||||
|
||||
; If the first address is already greater than the target
|
||||
mov ebp, [edi + ecx * sizeof.DEBUG_SYMBOL]
|
||||
cmp [ebp + DEBUG_SYMBOL.addr], eax
|
||||
ja .end
|
||||
|
||||
; If the last address is less than or equal to the target
|
||||
mov ebp, [edi + edx * sizeof.DEBUG_SYMBOL]
|
||||
cmp [ebp + DEBUG_SYMBOL.addr], eax
|
||||
jbe .found
|
||||
|
||||
.loop:
|
||||
cmp ecx, edx
|
||||
ja .end
|
||||
|
||||
; Calc middle:
|
||||
mov ebx, edx ; Middle
|
||||
sub ebx, ecx ; (right - left)
|
||||
shr ebx, 1 ; / 2
|
||||
add ebx, ecx ; + left
|
||||
|
||||
; Equal
|
||||
mov ebp, [edi + ebx * sizeof.DEBUG_SYMBOL]
|
||||
cmp [ebp + DEBUG_SYMBOL.addr], eax
|
||||
jz .found
|
||||
jb .update_left
|
||||
|
||||
; Update right
|
||||
mov edx, ebx
|
||||
dec edx
|
||||
jmp .loop
|
||||
|
||||
.update_left:
|
||||
; Save potential result
|
||||
mov esi, ebp
|
||||
add esi, DEBUG_SYMBOL.string
|
||||
|
||||
; Update left
|
||||
mov ecx, ebx
|
||||
inc ecx
|
||||
jmp .loop
|
||||
|
||||
.found:
|
||||
mov esi, ebp
|
||||
add esi, DEBUG_SYMBOL.string
|
||||
|
||||
.end:
|
||||
ret
|
||||
ret
|
||||
@@ -135,7 +135,7 @@ start:
|
||||
mov [sockaddr1.port], ax
|
||||
|
||||
xchg al, ah
|
||||
invoke con_printf, str1, ini_buf, eax
|
||||
invoke con_printf, str1, eax
|
||||
add esp, 8
|
||||
|
||||
; open listening socket
|
||||
@@ -341,7 +341,7 @@ thread_exit:
|
||||
; initialized data
|
||||
|
||||
title db 'FTP daemon', 0
|
||||
str1 db 'Starting FTP daemon on %s:%u', 0
|
||||
str1 db 'Starting FTP daemon on port %u.', 0
|
||||
str2 db '.', 0
|
||||
str2b db ' OK!',10,0
|
||||
str3 db 'Listen error',10,0
|
||||
|
||||
Reference in New Issue
Block a user