Replies: 2 comments
-
HI, @gregthelaw - I have implemented most of this integration proposal and it's in review, with PR #8 assigned to you. The only thing left is to address [2], how-to unpack the encoded LOC-ID value to its filename / line#. To get that working, I need to re-do some Python machinery on LOC side, which I will push separately to that repo. Then, I will come back to this repo to finish-up the unpacking effort. That's well-understood, so this discussion item need not remain open for me to chase that down. Once you clear the review assigned to you, this discussion item can be closed. Hope this helps with tracking the status of this proposal. |
Beta Was this translation helpful? Give feedback.
-
The work in this proposal has been productized and integrated to L3
|
Beta Was this translation helpful? Give feedback.
-
Hi, @gregthelaw -- This l3 tooling is very good and easy to use.
Thanks for opening up your repo and this Discussions page!
I would like to propose and explore how this could be integrated with another tooling I've been working on, which I call
LOC
: Line-of-Code tracking. The git-repo is here, and this Workflow document will explain how that technique can be absorbed into an existing code-base.The basic idea for integrating the two tools is as follows:
Getting the code-location into L3's log-entry structure:
.c
/.c++
filesin your repoof any project that you want to annotate debugging with LOC information.LOC Python script generates 3 files which then need-to-be built along with the sources of the project:
loc.h
,loc_tokens.h
,loc_filenames.c
. All this stuff will need to come along with the L3 package.L3's l3.h will
<#include> loc.h
, so the access to LOC-macros is hidden away from the user. The end-user only has to know and care aboutl3.h
.Your existing
l3_log_simple()
andl3_log_fast()
interfaces, which are currently functions, will [probably] change to become caller-macros as follows. E.g.l3_log__simple()
andl3_log__fast()
] will receive a__LOC__
synthesized by the caller-macros.NOTE:
__LOC__
is a#define
whose value will be generated at compile-time by the LOC-machinery.This is how we generate and pass-down the code-location 4-byte ID to the lower level L3 functions.
The core L3 tracking struct
struct l3_entry{}
will store theloc_t loc
, 4-byte quantity, right after thepid_t tid
field. There is already a spare 4-bytes in this entry structure, so there will be no footprint bloat of your log info.Stashing off the
loc_
in the tracking structure by the slow method is easy. For the fast logging, you will need to enhance the assembly code to save this off in the appropriate place, like it's being done forpid
.Unpacking the code-location from the log-entry by l3_dump.py:
Unpacking the
loc
field needs access to the generatedloc_filenames.c
, which we expect will be linked into the user's binary. There are couple of approaches here and need some design work:loc
, as part of its build process. A version of theloc
tool is specific to the project's code-base which is being processed by LOC. For instance, in, say, PostgreSQL repo, you may have multiple versions of this program likepostgres_loc
,pg_backup_loc
,pg_replication_loc
and so on. That means each component of the overall project has its own LOC-deciphering stand-aloneloc
tool as indicated by the s/w component's name.This
loc
tool will unpack a valid 4-byte ID-value to its constituent file name / line # pair. One option is to havel3_dump.py
repeatedly call theloc
program to unpack each of theloc_t
ID-values found in the traces.l3_dump.py
to somehow get access to theFilenames[]
array that is compiled-into the binary, and lookup the file-name given its index.The 1st approach is easier to do, but creates a dependency on having the
loc
stand-alone tool available to the end-user as part of the release / build area.I think there is a good synergy between the two tools and would like to work with you to take this idea forward.
Beta Was this translation helpful? Give feedback.
All reactions