225 karma · joined Nov 25, 2011 (15y ago) · 91 submissions
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
comment 4y ago · link · parent
>> 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
comment 4y ago · link · parent
(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.
comment 4y ago · link · parent
> 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
comment 5y ago · link · parent
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)13.
Show HN: QEMU Virtual Device Dissection(github.com ↗)
4 points · by wazari972 · 6y ago · discuss
comment 7y ago · link · parent
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-...comment 7y ago · link · parent
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, ...
comment 8y ago · link · parent
8 years ago:
what: Our first date
where: Auckland, NZ
photos:
Camping trip: ...
Roadtrip: ...comment 8y ago · link · parent
please, 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 !
comment 8y ago · link · parent
comment 9y ago · link · parent
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 :)comment 10y ago · link · parent
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 !comment 10y ago · link · parent
> 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)
comment 10y ago · link · parent
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.
comment 10y ago · link · parent
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)
comment 10y ago · link · parent
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 :)
comment 10y ago · link · parent
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"