c:accueil

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
c:accueil [2024/09/29 11:30] – [Langage C] add link phswc:accueil [2025/11/05 15:18] (Version actuelle) – [Langage C] add link phsw
Ligne 11: Ligne 11:
   * [[http://gauss.ececs.uc.edu/Courses/c4029/code/C-primer/c-primer.pdf]]   * [[http://gauss.ececs.uc.edu/Courses/c4029/code/C-primer/c-primer.pdf]]
   * [[https://axcheron.github.io/playing-with-ld_preload/|Playing with LD_PRELOAD]]   * [[https://axcheron.github.io/playing-with-ld_preload/|Playing with LD_PRELOAD]]
-  * [[https://jorengarenar.github.io/blog/less-known-c|Few lesser known tricks, quirks and features of C]]+  * [[https://jorengarenar.github.io/blog/less-known-c|Few lesser known tricks, quirks and features of C]] ou [[https://jorenar.com/blog/less-known-c|Few lesser known tricks, quirks and features of C]]
   * [[https://lemire.me/blog/2024/01/21/c23-a-slightly-better-c/|C23: a slightly better C]]   * [[https://lemire.me/blog/2024/01/21/c23-a-slightly-better-c/|C23: a slightly better C]]
   * [[https://wordsandbuttons.online/so_you_think_you_know_c.html|So you think you know C?]]   * [[https://wordsandbuttons.online/so_you_think_you_know_c.html|So you think you know C?]]
   * [[https://zestedesavoir.com/articles/4559/la-norme-c23-est-dans-les-cartons-1/|La norme C23 est dans les cartons]]   * [[https://zestedesavoir.com/articles/4559/la-norme-c23-est-dans-les-cartons-1/|La norme C23 est dans les cartons]]
   * [[https://github.com/theokwebb/C-from-Scratch|C from Scratch]]   * [[https://github.com/theokwebb/C-from-Scratch|C from Scratch]]
 +  * [[https://bible.malcore.io/readme/the-beginning/introduction-to-c|Introduction to C]]
 +  * [[https://lemon.rip/w/c99-vla-tricks/|C99 doesn't need function bodies, or 'VLAs are Turing complete']]
 +  * [[https://developers.redhat.com/articles/2024/12/11/making-memcpynull-null-0-well-defined|Making memcpy(NULL, NULL, 0) well-defined]]
 +  * [[https://fuckingfunctionpointers.com/|How Do I Declare a Function Pointer in C?]]
 +  * [[https://embeddedor.com/blog/2024/06/18/how-to-use-the-new-counted_by-attribute-in-c-and-linux/|How to use the new counted_by attribute in C (and Linux)]]
 +  * [[https://github.com/CodeWithHarry/The-Ultimate-C-Programming-Course|The Ultimate C Programming Handbook]]
 +  * [[http://www.graphics.stanford.edu/~seander/bithacks.html|Bit Twiddling Hacks]]
 +
  
  
Ligne 282: Ligne 290:
     printf("stdin is a file or a pipe\n");     printf("stdin is a file or a pipe\n");
 </code> </code>
 +
 +
 +==== _Generic ====
 +
 +  * [[https://www.chiark.greenend.org.uk/~sgtatham/quasiblog/c11-generic/|Workarounds for C11 _Generic]]
 +  * [[https://medium.com/@pauljlucas/generic-in-c-d7ab47e3b5ab|_Generic in C]]
 +  * [[https://en.cppreference.com/w/c/language/generic.html|Generic selection (since C11)]]
 +  * [[http://www.robertgamble.net/2012/01/c11-generic-selections.html|C11 - Generic Selections]]
  
  
Ligne 317: Ligne 333:
 <code bash> <code bash>
 addr2line -e main.out 0x4007db addr2line -e main.out 0x4007db
 +</code>
 +
 +<code bash>
 +#!/bin/bash
 +
 +readonly BACKTRACE_FILE=$1
 +
 +for l in $(grep -E "^/.+\(.+\)\[.+\]" $BACKTRACE_FILE)
 +do
 + lib=$(echo $l | sed -E "s/(\/.+)\(.+/\1/g")
 + addr=$(echo $l | sed -E "s/.+\((.+)\).+/\1/g")
 + ans=$(addr2line -e $lib $addr)
 + if [[ $ans == "??"* ]]
 + then
 + echo $l
 + else
 + echo $ans
 + fi
 +done
 </code> </code>
  
Ligne 331: Ligne 366:
  
   * [[https://blog.malicious.group/inline-assembly/|Inline Assembly]]   * [[https://blog.malicious.group/inline-assembly/|Inline Assembly]]
 +  * [[https://s-mazigh.github.io/ASMx86_64/index.html|ASM x86_64]]
 +  * https://diveintosystems.org/book/C7-x86_64/index.html
 +  * [[https://yuriygeorgiev.com/2024/02/19/x86-64-cpu-architecture-the-stack/|x86/x64 CPU architecture: the stack & stack frames]]
 +  * [[https://cs.brown.edu/courses/cs033/docs/guides/x64_cheatsheet.pdf|x64 Cheat Sheet]]
  
  
Ligne 338: Ligne 377:
 Ajouter l'option ''-fdiagnostics-color=always'' à la commande ''gcc'' ([[https://stackoverflow.com/questions/26070873/how-to-set-gcc-colors-in-gcc4-9-to-emit-colorizing-diagnostics-messages|source]]). Ajouter l'option ''-fdiagnostics-color=always'' à la commande ''gcc'' ([[https://stackoverflow.com/questions/26070873/how-to-set-gcc-colors-in-gcc4-9-to-emit-colorizing-diagnostics-messages|source]]).
  
 +
 +
 +==== ifunc ====
 +
 +Mécanisme qui permet de choisir quelle fonction associer à un symbole lors de la résolution des symboles lors du lancement d'un binaire.
 +
 +  * [[https://jasoncc.github.io/gnu_gcc_glibc/gnu-ifunc.html|GNU Indirect Function and x86 ELF ABIs]]
 +  * [[https://willnewton.name/2013/07/02/using-gnu-indirect-functions/|Using GNU indirect functions]]
 +  * [[https://maskray.me/blog/2021-01-18-gnu-indirect-function|GNU indirect function]]
 +
 +
 +==== Gestion des caractères non-ASCII ====
 +
 +  * [[https://stackoverflow.com/questions/32523898/c-reading-non-ascii-characters|c reading non ASCII characters]]
 +
 +
 +==== Fichiers de suppressions pour sanitizers ====
 +
 +  * [[https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer#suppressions]]
 +
 +Dans un fichier ''asan.supp'' :
 +<code>
 +leak:libdbus-1.so
 +</code>
 +
 +<code bash>
 +LSAN_OPTIONS=suppressions=asan.supp,print_suppressions=0 ./programme
 +</code>
  • c/accueil.1727602246.txt.gz
  • Dernière modification : 2024/09/29 11:30
  • de phsw