devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Vincent Guittot
	<vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Frank Rowand
	<frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Bill Mills <bill.mills-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jon Loeliger <loeliger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [DTC][RFC] dtc: Allow better error reporting
Date: Mon, 22 Feb 2021 17:12:39 +1100	[thread overview]
Message-ID: <YDNLV9/wnuIL8rxe@yekko.fritz.box> (raw)
In-Reply-To: <20210219053753.xtikm3ixfhq3bukr@vireshk-i7>

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

On Fri, Feb 19, 2021 at 11:07:53AM +0530, Viresh Kumar wrote:
> On 17-02-21, 16:07, David Gibson wrote:
> > > diff --git a/dtc.h b/dtc.h
> > > index d3e82fb8e3db..b8ffec155263 100644
> > > --- a/dtc.h
> > > +++ b/dtc.h
> > > @@ -29,6 +29,12 @@
> > >  #define debug(...)
> > >  #endif
> > >  
> > > +#ifdef VERBOSE
> > > +#define dtc_err(fmt, ...)	fprintf(stderr, "DTC: %s: %d: " fmt, __func__, __LINE__, ##__VA_ARGS__)
> > > +#else
> > > +#define dtc_err(fmt, ...)
> > > +#endif
> > 
> > Actually, the natural way to handle this is to make dtc_err() -
> > hrm... bad name, since this is libfdt - be something that must be
> > provided by libfdt_env.h.  The default version would have it be a
> > no-op, with a define that makes it use stdio.
> > 
> > This has the additional advantage that it would be relatively
> > straightfoward to enable the rich reporting in a non-POSIXish
> > environment (these should provide their own libfdt_env.h and it can
> > implement the error reporting callback in a way that makes sense in
> > that environment.
> 
> Okay, I will move it to libfdt_env.h. And using -DVERBOSE to enable
> rich errors look fine to you, right ?

Well, using -DVERBOSE looks like an option worth considering further
to me.  I'm not yet totally convinced its the best approach.

> > You will also definitely need Makefile changes, because you'll need to
> > make the fdtoverlay binary link to the verbose-compiled version of
> > libfdt not the normal one.
> 
> Actually it worked for me because of how we compile this in kernel, we
> don't link different libraries there.
> 
> libfdt-objs     := fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o fdt_strerror.o fdt_empty_tree.o fdt_addresses.o fdt_overlay.o
> libfdt          = $(addprefix libfdt/,$(libfdt-objs))
> fdtoverlay-objs := $(libfdt) fdtoverlay.o util.o
> 
> HOST_EXTRACFLAGS := -DVERBOSE

Um.. I think this is only working because the objects are compiled one
way for the target and another for the host.  If you ever wanted to
build any other host side tools that shouldn't have -DVERBOSE, this
would break.

> > Except.... it might make more sense to do this in dtc rather than
> > libfdt, more on that in different mails.
> 
> I am not sure about this comment, are you going to send more emails on
> this ?

Sorry, I got sidetracked and didn't get around to following that up.
I'm still trying to do that.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2021-02-22  6:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-11 11:27 [DTC][RFC] dtc: Allow better error reporting Viresh Kumar
     [not found] ` <3950d7da35130a850ba9217ac7bfef781fa850b2.1613042485.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2021-02-11 14:22   ` Rob Herring
     [not found]     ` <CAL_JsqLfLQe7bxcGYeoSWsBnS+JoagLcOZ-RGS0hbdwjRhfBqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-02-15  7:42       ` Viresh Kumar
2021-02-17  5:07   ` David Gibson
     [not found]     ` <YCyknRMDNA4+pd59-l+x2Y8Cxqc4e6aEkudXLsA@public.gmane.org>
2021-02-19  5:37       ` Viresh Kumar
2021-02-22  6:12         ` David Gibson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YDNLV9/wnuIL8rxe@yekko.fritz.box \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=bill.mills-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=loeliger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).