[haiku-development] Re: How to debug inside webkit and other system libraries

  • From: Fotis Kapetanias <fotis.kapetanias@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 14 Feb 2021 15:13:26 +0200

On the 64bit version of Haiku you actually need to build the buildtools
yourself for a complete build. The reason is that the BIOS bootloader needs
to be bult in 32bit mode, and the compiler shipped with Haiku does not
know how to do this, but the one built from the configure script can.

It does not prevent you from building other parts of Haiku.

Thanks, that clarifies things. I had the same impression from the
website guide but then I came across the following text in
ReadMe.Compiling.md and got slightly confused:

Building Jam
-------------------------------------------
(*This step applies only to non-Haiku platforms. Haiku already ships
with the correct version of Jam*)

Then checked that indeed I had correct version of jam and continued...

What libraries get loaded is decided by the runtime_loader (the piece of
code that loads and runs executables). It searches for libraries according
to the LIBRARY_PATH environment variable. So if you want to use modified
libraries (built with debug symbols), you need to make sure they are in
the library path. Either change the variable, or copy the files in one
of the directories it is set to look at.

One easy way to do this is to copy the WebPositive executable somewhere,
create a "lib" directory next to it, and put the libraries you want to use
in that directory (you can use symlinks to the libraries inside Haiku
generated/
directory, so you only need to set this up once).

This works because the first entry in LIBRARY_PATH is %A/lib, and %A is a
shorthand for "the directory where the application is". Using this setup
has the advantage of not touching any other part of your Haiku install.

To build libraries in debug mode, you need to enable that in
build/jam/UserBuildConfig
Setting debug mode is normally done source directory by source directory.

Very clear, LIBRARY_PATH is similar to Linux's approach. I like also
the lib approach next to WebPositive. Is there a reason to not create
the lib folder directly in the folder that WebPositive executable has
been generated? Because you mention to copy executable somewhere else.
I suspect some flexibility reasons in some scenarios.
And yes, I remember now that I did use build/jam/UserBuildConfig to
make debug build of WebPositive.

For WebKit itself (which is built separately from Haiku) the process is
different, and is documented in the README in the WebKit repository.

That explains why I didn't find Webkit source anywhere inside Haiku's
source code. I have some study to do here. I may come up with
questions :)

It's the right place (the forums are also usable for this, as you prefer).
We are happy to get more help, and personally I'm particularly happy to see
more people working on the web browser.

I will probably continue to use the list for such development details.
I really hope to be able to help even in very slow pace (sooner or
later). It's outside of my development comfort zone but due exactly to
that is a very good chance to learn new things and evolve.

Please let me know if the mail format, as you see it, is OK. I read
list's guide for composing/replying but may missed something.

--
Fotis

Other related posts: