The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,089 other followers

Archive for June 11th, 2020

Delphi AMQP links

Posted by jpluimers on 2020/06/11

Some links I found about Delphi and AMQP.

AMQP

Delphi and AMQP

Threads:

Tests

Other environments

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

LD_PRELOAD: preload a Linux library, for instance to obtain more information on a segmentation fault

Posted by jpluimers on 2020/06/11

Not being a proficient Linux programmer, I wondered what other means than learning gdb intrinsics I had to get more information about a segmentation fault.

A while back, pip list 2> /dev/null would cause a segmentation fault on my system (see [WayBack] Bug 1084812 – [aarch64] IPv4 DNS leading to segfaults).

It turns out that LD_PRELOAD was my friend (like TERM=xterm was a friend before):

LD_PRELOAD=libSegFault.so pip list 2> /dev/null

It indicated that the problem was in libc, which on opensuse is implemented by glibc.

This meant that the originally diagnosed problem was already accurately describing the symptoms.

Searching for glibc libSegFault.so didn’t reveal many useful links, so I’ve included the one making most sense to me here:

The cool thing: most of the links above come from [WayBack] segmentation fault – Can you get any program in Linux to print a stack trace if it segfaults? – Server Fault which I found when searching for linux find segmentation fault stack trace

That link explains both the LD_PRELOAD steps and gdb steps (:

An alternative is to use gdb directly: [WayBack] command line arguments – How do I run a program with commandline args using gdb within a bash script? – Stack Overflow:

gdb -ex=run --args pip list

–jeroen

Posted in *nix, C, Development, gcc, Linux, Power User, Software Development | Leave a Comment »

Don’t mix objects and interfaces

Posted by jpluimers on 2020/06/11

Worth repeating Dalija Prasnikar, because I bumped into sources of people not getting this concept: [WayBack]: Don’t mix objects and interfaces.

You should not, but sometimes it is hard not to.

The rules in his article are very important as they indicate what’s safe and what’s not:

  1. object references are weak, interface references are strong
  2. reference counted object instances need at least one strong reference to keep them alive therefore you can’t use object reference as primary owning reference
  3. reference counted object instances can be safely accessed through temporary, short-lived (weak) object references, as long as there are strong reference(s) keeping the object alive

So basically:

  • ensure a reference counted instance has at least one strong reference to manage the lifetime
  • temporary (short-lived) weak references are OK as long as you are sure the strong reference lives longer

Note that unsafe will make interfaces references weak instead of strong; the same holds for pointer lists [WayBack] Using the [unsafe] attribute, it is possible to store the interface without reference counting. Is there any way for this behavior to be “transferred” … – Jacek Laskowski – Google+

–jeroen

via: [WayBack] Dalija Prasnikar – Google+

Posted in Delphi, Development, Software Development | Leave a Comment »

 
%d bloggers like this: