Skip to content

Instantly share code, notes, and snippets.

View stefantalpalaru's full-sized avatar

Ștefan Talpalaru stefantalpalaru

View GitHub Profile
@stefantalpalaru
stefantalpalaru / gdb.txt
Created May 13, 2019 20:17
tflowvar deadlock
(gdb) bt
#0 0x00007f874128ef6c in pthread_cond_wait () from target:/lib64/libpthread.so.0
#1 0x000055ed8f46fbe3 in wait_1jWf7NqlMVz9aQJMRL9bTm9bQthreadpool ()
#2 0x000055ed8f46fc93 in blockUntil_9czoqdg4eHIgtJ4wssK5YHA_3 ()
#3 0x000055ed8f47240f in sync_p4oO1XgRwu6WxNojgsXntg_2 ()
#4 0x000055ed8f45b2d5 in NimMainModule ()
#5 0x000055ed8f45b1c5 in NimMainInner ()
#6 0x000055ed8f45b201 in NimMain ()
#7 0x000055ed8f45b24f in main ()
@stefantalpalaru
stefantalpalaru / upnpError_MjEGT9ac9a4KVedMMzZX8a5g_2.asm
Created May 1, 2019 11:09
upnpError_MjEGT9ac9a4KVedMMzZX8a5g.asm - "gcc -S -fverbose-asm" output
.globl upnpError_MjEGT9ac9a4KVedMMzZX8a5g
.def upnpError_MjEGT9ac9a4KVedMMzZX8a5g; .scl 2; .type 32; .endef
.seh_proc upnpError_MjEGT9ac9a4KVedMMzZX8a5g
upnpError_MjEGT9ac9a4KVedMMzZX8a5g:
.LFB4285:
.loc 2 542 82
.cfi_startproc
pushq %rbp #
.seh_pushreg %rbp
.cfi_def_cfa_offset 16
@stefantalpalaru
stefantalpalaru / upnpError_MjEGT9ac9a4KVedMMzZX8a5g.asm
Created May 1, 2019 09:55
upnpError_MjEGT9ac9a4KVedMMzZX8a5g.asm
(gdb) disas upnpError_MjEGT9ac9a4KVedMMzZX8a5g
Dump of assembler code for function upnpError_MjEGT9ac9a4KVedMMzZX8a5g:
0x0000000000419bda <+0>: push %rbp
0x0000000000419bdb <+1>: mov %rsp,%rbp
0x0000000000419bde <+4>: sub $0x50,%rsp
0x0000000000419be2 <+8>: mov %rcx,0x10(%rbp)
0x0000000000419be6 <+12>: lea 0x12dd2(%rip),%rax # 0x42c9bf <TM_XQYS3he3QszP5orM2CZQnw_7+79>
0x0000000000419bed <+19>: mov %rax,-0x28(%rbp)
0x0000000000419bf1 <+23>: lea 0x12d9a(%rip),%rax # 0x42c992 <TM_XQYS3he3QszP5orM2CZQnw_7+34>
0x0000000000419bf8 <+30>: mov %rax,-0x18(%rbp)
proc upnpError*(errno: cint): cstring =
if errno == UPNPCOMMAND_HTTP_ERROR:
return "Miniupnpc HTTP error"
elif errno == UPNPCOMMAND_MEM_ALLOC_ERROR:
return strupnperror(UPNPDISCOVER_MEMORY_ERROR)
else:
return strupnperror(errno)
@stefantalpalaru
stefantalpalaru / upnpError_MjEGT9ac9a4KVedMMzZX8a5g_cleaned.c
Created May 1, 2019 09:52
upnpError_MjEGT9ac9a4KVedMMzZX8a5g_cleaned.c
N_LIB_PRIVATE N_NIMCALL(NCSTRING, upnpError_MjEGT9ac9a4KVedMMzZX8a5g)(int errno) {
NCSTRING result; nimfr_("upnpError", "miniupnpc.nim");{ result = (NCSTRING)0;
if (!(errno == UPNPCOMMAND_HTTP_ERROR_4dcWoyFctzTff7yadmKVjA)) goto LA3_;
result = "Miniupnpc HTTP error"; goto BeforeRet_;
}
goto LA1_;
LA3_: ;
{
@stefantalpalaru
stefantalpalaru / upnpError_MjEGT9ac9a4KVedMMzZX8a5g.c
Created May 1, 2019 09:50
upnpError_MjEGT9ac9a4KVedMMzZX8a5g.c
#line 542 "C:\\Users\\user\\Desktop\\status\\nimbus\\vendor\\nim-nat-traversal\\nat_traversal\\miniupnpc.nim"
N_LIB_PRIVATE N_NIMCALL(NCSTRING, upnpError_MjEGT9ac9a4KVedMMzZX8a5g)(int errno) {
NCSTRING result; nimfr_("upnpError", "miniupnpc.nim");{ result = (NCSTRING)0;
#line 543 "C:\\Users\\user\\Desktop\\status\\nimbus\\vendor\\nim-nat-traversal\\nat_traversal\\miniupnpc.nim"
nimln_(543, "miniupnpc.nim"); {
#line 543 "C:\\Users\\user\\Desktop\\status\\nimbus\\vendor\\nim-nat-traversal\\nat_traversal\\miniupnpc.nim"
if (!(errno == UPNPCOMMAND_HTTP_ERROR_4dcWoyFctzTff7yadmKVjA)) goto LA3_;
#line 544 "C:\\Users\\user\\Desktop\\status\\nimbus\\vendor\\nim-nat-traversal\\nat_traversal\\miniupnpc.nim"
nimln_(544, "miniupnpc.nim");
@stefantalpalaru
stefantalpalaru / gdb.txt
Created April 24, 2019 19:43
(gdb) disas strupnperror on Linux
(gdb) disas strupnperror
Dump of assembler code for function strupnperror:
0x00000000001b507d <+0>: push %rbp
0x00000000001b507e <+1>: mov %rsp,%rbp
0x00000000001b5081 <+4>: mov %edi,-0x14(%rbp)
0x00000000001b5084 <+7>: movq $0x0,-0x8(%rbp)
0x00000000001b508c <+15>: cmpl $0x2c0,-0x14(%rbp)
0x00000000001b5093 <+22>: je 0x1b531e <strupnperror+673>
0x00000000001b5099 <+28>: cmpl $0x2c0,-0x14(%rbp)
0x00000000001b50a0 <+35>: jg 0x1b5169 <strupnperror+236>
@stefantalpalaru
stefantalpalaru / gdb.txt
Created April 24, 2019 19:37
disas upnpError_MjEGT9ac9a4KVedMMzZX8a5g on Linux
(gdb) disas upnpError_MjEGT9ac9a4KVedMMzZX8a5g
Dump of assembler code for function upnpError_MjEGT9ac9a4KVedMMzZX8a5g:
0x0000000000190e00 <+0>: cmp %edi,0x1f8782(%rip) # 0x389588 <UPNPCOMMAND_HTTP_ERROR_4dcWoyFctzTff7yadmKVjA>
0x0000000000190e06 <+6>: je 0x190e28 <upnpError_MjEGT9ac9a4KVedMMzZX8a5g+40>
0x0000000000190e08 <+8>: cmp %edi,0x1f876a(%rip) # 0x389578 <UPNPCOMMAND_MEM_ALLOC_ERROR_z5JLXg8JMFQpjFv9bow7B8g>
0x0000000000190e0e <+14>: je 0x190e18 <upnpError_MjEGT9ac9a4KVedMMzZX8a5g+24>
0x0000000000190e10 <+16>: jmpq 0x1b507d <strupnperror>
0x0000000000190e15 <+21>: nopl (%rax)
0x0000000000190e18 <+24>: mov 0x1f85ba(%rip),%edi # 0x3893d8 <UPNPDISCOVER_MEMORY_ERROR_gvgUHp9bQi8yCKvj21D1Fyg>
0x0000000000190e1e <+30>: jmpq 0x1b507d <strupnperror>
@stefantalpalaru
stefantalpalaru / gdb.txt
Created April 24, 2019 19:30
(gdb) disas upnpError_MjEGT9ac9a4KVedMMzZX8a5g
(gdb) disas upnpError_MjEGT9ac9a4KVedMMzZX8a5g
Dump of assembler code for function upnpError_MjEGT9ac9a4KVedMMzZX8a5g:
0x00000000005788f0 <+0>: push %rbx
0x00000000005788f1 <+1>: sub $0x20,%rsp
0x00000000005788f5 <+5>: mov %rcx,%rbx
0x00000000005788f8 <+8>: callq *%rcx
0x00000000005788fa <+10>: mov 0x1e3a98(%rip),%edx # 0x75c398 <UPNPCOMMAND_HTTP_ERROR_4dcWoyFctzTff7yadmKVjA>
0x0000000000578900 <+16>: cmp %edx,(%rax)
0x0000000000578902 <+18>: je 0x578920 <upnpError_MjEGT9ac9a4KVedMMzZX8a5g+48>
0x0000000000578904 <+20>: callq *%rbx
@stefantalpalaru
stefantalpalaru / gdb.txt
Created April 24, 2019 18:52
strupnperror() disassembly in GDB, after using sockets without calling WSAStartup()
(gdb) p strupnperror
$1 = {const char *(int)} 0x422c30 <strupnperror>
(gdb) disas strupnperror
Dump of assembler code for function strupnperror:
0x0000000000422c30 <+0>: push %rbp
0x0000000000422c31 <+1>: mov %rsp,%rbp
0x0000000000422c34 <+4>: sub $0x10,%rsp
0x0000000000422c38 <+8>: mov %ecx,0x10(%rbp)
0x0000000000422c3b <+11>: movq $0x0,-0x8(%rbp)
0x0000000000422c43 <+19>: cmpl $0x2c0,0x10(%rbp)