xargs(1) – Dein Freund und Helfer
$ find /web -path '*.logs*.log' -exec du -sh {} \; $ find /web -path '*.logs*.log' | xargs rm
xargs(1) – Dein Freund und Helfer
$ find /web -path '*.logs*.log' -exec du -sh {} \; $ find /web -path '*.logs*.log' | xargs rm
What gdb Does During Startup
GNU GDB Debugger Command Cheat Sheet
--command=<file>, -x <file> File listing GDB commands to perform. Good for automating set-up. --batch -x <file> Run in batch (not interactive) mode. Execute commands from file.
Gdb basics
Gdb looks for source files in $cdir (directory embedded in executable recorded during compilation) and $cwd (current working directory). You can add to this list via dir e.g. dir ..\..\WebCore\platform. See current list via show dir. If you need this, it’s a perfect candidate for putting inside .gdbinit file.
(gdb) info sources Source files for which symbols have been read in: /home/andreas/src/hcpp/software/app/src/hcpp/ptp2_master.c, [...]
GDB corrupted stack frame – How to debug?
Examining the Stack
Eclipse Help: Adding watchpoints
Watchpoints: Data Breakpoints
Eclipse CDT + GDB: Setting Watchpoints (Juno)
Assembly Instruction Stepping
Eclipse GDB in combination with OpenOCD
github Gdbinit: A user-friendly gdb configuration file, for x86/x86_64 and ARM platforms
github Gdbinit: gdbinit
Automating GDB Sessions
Automate gdb: show backtrace at every call to function puts
$ gdbserver :2345 ./program Process ./program created; pid = 1851 Listening on port 2345 Remote debugging from host 127.0.0.1
$ gdb GNU gdb (GDB) 7.5-ubuntu Copyright (C) 2012 Free Software Foundation, Inc. This GDB was configured as "x86_64-linux-gnu". No symbol table is loaded. Use the "file" command. (gdb) file ./program Reading symbols from ./program...done. (gdb) target remote :2345 Remote debugging using :2345 Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug/lib/x86_64-linux-gnu/ld-2.15.so...done. Loaded symbols for /lib64/ld-linux-x86-64.so.2 0x00007ffff7ddb6c0 in _start () from /lib64/ld-linux-x86-64.so.2
Or using Eclipse: C/C++ Remote Application
Clock: 125 MHz = 8 ns Sleep: 8 ns * 125 = 1 us
void sleep_ms(int milisec) { int i; int k; for (i = 0; i < milisec; i++) { for (k = 0; k < 125; k++) { __asm("nop"); } } } int main() { int i = 0; int k = 0; while (1) { k = 1 << i; i++; av_bus_write_32(HOST_REG_USER0, k); sleep_ms(5); if (i > 4) { i = 0; } } return 0; }