What is GLIBC? What is it used for?

Its the implementation of Standard C library described in C standards plus some extra useful stuffs which are not strictly standard but used frequently. Its main contents are : 1) C library described in ANSI,c99,c11 standards. It includes macros, symbols, function implementations etc.(printf(),malloc() etc) 2) POSIX standard library. The “userland” glue of system calls. (open(),read() … Read more

Why use asprintf() instead of sprintf()?

If you use sprintf() or vsprintf(), you need to allocate a buffer first, and you need to be sure that the buffer is large enough to contain what sprintf writes. Otherwise sprintf() will happily overwrite whatever memory lies beyond the end of the buffer. char* x = malloc(5 * sizeof(char)); // writes “123456” +null but … Read more

How to use the GDB (Gnu Debugger) and OpenOCD for microcontroller debugging – from the terminal?

As I remember it I had some trouble with the straight load command too, so I switched to “flash write_image erase my_project.hex 0 ihex” .. obviously I was using hex files but it looks like elf files should work to, see http://openocd.org/doc/html/Flash-Commands.html … the good thing about this command is it also erases only the … Read more

Disable make builtin rules and variables from inside the make file

Disabling the built-in rules is done by writing an empty rule for .SUFFIXES: .SUFFIXES: Having erased the built-in rules, I’m not sure that erasing the built-in variables helps you much more than just remembering to set them yourself or not use them, but you could use something like $(foreach V, $(shell make -p -f/dev/null 2>/dev/null … Read more

sed -i command for in-place editing to work with both GNU sed and BSD/OSX

OS X sed handles the -i argument differently to the Linux version. You can generate a command that might “work” for both by adding -e in this way: # vv sed -i -e ‘s|\(.*\)\.o:|$(OBJ_DIR)/\1.o $(OBJ_DIR)/\1.d $(TEST_OBJ_DIR)/\1_utest.o:|’ $@ OS X sed -i interprets the next thing after the -i as a file extension for a backup … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)