225 karma · joined November 25, 2011
Now I'm post-doc/engineer at University Joseph Fourier, still in the same team, continuing my PhD work as part of the Nano2017 national research project (although debugging and embedded system has (nothing) to do with nano technologies!).
http://blog.0x972.info/?d=2014/09/18/08/55/00-about-me
>> vermagic=2.6.32-696.23.1.el6.x86_64 SMP mod_unload modversions
do you know why they say "approximately match"? I thought it had to match exactly so that the kernel accepts to load the module
(context: my son is DT1) We learn (in France) that hypoglycemia can lead to unconsciousness, but cannot be fatal as the liver will eventually take over and release glucose to the organism, as it always does for healthy persons. Glucagen injection is the way to get this release to happen fast, but it can be delayed if necessary.
> Therefore, we can see Git ignores .gitignore because its in .gitignore, which means it didn’t ignore .gitignore for instructions.
> Is any of this informative, surprising, or useful? … Absolutely.
it's interesting to notice, but nothing surprising. git isn't supposed to ignore it for instructions
same, I woulnd't pronounce "debt" the same way I would pronounce "dette" in French, and likewise for "doubt", which would turn in French "doute" ...
why not simply having 2 QR codes, one full, one light ... ?
with this command you don't import a snapshot, but only the diff between <commit~>..<commit>, so the model parent+diff makes sense to me
I can't easily see the surrounding code
I have Emacs on the side window, so I use GDB to see the immediately surrounding code, and Emacs to see the rest of the function. I do exactly the same for Python debbuging with PDB I have to manually request information rather than just glancing at the display
I just print the variables I want to see, there are not so many of them I'm actually interested in while debugging I have to remember syntax rather than just clicking on things
...and in this case, it took me a few tries to correctly deref this pointer to an fixed-size array
those are the tradeoff between flexibility and ease. You can access any memory locations, and cast it in many different ways, examine the assembly to precisely understand the next steps, examine the bits to precisely understand the storage (only endianness issues remained tricky to follow)As I mentioned above, I will rewrite this sentence to include dedicated special instructions. It was a wording mistake not to mention it!
I will rewrite this sentence, "invalid instruction" is too limited. It should be something like "an instruction that traps, and which isn't already used for another purpose". Syscalls trap but they are already used; and INT3/CC are valid instructions.
which says that Python 3.8 will allow this kind of output:
>> print(f"{name = }")
name = 'karthikeyan'
>>> print(f"{name.upper() = }")
name.upper() = 'KARTHIKEYAN'
0: https://tirkarthi.github.io/programming/2019/05/08/f-string-...actually, in Linux, I used file links (multiple filename pointing to the same file content) to active different booleanflags, eg cv-paper.tex, cv-anonymous.tex, ...
8 years ago:
what: Our first date
where: Auckland, NZ
photos:
Camping trip: ...
Roadtrip: ...it would have allowed writing
(gdb) disas | grep mov
instead of (gdb) shell-pipe disas | grep movplease, GDB internals are open source, you can do all of that in plain C :D That's what I did initially, to give GDB the ability to distinguish user-level threads (see libthread_db).
Having a high-level language / interface to GDB is a great again of time !
first = True
class ptraceBPT(gdb.Breakpoint):
def stop(self):
global first
gdb.execute("return (long int) {}".format("0" if first else "-1"))
first = False
ptraceBPT("ptrace")
what would be interesting is an actual use of ptrace, something like: int i = 10;
int read = ptrace(PTRACE_USER_PEEK, &i, sizeof(i));
if (read != i) printf("ptrace error");
although it still would be hard to write a GDB breakpoint that mimics it: everything ptrace can do, GDB can do it as well :)sure! nothing and nothing ;-) they were just leads I was trying. `target` was for:
void **target; *target = *mov_addr; // move sizeof((void *) bits
I've updated the gist.> Also, even though mprotect() succeeds, I got a segfault.
try in GDB something like:
(gdb) disassemble main
...
0x00000000004005dd <+64>: mov %rax,%rdi
0x00000000004005e0 <+67>: callq 0x400566 <checksum>
0x00000000004005e5 <+72>: mov %rax,-0x8(%rbp)
0x00000000004005e9 <+76>: cmpq $0xad4,-0x8(%rbp)
....
(gdb) break passme.c:62
(gdb) continue # should ends up *after* the memcpy
(gdb) disassemble main
...
0x00000000004005dd <+64>: mov %rax,%rdi
0x00000000004005e0 <+67>: movl $0xad4,-0x8(%rbp)
0x00000000004005e7 <+74>: nop
0x00000000004005e8 <+75>: nop
0x00000000004005e9 <+76>: cmpq $0xad4,-0x8(%rbp)
and in both disassemblies, look around 0x4005e0 (<main+67>) to see how instructions have been overwritten. In the second disassembly, if you see strange-looking instructions (eg clc), there was a problem with the copy / the instruction copied. Let me know !> https://gist.github.com/kpouget/d13b6328dd6ad8489affb3d24ad8...
1/ a simple GDB.py trick: `make debug` (passme.py ) 2/ a not-so-easy-in-the-end LD_PRELOAD trick: `make run` (passme.c)
I still wonder what's missing in GDB. I got quite proficient with this tool, and never had access to VS. I personnally don't count GUIs built on top of GDB, as they don't provide new capabilities, just 'fancier' interfaces that GDB's CLI.
could you elaborate on what's missing in GDB? data-types are written in the binary by the compiler (dwarf format), and GDB does nothing more / nothing less than parsing it and giving access to it through it user interface.
GDB has no knowledge about your code or it's library in itself (at least in C, Python extentions now include libc++ data-type-specific pretty-printers)
For me, examples of mise en abyme is a film shot in a movie, or story read from a book in a book. In CS, it means a function called from another function ... which is not necessarily recursivity :)
Of course I wouldn't accept any critic on syntactic mistakes or even coding style, but I could explain out loud how I construct the initial steps of a program.
I would also let explicit comments like "//google a solution for that" or "//find a library that does this"
I guess that the trick is to set a breakpoint on *alloc/free, and inc/decrement a counter on breakpoint hit? I'll try to implement it in my own tool, but in Python!