zsh-workers
 help / color / mirror / code / Atom feed
* Documentation and tools to understand and debug the Zsh codebase
@ 2022-11-12 22:16 Philippe Altherr
  2022-11-13  5:20 ` Daniel Shahaf
  2022-11-17 18:07 ` Oliver Kiddle
  0 siblings, 2 replies; 3+ messages in thread
From: Philippe Altherr @ 2022-11-12 22:16 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1911 bytes --]

Hi everyone,

About a year ago, a friend of mine finally convinced me to look into Zsh. I
quickly became a big fan. All the little extra features and behavior tweaks
add up and make it in my opinion a much better shell than Bash, which I was
using until then. Nevertheless, I still stumbled on a few bugs and
shortcomings. Since I have some free time on my hands, I figured that I
could maybe one day help address some of these. Last week, I finally took
the plunge and started looking into the codebase to understand what was
going on with ERR_EXIT (see related thread
<https://www.zsh.org/mla/workers/2022/msg01203.html>).

So far, I have mainly studied exec.c
<https://sourceforge.net/p/zsh/code/ci/master/tree/Src/exec.c> and loop.c
<https://sourceforge.net/p/zsh/code/ci/master/tree/Src/loop.c>, which seem
to constitute the bulk of the evaluation loop. I have also seen that zsh.h
<https://sourceforge.net/p/zsh/code/ci/master/tree/Src/zsh.h> contains most
of the important data structures and I he found the description of word
codes in parse.c
<https://sourceforge.net/p/zsh/code/ci/master/tree/Src/parse.c#l100>,
which was very helpful. I think that I now have a relatively good overall
understanding but I still lack many of the details. While the role of the
functions in loop.c is self-explanatory, it's less true for some of the
functions in exec.c. I would also be unable to accurately translate a Zsh
expression into a sequence of word codes.

Here are some of my most pressing questions:
- Are there other files that I should read?
- Is there a way to print the parsed word codes? Or to print them as they
get evaluated?
- What tools do you use to debug zsh? Are there flags or modules I should
be aware of?
- How do you search the mailing list? I don't see a search box on
www.zsh.org/mla/.
  - I somehow stumbled on inbox.vuxu.org/zsh-workers/, which has one. Is
that the way to go?

Philippe

[-- Attachment #2: Type: text/html, Size: 2281 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Documentation and tools to understand and debug the Zsh codebase
  2022-11-12 22:16 Documentation and tools to understand and debug the Zsh codebase Philippe Altherr
@ 2022-11-13  5:20 ` Daniel Shahaf
  2022-11-17 18:07 ` Oliver Kiddle
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Shahaf @ 2022-11-13  5:20 UTC (permalink / raw)
  To: Philippe Altherr; +Cc: zsh-workers

Philippe Altherr wrote on Sat, Nov 12, 2022 at 23:16:02 +0100:
> Hi everyone,
> 
> About a year ago, a friend of mine finally convinced me to look into Zsh. I
> quickly became a big fan. All the little extra features and behavior tweaks
> add up and make it in my opinion a much better shell than Bash, which I was
> using until then. Nevertheless, I still stumbled on a few bugs and
> shortcomings. Since I have some free time on my hands, I figured that I
> could maybe one day help address some of these. Last week, I finally took
> the plunge and started looking into the codebase to understand what was
> going on with ERR_EXIT (see related thread
> <https://www.zsh.org/mla/workers/2022/msg01203.html>).
> 
> So far, I have mainly studied exec.c
> <https://sourceforge.net/p/zsh/code/ci/master/tree/Src/exec.c> and loop.c
> <https://sourceforge.net/p/zsh/code/ci/master/tree/Src/loop.c>, which seem
> to constitute the bulk of the evaluation loop. I have also seen that zsh.h
> <https://sourceforge.net/p/zsh/code/ci/master/tree/Src/zsh.h> contains most
> of the important data structures and I he found the description of word
> codes in parse.c
> <https://sourceforge.net/p/zsh/code/ci/master/tree/Src/parse.c#l100>,

(About this link's syntax, see <https://zsh.org/workers/37966>.)

> - How do you search the mailing list? I don't see a search box on
> www.zsh.org/mla/.

Personally, I've been subscribed to the list for years so I just search
my mailbox.

The archives are available in rfc822 form (see the left column of
https://www.zsh.org/mla/; also available via rsync); you can download
that and import it to any mail search tool you like.

Leaving your other questions to others.

Cheers,

Daniel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Documentation and tools to understand and debug the Zsh codebase
  2022-11-12 22:16 Documentation and tools to understand and debug the Zsh codebase Philippe Altherr
  2022-11-13  5:20 ` Daniel Shahaf
@ 2022-11-17 18:07 ` Oliver Kiddle
  1 sibling, 0 replies; 3+ messages in thread
From: Oliver Kiddle @ 2022-11-17 18:07 UTC (permalink / raw)
  To: Philippe Altherr; +Cc: zsh-workers

On 12 Nov, Philippe Altherr wrote:
> - Is there a way to print the parsed word codes? Or to print them as they get
> evaluated?

I attached a gdb pretty printer for word codes to 44319 if that helps at
all: https://www.zsh.org/mla/workers/2019/msg00356.html

> - What tools do you use to debug zsh? Are there flags or modules I should be
> aware of?
> - How do you search the mailing list? I don't see a search box on [6]
> www.zsh.org/mla/.

I use mairix with a local archive. You can grab mbox format archives
with rsync.

When the lists were last migrated I never got around to getting the
search working again. The old search used software that is long dead and
while we do have a copy of the sources, it'd be better to come up with
something new. public-inbox.org is interesting but does rather too much.
It ought to be possible to configure Xapian to do the job.

>   - I somehow stumbled on [7]inbox.vuxu.org/zsh-workers/, which has one. Is
> that the way to go?

That works so, yes for now it's a good choice. 

Oliver


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-17 18:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-12 22:16 Documentation and tools to understand and debug the Zsh codebase Philippe Altherr
2022-11-13  5:20 ` Daniel Shahaf
2022-11-17 18:07 ` Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).