egg

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit c401c898f3c491850114c73b6565ff10c28634e8
parent 8c91107b3bbeebbda79c8622a40b261280bc8899
Author: Gabriel G. de Brito (AKA 96) <gabrielgbrito@icloud.com>
Date:   Mon,  9 Sep 2024 14:04:08 -0300

Merge pull request #24 from gboncoffee/3.0.1

3.0.1
Diffstat:
M.gitignore | 1+
MREADME-pt.md | 3++-
MREADME.md | 3++-
Mdebugger.go | 30+++++++++++++++---------------
Minternationalization.go | 10++++++----
Mmain.go | 2+-
6 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,3 +1,4 @@ /egg /egg-windows.exe /egg-linux +/egg-darwin diff --git a/README-pt.md b/README-pt.md @@ -33,7 +33,8 @@ Baixe o binário estático para o seu sistema na página de compilador de Go instalado, baixe e compile o projeto. Nota: o binário para Windows não foi testado. Não tenho acesso a nenhuma máquina -Windows atualmente. +Windows atualmente. O teste do binário para Darwin (MacOS) depende da minha +paciência. ## Uso diff --git a/README.md b/README.md @@ -34,7 +34,8 @@ Simply grab the static binary for your OS at the Go compiler, build the project from source. Note: the Windows binary is untested, as I don't have access to any Windows -machine nowadays. +machine nowadays. The testing of the Darwin (MacOS) binary depends on my +patience. ## Quickstart diff --git a/debugger.go b/debugger.go @@ -97,7 +97,7 @@ func getPrintHashExpr(m machine.Machine, sym []assembler.DebuggerToken, expr str l, err = strconv.ParseUint(sn, 0, 64) if err != nil { - return nil, fmt.Errorf(machine.InterCtx.Get("cannot parse %v as number: %v"), sn, err) + return nil, fmt.Errorf(machine.InterCtx.Get("cannot parse %v as unsigned number: %v"), sn, err) } faddr = m.GetCurrentInstructionAddress() @@ -115,7 +115,7 @@ func getPrintHashExpr(m machine.Machine, sym []assembler.DebuggerToken, expr str l, err = strconv.ParseUint(sn, 0, 64) if err != nil { - return nil, fmt.Errorf(machine.InterCtx.Get("%v is not a number"), sn) + return nil, fmt.Errorf(machine.InterCtx.Get("%v is not an unsigned number"), sn) } } @@ -149,7 +149,7 @@ func getMemoryContentPrint(m machine.Machine, addr string, length string) ([]uin l, err := strconv.ParseUint(length, 0, 64) if err != nil { - return nil, fmt.Errorf(machine.InterCtx.Get("%v is not a number"), length) + return nil, fmt.Errorf(machine.InterCtx.Get("%v is not an unsigned number"), length) } mem, err := m.GetMemoryChunk(a, l) @@ -221,13 +221,13 @@ func printExpr(m machine.Machine, expr string, info *machine.ArchitectureInfo) { // Not very pretty but (mostly) does the job. switch info.WordWidth { case 8: - fmt.Printf("0x%02x\n", c) + fmt.Printf("0x%02x (%d)\n", c, int8(c)) case 16: - fmt.Printf("0x%04x\n", c) + fmt.Printf("0x%04x (%d)\n", c, int16(c)) case 32: - fmt.Printf("0x%08x\n", c) + fmt.Printf("0x%08x (%d)\n", c, int32(c)) default: - fmt.Printf("0x%016x\n", c) + fmt.Printf("0x%016x (%d)\n", c, int64(c)) } return } @@ -530,12 +530,12 @@ func getDumpExpr(m machine.Machine, expr string, prog []uint8) ([]uint8, error) of, err := strconv.ParseUint(offset, 0, 64) if err != nil { - return nil, fmt.Errorf(machine.InterCtx.Get("%v is not a number"), offset) + return nil, fmt.Errorf(machine.InterCtx.Get("%v is not an unsigned number"), offset) } l, err := strconv.ParseUint(length, 0, 64) if err != nil { - return nil, fmt.Errorf(machine.InterCtx.Get("%v is not a number"), length) + return nil, fmt.Errorf(machine.InterCtx.Get("%v is not an unsigned number"), length) } end := of + l @@ -555,11 +555,11 @@ func getDumpExpr(m machine.Machine, expr string, prog []uint8) ([]uint8, error) ad, err := strconv.ParseUint(addr, 0, 64) if err != nil { - return nil, fmt.Errorf(machine.InterCtx.Get("%v is not a number"), addr) + return nil, fmt.Errorf(machine.InterCtx.Get("%v is not an unsigned number"), addr) } l, err := strconv.ParseUint(length, 0, 64) if err != nil { - return nil, fmt.Errorf(machine.InterCtx.Get("%v is not a number"), length) + return nil, fmt.Errorf(machine.InterCtx.Get("%v is not an unsigned number"), length) } mem, err := m.GetMemoryChunk(ad, l) @@ -660,7 +660,7 @@ func getSetExpr(m machine.Machine, expr string) (uint64, uint64, error) { l, err := strconv.ParseUint(length, 0, 64) if err != nil { - return 0, 0, fmt.Errorf(machine.InterCtx.Get("%v is not a number"), length) + return 0, 0, fmt.Errorf(machine.InterCtx.Get("%v is not an unsigned number"), length) } return a, l, nil @@ -678,14 +678,14 @@ func debuggerSet(m machine.Machine, args []string) { return } - value, err := strconv.ParseUint(args[1], 0, 64) + value, err := strconv.ParseInt(args[1], 0, 64) if err != nil { - fmt.Printf(machine.InterCtx.Get("Cannot parse %v as number: %v"), args[1], err) + fmt.Printf(machine.InterCtx.Get("Cannot parse %v as number: %v\n"), args[1], err) return } if length == 0 { - err := m.SetRegister(addr, value) + err := m.SetRegister(addr, uint64(value)) if err != nil { fmt.Printf(machine.InterCtx.Get("Error while changing register content: %v\n"), err) } diff --git a/internationalization.go b/internationalization.go @@ -161,9 +161,11 @@ No comando print, <addr>#tamanho significa "tantas instruções após addr". `, // Debugger functions. "cannot parse %v as number: %v": "impossível converter %v para número", + "cannot parse %v as number: %v\n": "impossível converter %v para número\n", "length not supplied": "tamanho não providenciado", "cannot parse %v as address": "impossível converter %v para endereço", "%v is not a number": "%v não é um número", + "%v is not an unsigned number": "%v não é um número sem sinal", "no instruction at address 0x%x": "nenhuma instrução no endereço 0x%x", "%v is not a register or address": "%v não é um registrador ou endereço", "cannot get memory content: %v": "não foi possível ler o conteúdo da memória: %v", @@ -204,11 +206,11 @@ No comando print, <addr>#tamanho significa "tantas instruções após addr". "Stopped at breakpoint: %v\n": "Parado no ponto (breakpoint): %v\n", "New breakpoint %v\n": "Novo ponto de parada (breakpoint) %v\n", "remove expects a breakpoint to remove: remove <address/label/file:line>": "remove necessita de um ponto (breakpoint) para remover: remove <endereço/etiqueta/arquivo:linha>", - "No breakpoint %v\n": "Nenhum ponto de parada (breakpoint) %v\n", - "Error assembling file:": "Erro montando arquivo:", + "No breakpoint %v\n": "Nenhum ponto de parada (breakpoint) %v\n", + "Error assembling file:": "Erro montando arquivo:", "Keeping old program and program state.": "Mantendo o programa e estado anteriores", - "Error loading new assembled code:": "Erro carregando o novo código montado:", - "Rebuild Assembly.": "Assembly remontado.", + "Error loading new assembled code:": "Erro carregando o novo código montado:", + "Rebuild Assembly.": "Assembly remontado.", // // assembler.go and tokenizer.go diff --git a/main.go b/main.go @@ -15,7 +15,7 @@ import ( "github.com/gboncoffee/egg/sagui" ) -const VERSION = "3.0.0" +const VERSION = "3.0.1" // Put new architetures here... (main.go:/switch architeture) func listArchs() {