Giter VIP home page Giter VIP logo

debug-cosmo-example's Introduction

Debugging C with Cosmopolitan Libc

This repo contains some example programs to showcase the debugging features available when using Cosmopolitan Libc.

Requirements: The recommended development environment for Cosmopolitan Libc is Linux. You'd also need a recent version of gcc (9 or above), ld.bfd, objcopy, and make.

  1. Download the cosmopolitan libc amalgamation into the libcosmo folder
cd libcosmo
wget https://justine.lol/cosmopolitan/cosmopolitan.zip
unzip cosmopolitan.zip
ls -alh
cd ../
  1. Download the cosmopolitan libc amalgamation with ASAN/UBSAN runtime into the libcosmo-dbg folder:
cd libcosmo-dbg/
wget https://justine.lol/cosmopolitan/cosmopolitan-dbg.zip
unzip cosmopolitan-dbg.zip
ls -alh
cd ../
  1. Run make and try out the programs with the sample text files.

  2. Run make clean and make MODE=dbg and try running the programs again.

debug-cosmo-example's People

Contributors

ahgamut avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

debug-cosmo-example's Issues

Warnings while making the sample files

Hi,
I have the following issues when building the sample files. Please will you fix these:

  1. I generally use -Wall to flush out all warnings. Please will you add this to your Makefile.
  2. (Not sure if you do) Don't you need the -ggdb flag? You can ignore this if it is not necessary - I suspect you don't need it but thought I'd bring it up anyway.
  3. Warning while compiling:
cc -g3 -O2 -static -nostdlib -nostdinc -fno-pie -no-pie -mno-red-zone -fno-omit-frame-pointer -pg -mnop-mcount -mno-tls-direct-seg-refs -gdwarf-4  -I./header_stubs -include ..//cosmopolitan.h -o hex16.com.dbg hex16.c -fuse-ld=bfd -Wl,-T,..//ape.lds -Wl,--gc-sections ..//crt.o ..//ape-no-modify-self.o ..//cosmopolitan.a
In file included from <command-line>:31:
./..//cosmopolitan.h:28099: warning: "IFNAMSIZ" redefined
28099 | #define IFNAMSIZ    IF_NAMESIZE
      | 
./..//cosmopolitan.h:27996: note: this is the location of the previous definition
27996 | #define IFNAMSIZ 16
      | 
  1. Warning while linking:
/usr/bin/ld.bfd: warning: .note.gnu.build-id section discarded, --build-id ignored
objcopy -S -O binary hex16-ubsan.com.dbg hex16-ubsan.com

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.