Giter Club home page Giter Club logo

debugcurl's Introduction

Debug libcurl with llvm

First install openssl and nghttp2 from homebrew:

brew install nghttp2
brew remove curl

Then clone the curl master branch

git clone https://github.com/curl/curl
cd curl

Then configure with openssl and nghttp2:

./buildconf
./configure \
  --with-ssl=/usr/local/opt/openssl \
  --with-ca-bundle=/usr/local/etc/openssl/cert.pem \
  --with-ca-path=/usr/local/etc/openssl/certs \
  --with-nghttp2=/usr/local/opt/nghttp2 \
  --enable-debug \
  --enable-curldebug \

Here is another configuration for http/1 build:

./buildconf
./configure \
  --without-nghttp2 \
  --with-darwinssl \
  --without-ca-bundle \
  --without-ca-path \
  --enable-static \
  --disable-shared \
  --enable-debug \
  --enable-curldebug \
  --without-brotli \
  --without-librtmp \
  --without-libidn2 \
  --without-ldap

Confirm the config status. Then make and install (you really need to install because otherwise LLDB will probably use the system libcurl).

make -j8
make install DESTDIR="/Users/jeroen/libcurl"

Now build an application:

# Should be /usr/local/lib
pkg-config --cflags --libs libcurl 

# Now build
clang -g ./docs/examples/crawler.c -o crawler.exe -lcurl $(pkg-config --cflags --libs libcurl libxml-2.0)

Conform that you link against libcurl in /usr/local:

otool -L crawler.exe

And then run the application in LLDB

lldb crawler.exe

First check image list to make sure we loaded the correct libcurl.dylib. Then press r to start running and bt to get a backtrace!

When done uninstall curl:

make uninstall

debugcurl's People

Contributors

jeroen avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.