blob: 9fb159eae67f9bda70759a36cfa39938052741e0 [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
2
3Debugging Tools and Techniques
4******************************
5
6The exact method for debugging build failures depends on the nature of
7the problem and on the system's area from which the bug originates.
8Standard debugging practices such as comparison against the last known
9working version with examination of the changes and the re-application
10of steps to identify the one causing the problem are valid for the Yocto
11Project just as they are for any other system. Even though it is
12impossible to detail every possible potential failure, this section
13provides some general tips to aid in debugging given a variety of
14situations.
15
16.. note::
17
18 A useful feature for debugging is the error reporting tool.
19 Configuring the Yocto Project to use this tool causes the
20 OpenEmbedded build system to produce error reporting commands as part
21 of the console output. You can enter the commands after the build
22 completes to log error information into a common database, that can
23 help you figure out what might be going wrong. For information on how
24 to enable and use this feature, see the
25 ":ref:`dev-manual/error-reporting-tool:using the error reporting tool`"
26 section.
27
28The following list shows the debugging topics in the remainder of this
29section:
30
31- ":ref:`dev-manual/debugging:viewing logs from failed tasks`" describes
32 how to find and view logs from tasks that failed during the build
33 process.
34
35- ":ref:`dev-manual/debugging:viewing variable values`" describes how to
36 use the BitBake ``-e`` option to examine variable values after a
37 recipe has been parsed.
38
39- ":ref:`dev-manual/debugging:viewing package information with \`\`oe-pkgdata-util\`\``"
40 describes how to use the ``oe-pkgdata-util`` utility to query
41 :term:`PKGDATA_DIR` and
42 display package-related information for built packages.
43
44- ":ref:`dev-manual/debugging:viewing dependencies between recipes and tasks`"
45 describes how to use the BitBake ``-g`` option to display recipe
46 dependency information used during the build.
47
48- ":ref:`dev-manual/debugging:viewing task variable dependencies`" describes
49 how to use the ``bitbake-dumpsig`` command in conjunction with key
50 subdirectories in the :term:`Build Directory` to determine variable
51 dependencies.
52
53- ":ref:`dev-manual/debugging:running specific tasks`" describes
54 how to use several BitBake options (e.g. ``-c``, ``-C``, and ``-f``)
55 to run specific tasks in the build chain. It can be useful to run
56 tasks "out-of-order" when trying isolate build issues.
57
58- ":ref:`dev-manual/debugging:general BitBake problems`" describes how
59 to use BitBake's ``-D`` debug output option to reveal more about what
60 BitBake is doing during the build.
61
62- ":ref:`dev-manual/debugging:building with no dependencies`"
63 describes how to use the BitBake ``-b`` option to build a recipe
64 while ignoring dependencies.
65
66- ":ref:`dev-manual/debugging:recipe logging mechanisms`"
67 describes how to use the many recipe logging functions to produce
68 debugging output and report errors and warnings.
69
70- ":ref:`dev-manual/debugging:debugging parallel make races`"
71 describes how to debug situations where the build consists of several
72 parts that are run simultaneously and when the output or result of
73 one part is not ready for use with a different part of the build that
74 depends on that output.
75
76- ":ref:`dev-manual/debugging:debugging with the gnu project debugger (gdb) remotely`"
77 describes how to use GDB to allow you to examine running programs, which can
78 help you fix problems.
79
80- ":ref:`dev-manual/debugging:debugging with the gnu project debugger (gdb) on the target`"
81 describes how to use GDB directly on target hardware for debugging.
82
83- ":ref:`dev-manual/debugging:other debugging tips`" describes
84 miscellaneous debugging tips that can be useful.
85
86Viewing Logs from Failed Tasks
87==============================
88
89You can find the log for a task in the file
90``${``\ :term:`WORKDIR`\ ``}/temp/log.do_``\ `taskname`.
91For example, the log for the
92:ref:`ref-tasks-compile` task of the
93QEMU minimal image for the x86 machine (``qemux86``) might be in
94``tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/log.do_compile``.
95To see the commands :term:`BitBake` ran
96to generate a log, look at the corresponding ``run.do_``\ `taskname` file
97in the same directory.
98
99``log.do_``\ `taskname` and ``run.do_``\ `taskname` are actually symbolic
100links to ``log.do_``\ `taskname`\ ``.``\ `pid` and
101``log.run_``\ `taskname`\ ``.``\ `pid`, where `pid` is the PID the task had
102when it ran. The symlinks always point to the files corresponding to the
103most recent run.
104
105Viewing Variable Values
106=======================
107
108Sometimes you need to know the value of a variable as a result of
109BitBake's parsing step. This could be because some unexpected behavior
110occurred in your project. Perhaps an attempt to :ref:`modify a variable
111<bitbake:bitbake-user-manual/bitbake-user-manual-metadata:modifying existing
112variables>` did not work out as expected.
113
114BitBake's ``-e`` option is used to display variable values after
115parsing. The following command displays the variable values after the
116configuration files (i.e. ``local.conf``, ``bblayers.conf``,
117``bitbake.conf`` and so forth) have been parsed::
118
119 $ bitbake -e
120
121The following command displays variable values after a specific recipe has
122been parsed. The variables include those from the configuration as well::
123
124 $ bitbake -e recipename
125
126.. note::
127
128 Each recipe has its own private set of variables (datastore).
129 Internally, after parsing the configuration, a copy of the resulting
130 datastore is made prior to parsing each recipe. This copying implies
131 that variables set in one recipe will not be visible to other
132 recipes.
133
134 Likewise, each task within a recipe gets a private datastore based on
135 the recipe datastore, which means that variables set within one task
136 will not be visible to other tasks.
137
138In the output of ``bitbake -e``, each variable is preceded by a
139description of how the variable got its value, including temporary
140values that were later overridden. This description also includes
141variable flags (varflags) set on the variable. The output can be very
142helpful during debugging.
143
144Variables that are exported to the environment are preceded by
145``export`` in the output of ``bitbake -e``. See the following example::
146
147 export CC="i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/ulf/poky/build/tmp/sysroots/qemux86"
148
149In addition to variable values, the output of the ``bitbake -e`` and
150``bitbake -e`` recipe commands includes the following information:
151
152- The output starts with a tree listing all configuration files and
153 classes included globally, recursively listing the files they include
154 or inherit in turn. Much of the behavior of the OpenEmbedded build
155 system (including the behavior of the :ref:`ref-manual/tasks:normal recipe build tasks`) is
156 implemented in the :ref:`ref-classes-base` class and the
157 classes it inherits, rather than being built into BitBake itself.
158
159- After the variable values, all functions appear in the output. For
160 shell functions, variables referenced within the function body are
161 expanded. If a function has been modified using overrides or using
162 override-style operators like ``:append`` and ``:prepend``, then the
163 final assembled function body appears in the output.
164
165Viewing Package Information with ``oe-pkgdata-util``
166====================================================
167
168You can use the ``oe-pkgdata-util`` command-line utility to query
169:term:`PKGDATA_DIR` and display
170various package-related information. When you use the utility, you must
171use it to view information on packages that have already been built.
172
173Following are a few of the available ``oe-pkgdata-util`` subcommands.
174
175.. note::
176
177 You can use the standard \* and ? globbing wildcards as part of
178 package names and paths.
179
180- ``oe-pkgdata-util list-pkgs [pattern]``: Lists all packages
181 that have been built, optionally limiting the match to packages that
182 match pattern.
183
184- ``oe-pkgdata-util list-pkg-files package ...``: Lists the
185 files and directories contained in the given packages.
186
187 .. note::
188
189 A different way to view the contents of a package is to look at
190 the
191 ``${``\ :term:`WORKDIR`\ ``}/packages-split``
192 directory of the recipe that generates the package. This directory
193 is created by the
194 :ref:`ref-tasks-package` task
195 and has one subdirectory for each package the recipe generates,
196 which contains the files stored in that package.
197
198 If you want to inspect the ``${WORKDIR}/packages-split``
199 directory, make sure that :ref:`ref-classes-rm-work` is not
200 enabled when you build the recipe.
201
202- ``oe-pkgdata-util find-path path ...``: Lists the names of
203 the packages that contain the given paths. For example, the following
204 tells us that ``/usr/share/man/man1/make.1`` is contained in the
205 ``make-doc`` package::
206
207 $ oe-pkgdata-util find-path /usr/share/man/man1/make.1
208 make-doc: /usr/share/man/man1/make.1
209
210- ``oe-pkgdata-util lookup-recipe package ...``: Lists the name
211 of the recipes that produce the given packages.
212
213For more information on the ``oe-pkgdata-util`` command, use the help
214facility::
215
216 $ oe-pkgdata-util --help
217 $ oe-pkgdata-util subcommand --help
218
219Viewing Dependencies Between Recipes and Tasks
220==============================================
221
222Sometimes it can be hard to see why BitBake wants to build other recipes
223before the one you have specified. Dependency information can help you
224understand why a recipe is built.
225
226To generate dependency information for a recipe, run the following
227command::
228
229 $ bitbake -g recipename
230
231This command writes the following files in the current directory:
232
233- ``pn-buildlist``: A list of recipes/targets involved in building
234 `recipename`. "Involved" here means that at least one task from the
235 recipe needs to run when building `recipename` from scratch. Targets
236 that are in
237 :term:`ASSUME_PROVIDED`
238 are not listed.
239
240- ``task-depends.dot``: A graph showing dependencies between tasks.
241
242The graphs are in :wikipedia:`DOT <DOT_%28graph_description_language%29>`
243format and can be converted to images (e.g. using the ``dot`` tool from
244`Graphviz <https://www.graphviz.org/>`__).
245
246.. note::
247
248 - DOT files use a plain text format. The graphs generated using the
249 ``bitbake -g`` command are often so large as to be difficult to
250 read without special pruning (e.g. with BitBake's ``-I`` option)
251 and processing. Despite the form and size of the graphs, the
252 corresponding ``.dot`` files can still be possible to read and
253 provide useful information.
254
255 As an example, the ``task-depends.dot`` file contains lines such
256 as the following::
257
258 "libxslt.do_configure" -> "libxml2.do_populate_sysroot"
259
260 The above example line reveals that the
261 :ref:`ref-tasks-configure`
262 task in ``libxslt`` depends on the
263 :ref:`ref-tasks-populate_sysroot`
264 task in ``libxml2``, which is a normal
265 :term:`DEPENDS` dependency
266 between the two recipes.
267
268 - For an example of how ``.dot`` files can be processed, see the
269 ``scripts/contrib/graph-tool`` Python script, which finds and
270 displays paths between graph nodes.
271
272You can use a different method to view dependency information by using
273the following command::
274
275 $ bitbake -g -u taskexp recipename
276
277This command
278displays a GUI window from which you can view build-time and runtime
279dependencies for the recipes involved in building recipename.
280
281Viewing Task Variable Dependencies
282==================================
283
284As mentioned in the
285":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-execution:checksums (signatures)`" section of the BitBake
286User Manual, BitBake tries to automatically determine what variables a
287task depends on so that it can rerun the task if any values of the
288variables change. This determination is usually reliable. However, if
289you do things like construct variable names at runtime, then you might
290have to manually declare dependencies on those variables using
291``vardeps`` as described in the
292":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata:variable flags`" section of the BitBake
293User Manual.
294
295If you are unsure whether a variable dependency is being picked up
296automatically for a given task, you can list the variable dependencies
297BitBake has determined by doing the following:
298
299#. Build the recipe containing the task::
300
301 $ bitbake recipename
302
303#. Inside the :term:`STAMPS_DIR`
304 directory, find the signature data (``sigdata``) file that
305 corresponds to the task. The ``sigdata`` files contain a pickled
306 Python database of all the metadata that went into creating the input
307 checksum for the task. As an example, for the
308 :ref:`ref-tasks-fetch` task of the
309 ``db`` recipe, the ``sigdata`` file might be found in the following
310 location::
311
312 ${BUILDDIR}/tmp/stamps/i586-poky-linux/db/6.0.30-r1.do_fetch.sigdata.7c048c18222b16ff0bcee2000ef648b1
313
314 For tasks that are accelerated through the shared state
315 (:ref:`sstate <overview-manual/concepts:shared state cache>`) cache, an
316 additional ``siginfo`` file is written into
317 :term:`SSTATE_DIR` along with
318 the cached task output. The ``siginfo`` files contain exactly the
319 same information as ``sigdata`` files.
320
321#. Run ``bitbake-dumpsig`` on the ``sigdata`` or ``siginfo`` file. Here
322 is an example::
323
324 $ bitbake-dumpsig ${BUILDDIR}/tmp/stamps/i586-poky-linux/db/6.0.30-r1.do_fetch.sigdata.7c048c18222b16ff0bcee2000ef648b1
325
326 In the output of the above command, you will find a line like the
327 following, which lists all the (inferred) variable dependencies for
328 the task. This list also includes indirect dependencies from
329 variables depending on other variables, recursively::
330
331 Task dependencies: ['PV', 'SRCREV', 'SRC_URI', 'SRC_URI[md5sum]', 'SRC_URI[sha256sum]', 'base_do_fetch']
332
333 .. note::
334
335 Functions (e.g. ``base_do_fetch``) also count as variable dependencies.
336 These functions in turn depend on the variables they reference.
337
338 The output of ``bitbake-dumpsig`` also includes the value each
339 variable had, a list of dependencies for each variable, and
340 :term:`BB_BASEHASH_IGNORE_VARS`
341 information.
342
343There is also a ``bitbake-diffsigs`` command for comparing two
344``siginfo`` or ``sigdata`` files. This command can be helpful when
345trying to figure out what changed between two versions of a task. If you
346call ``bitbake-diffsigs`` with just one file, the command behaves like
347``bitbake-dumpsig``.
348
349You can also use BitBake to dump out the signature construction
350information without executing tasks by using either of the following
351BitBake command-line options::
352
353 ‐‐dump-signatures=SIGNATURE_HANDLER
354 -S SIGNATURE_HANDLER
355
356
357.. note::
358
359 Two common values for `SIGNATURE_HANDLER` are "none" and "printdiff", which
360 dump only the signature or compare the dumped signature with the cached one,
361 respectively.
362
363Using BitBake with either of these options causes BitBake to dump out
364``sigdata`` files in the ``stamps`` directory for every task it would
365have executed instead of building the specified target package.
366
367Viewing Metadata Used to Create the Input Signature of a Shared State Task
368==========================================================================
369
370Seeing what metadata went into creating the input signature of a shared
371state (sstate) task can be a useful debugging aid. This information is
372available in signature information (``siginfo``) files in
373:term:`SSTATE_DIR`. For
374information on how to view and interpret information in ``siginfo``
375files, see the
376":ref:`dev-manual/debugging:viewing task variable dependencies`" section.
377
378For conceptual information on shared state, see the
379":ref:`overview-manual/concepts:shared state`"
380section in the Yocto Project Overview and Concepts Manual.
381
382Invalidating Shared State to Force a Task to Run
383================================================
384
385The OpenEmbedded build system uses
386:ref:`checksums <overview-manual/concepts:checksums (signatures)>` and
387:ref:`overview-manual/concepts:shared state` cache to avoid unnecessarily
388rebuilding tasks. Collectively, this scheme is known as "shared state
389code".
390
391As with all schemes, this one has some drawbacks. It is possible that
392you could make implicit changes to your code that the checksum
393calculations do not take into account. These implicit changes affect a
394task's output but do not trigger the shared state code into rebuilding a
395recipe. Consider an example during which a tool changes its output.
396Assume that the output of ``rpmdeps`` changes. The result of the change
397should be that all the ``package`` and ``package_write_rpm`` shared
398state cache items become invalid. However, because the change to the
399output is external to the code and therefore implicit, the associated
400shared state cache items do not become invalidated. In this case, the
401build process uses the cached items rather than running the task again.
402Obviously, these types of implicit changes can cause problems.
403
404To avoid these problems during the build, you need to understand the
405effects of any changes you make. Realize that changes you make directly
406to a function are automatically factored into the checksum calculation.
407Thus, these explicit changes invalidate the associated area of shared
408state cache. However, you need to be aware of any implicit changes that
409are not obvious changes to the code and could affect the output of a
410given task.
411
412When you identify an implicit change, you can easily take steps to
413invalidate the cache and force the tasks to run. The steps you can take
414are as simple as changing a function's comments in the source code. For
415example, to invalidate package shared state files, change the comment
416statements of
417:ref:`ref-tasks-package` or the
418comments of one of the functions it calls. Even though the change is
419purely cosmetic, it causes the checksum to be recalculated and forces
420the build system to run the task again.
421
422.. note::
423
424 For an example of a commit that makes a cosmetic change to invalidate
425 shared state, see this
426 :yocto_git:`commit </poky/commit/meta/classes/package.bbclass?id=737f8bbb4f27b4837047cb9b4fbfe01dfde36d54>`.
427
428Running Specific Tasks
429======================
430
431Any given recipe consists of a set of tasks. The standard BitBake
432behavior in most cases is: :ref:`ref-tasks-fetch`, :ref:`ref-tasks-unpack`, :ref:`ref-tasks-patch`,
433:ref:`ref-tasks-configure`, :ref:`ref-tasks-compile`, :ref:`ref-tasks-install`, :ref:`ref-tasks-package`,
434:ref:`do_package_write_* <ref-tasks-package_write_deb>`, and :ref:`ref-tasks-build`. The default task is
435:ref:`ref-tasks-build` and any tasks on which it depends build first. Some tasks,
436such as :ref:`ref-tasks-devshell`, are not part of the default build chain. If you
437wish to run a task that is not part of the default build chain, you can
438use the ``-c`` option in BitBake. Here is an example::
439
440 $ bitbake matchbox-desktop -c devshell
441
442The ``-c`` option respects task dependencies, which means that all other
443tasks (including tasks from other recipes) that the specified task
444depends on will be run before the task. Even when you manually specify a
445task to run with ``-c``, BitBake will only run the task if it considers
446it "out of date". See the
447":ref:`overview-manual/concepts:stamp files and the rerunning of tasks`"
448section in the Yocto Project Overview and Concepts Manual for how
449BitBake determines whether a task is "out of date".
450
451If you want to force an up-to-date task to be rerun (e.g. because you
452made manual modifications to the recipe's
453:term:`WORKDIR` that you want to try
454out), then you can use the ``-f`` option.
455
456.. note::
457
458 The reason ``-f`` is never required when running the
459 :ref:`ref-tasks-devshell` task is because the
460 [\ :ref:`nostamp <bitbake:bitbake-user-manual/bitbake-user-manual-metadata:variable flags>`\ ]
461 variable flag is already set for the task.
462
463The following example shows one way you can use the ``-f`` option::
464
465 $ bitbake matchbox-desktop
466 .
467 .
468 make some changes to the source code in the work directory
469 .
470 .
471 $ bitbake matchbox-desktop -c compile -f
472 $ bitbake matchbox-desktop
473
474This sequence first builds and then recompiles ``matchbox-desktop``. The
475last command reruns all tasks (basically the packaging tasks) after the
476compile. BitBake recognizes that the :ref:`ref-tasks-compile` task was rerun and
477therefore understands that the other tasks also need to be run again.
478
479Another, shorter way to rerun a task and all
480:ref:`ref-manual/tasks:normal recipe build tasks`
481that depend on it is to use the ``-C`` option.
482
483.. note::
484
485 This option is upper-cased and is separate from the ``-c``
486 option, which is lower-cased.
487
488Using this option invalidates the given task and then runs the
489:ref:`ref-tasks-build` task, which is
490the default task if no task is given, and the tasks on which it depends.
491You could replace the final two commands in the previous example with
492the following single command::
493
494 $ bitbake matchbox-desktop -C compile
495
496Internally, the ``-f`` and ``-C`` options work by tainting (modifying)
497the input checksum of the specified task. This tainting indirectly
498causes the task and its dependent tasks to be rerun through the normal
499task dependency mechanisms.
500
501.. note::
502
503 BitBake explicitly keeps track of which tasks have been tainted in
504 this fashion, and will print warnings such as the following for
505 builds involving such tasks:
506
507 .. code-block:: none
508
509 WARNING: /home/ulf/poky/meta/recipes-sato/matchbox-desktop/matchbox-desktop_2.1.bb.do_compile is tainted from a forced run
510
511
512 The purpose of the warning is to let you know that the work directory
513 and build output might not be in the clean state they would be in for
514 a "normal" build, depending on what actions you took. To get rid of
515 such warnings, you can remove the work directory and rebuild the
516 recipe, as follows::
517
518 $ bitbake matchbox-desktop -c clean
519 $ bitbake matchbox-desktop
520
521
522You can view a list of tasks in a given package by running the
523:ref:`ref-tasks-listtasks` task as follows::
524
525 $ bitbake matchbox-desktop -c listtasks
526
527The results appear as output to the console and are also in
528the file ``${WORKDIR}/temp/log.do_listtasks``.
529
530General BitBake Problems
531========================
532
533You can see debug output from BitBake by using the ``-D`` option. The
534debug output gives more information about what BitBake is doing and the
535reason behind it. Each ``-D`` option you use increases the logging
536level. The most common usage is ``-DDD``.
537
538The output from ``bitbake -DDD -v targetname`` can reveal why BitBake
539chose a certain version of a package or why BitBake picked a certain
540provider. This command could also help you in a situation where you
541think BitBake did something unexpected.
542
543Building with No Dependencies
544=============================
545
546To build a specific recipe (``.bb`` file), you can use the following
547command form::
548
549 $ bitbake -b somepath/somerecipe.bb
550
551This command form does
552not check for dependencies. Consequently, you should use it only when
553you know existing dependencies have been met.
554
555.. note::
556
557 You can also specify fragments of the filename. In this case, BitBake
558 checks for a unique match.
559
560Recipe Logging Mechanisms
561=========================
562
563The Yocto Project provides several logging functions for producing
564debugging output and reporting errors and warnings. For Python
565functions, the following logging functions are available. All of these functions
566log to ``${T}/log.do_``\ `task`, and can also log to standard output
567(stdout) with the right settings:
568
569- ``bb.plain(msg)``: Writes msg as is to the log while also
570 logging to stdout.
571
572- ``bb.note(msg)``: Writes "NOTE: msg" to the log. Also logs to
573 stdout if BitBake is called with "-v".
574
575- ``bb.debug(level, msg)``: Writes "DEBUG: msg" to the
576 log. Also logs to stdout if the log level is greater than or equal to
577 level. See the ":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-intro:usage and syntax`" option
578 in the BitBake User Manual for more information.
579
580- ``bb.warn(msg)``: Writes "WARNING: msg" to the log while also
581 logging to stdout.
582
583- ``bb.error(msg)``: Writes "ERROR: msg" to the log while also
584 logging to standard out (stdout).
585
586 .. note::
587
588 Calling this function does not cause the task to fail.
589
590- ``bb.fatal(msg)``: This logging function is similar to
591 ``bb.error(msg)`` but also causes the calling task to fail.
592
593 .. note::
594
595 ``bb.fatal()`` raises an exception, which means you do not need to put a
596 "return" statement after the function.
597
598The same logging functions are also available in shell functions, under
599the names ``bbplain``, ``bbnote``, ``bbdebug``, ``bbwarn``, ``bberror``,
600and ``bbfatal``. The :ref:`ref-classes-logging` class
601implements these functions. See that class in the ``meta/classes``
602folder of the :term:`Source Directory` for information.
603
604Logging With Python
605-------------------
606
607When creating recipes using Python and inserting code that handles build
608logs, keep in mind the goal is to have informative logs while keeping
609the console as "silent" as possible. Also, if you want status messages
610in the log, use the "debug" loglevel.
611
612Following is an example written in Python. The code handles logging for
613a function that determines the number of tasks needed to be run. See the
614":ref:`ref-tasks-listtasks`"
615section for additional information::
616
617 python do_listtasks() {
618 bb.debug(2, "Starting to figure out the task list")
619 if noteworthy_condition:
620 bb.note("There are 47 tasks to run")
621 bb.debug(2, "Got to point xyz")
622 if warning_trigger:
623 bb.warn("Detected warning_trigger, this might be a problem later.")
624 if recoverable_error:
625 bb.error("Hit recoverable_error, you really need to fix this!")
626 if fatal_error:
627 bb.fatal("fatal_error detected, unable to print the task list")
628 bb.plain("The tasks present are abc")
629 bb.debug(2, "Finished figuring out the tasklist")
630 }
631
632Logging With Bash
633-----------------
634
635When creating recipes using Bash and inserting code that handles build
636logs, you have the same goals --- informative with minimal console output.
637The syntax you use for recipes written in Bash is similar to that of
638recipes written in Python described in the previous section.
639
640Following is an example written in Bash. The code logs the progress of
641the ``do_my_function`` function::
642
643 do_my_function() {
644 bbdebug 2 "Running do_my_function"
645 if [ exceptional_condition ]; then
646 bbnote "Hit exceptional_condition"
647 fi
648 bbdebug 2 "Got to point xyz"
649 if [ warning_trigger ]; then
650 bbwarn "Detected warning_trigger, this might cause a problem later."
651 fi
652 if [ recoverable_error ]; then
653 bberror "Hit recoverable_error, correcting"
654 fi
655 if [ fatal_error ]; then
656 bbfatal "fatal_error detected"
657 fi
658 bbdebug 2 "Completed do_my_function"
659 }
660
661
662Debugging Parallel Make Races
663=============================
664
665A parallel ``make`` race occurs when the build consists of several parts
666that are run simultaneously and a situation occurs when the output or
667result of one part is not ready for use with a different part of the
668build that depends on that output. Parallel make races are annoying and
669can sometimes be difficult to reproduce and fix. However, there are some simple
670tips and tricks that can help you debug and fix them. This section
671presents a real-world example of an error encountered on the Yocto
672Project autobuilder and the process used to fix it.
673
674.. note::
675
676 If you cannot properly fix a ``make`` race condition, you can work around it
677 by clearing either the :term:`PARALLEL_MAKE` or :term:`PARALLEL_MAKEINST`
678 variables.
679
680The Failure
681-----------
682
683For this example, assume that you are building an image that depends on
684the "neard" package. And, during the build, BitBake runs into problems
685and creates the following output.
686
687.. note::
688
689 This example log file has longer lines artificially broken to make
690 the listing easier to read.
691
692If you examine the output or the log file, you see the failure during
693``make``:
694
695.. code-block:: none
696
697 | DEBUG: SITE files ['endian-little', 'bit-32', 'ix86-common', 'common-linux', 'common-glibc', 'i586-linux', 'common']
698 | DEBUG: Executing shell function do_compile
699 | NOTE: make -j 16
700 | make --no-print-directory all-am
701 | /bin/mkdir -p include/near
702 | /bin/mkdir -p include/near
703 | /bin/mkdir -p include/near
704 | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/
705 0.14-r0/neard-0.14/include/types.h include/near/types.h
706 | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/
707 0.14-r0/neard-0.14/include/log.h include/near/log.h
708 | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/
709 0.14-r0/neard-0.14/include/plugin.h include/near/plugin.h
710 | /bin/mkdir -p include/near
711 | /bin/mkdir -p include/near
712 | /bin/mkdir -p include/near
713 | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/
714 0.14-r0/neard-0.14/include/tag.h include/near/tag.h
715 | /bin/mkdir -p include/near
716 | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/
717 0.14-r0/neard-0.14/include/adapter.h include/near/adapter.h
718 | /bin/mkdir -p include/near
719 | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/
720 0.14-r0/neard-0.14/include/ndef.h include/near/ndef.h
721 | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/
722 0.14-r0/neard-0.14/include/tlv.h include/near/tlv.h
723 | /bin/mkdir -p include/near
724 | /bin/mkdir -p include/near
725 | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/
726 0.14-r0/neard-0.14/include/setting.h include/near/setting.h
727 | /bin/mkdir -p include/near
728 | /bin/mkdir -p include/near
729 | /bin/mkdir -p include/near
730 | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/
731 0.14-r0/neard-0.14/include/device.h include/near/device.h
732 | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/
733 0.14-r0/neard-0.14/include/nfc_copy.h include/near/nfc_copy.h
734 | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/
735 0.14-r0/neard-0.14/include/snep.h include/near/snep.h
736 | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/
737 0.14-r0/neard-0.14/include/version.h include/near/version.h
738 | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/
739 0.14-r0/neard-0.14/include/dbus.h include/near/dbus.h
740 | ./src/genbuiltin nfctype1 nfctype2 nfctype3 nfctype4 p2p > src/builtin.h
741 | i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/pokybuild/yocto-autobuilder/nightly-x86/
742 build/build/tmp/sysroots/qemux86 -DHAVE_CONFIG_H -I. -I./include -I./src -I./gdbus -I/home/pokybuild/
743 yocto-autobuilder/nightly-x86/build/build/tmp/sysroots/qemux86/usr/include/glib-2.0
744 -I/home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/sysroots/qemux86/usr/
745 lib/glib-2.0/include -I/home/pokybuild/yocto-autobuilder/nightly-x86/build/build/
746 tmp/sysroots/qemux86/usr/include/dbus-1.0 -I/home/pokybuild/yocto-autobuilder/
747 nightly-x86/build/build/tmp/sysroots/qemux86/usr/lib/dbus-1.0/include -I/home/pokybuild/yocto-autobuilder/
748 nightly-x86/build/build/tmp/sysroots/qemux86/usr/include/libnl3
749 -DNEAR_PLUGIN_BUILTIN -DPLUGINDIR=\""/usr/lib/near/plugins"\"
750 -DCONFIGDIR=\""/etc/neard\"" -O2 -pipe -g -feliminate-unused-debug-types -c
751 -o tools/snep-send.o tools/snep-send.c
752 | In file included from tools/snep-send.c:16:0:
753 | tools/../src/near.h:41:23: fatal error: near/dbus.h: No such file or directory
754 | #include <near/dbus.h>
755 | ^
756 | compilation terminated.
757 | make[1]: *** [tools/snep-send.o] Error 1
758 | make[1]: *** Waiting for unfinished jobs....
759 | make: *** [all] Error 2
760 | ERROR: oe_runmake failed
761
762Reproducing the Error
763---------------------
764
765Because race conditions are intermittent, they do not manifest
766themselves every time you do the build. In fact, most times the build
767will complete without problems even though the potential race condition
768exists. Thus, once the error surfaces, you need a way to reproduce it.
769
770In this example, compiling the "neard" package is causing the problem.
771So the first thing to do is build "neard" locally. Before you start the
772build, set the
773:term:`PARALLEL_MAKE` variable
774in your ``local.conf`` file to a high number (e.g. "-j 20"). Using a
775high value for :term:`PARALLEL_MAKE` increases the chances of the race
776condition showing up::
777
778 $ bitbake neard
779
780Once the local build for "neard" completes, start a ``devshell`` build::
781
782 $ bitbake neard -c devshell
783
784For information on how to use a ``devshell``, see the
785":ref:`dev-manual/development-shell:using a development shell`" section.
786
787In the ``devshell``, do the following::
788
789 $ make clean
790 $ make tools/snep-send.o
791
792The ``devshell`` commands cause the failure to clearly
793be visible. In this case, there is a missing dependency for the ``neard``
794Makefile target. Here is some abbreviated, sample output with the
795missing dependency clearly visible at the end::
796
797 i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/scott-lenovo/......
798 .
799 .
800 .
801 tools/snep-send.c
802 In file included from tools/snep-send.c:16:0:
803 tools/../src/near.h:41:23: fatal error: near/dbus.h: No such file or directory
804 #include <near/dbus.h>
805 ^
806 compilation terminated.
807 make: *** [tools/snep-send.o] Error 1
808 $
809
810
811Creating a Patch for the Fix
812----------------------------
813
814Because there is a missing dependency for the Makefile target, you need
815to patch the ``Makefile.am`` file, which is generated from
816``Makefile.in``. You can use Quilt to create the patch::
817
818 $ quilt new parallelmake.patch
819 Patch patches/parallelmake.patch is now on top
820 $ quilt add Makefile.am
821 File Makefile.am added to patch patches/parallelmake.patch
822
823For more information on using Quilt, see the
824":ref:`dev-manual/quilt:using quilt in your workflow`" section.
825
826At this point you need to make the edits to ``Makefile.am`` to add the
827missing dependency. For our example, you have to add the following line
828to the file::
829
830 tools/snep-send.$(OBJEXT): include/near/dbus.h
831
832Once you have edited the file, use the ``refresh`` command to create the
833patch::
834
835 $ quilt refresh
836 Refreshed patch patches/parallelmake.patch
837
838Once the patch file is created, you need to add it back to the originating
839recipe folder. Here is an example assuming a top-level
840:term:`Source Directory` named ``poky``::
841
842 $ cp patches/parallelmake.patch poky/meta/recipes-connectivity/neard/neard
843
844The final thing you need to do to implement the fix in the build is to
845update the "neard" recipe (i.e. ``neard-0.14.bb``) so that the
846:term:`SRC_URI` statement includes
847the patch file. The recipe file is in the folder above the patch. Here
848is what the edited :term:`SRC_URI` statement would look like::
849
850 SRC_URI = "${KERNELORG_MIRROR}/linux/network/nfc/${BPN}-${PV}.tar.xz \
851 file://neard.in \
852 file://neard.service.in \
853 file://parallelmake.patch \
854 "
855
856With the patch complete and moved to the correct folder and the
857:term:`SRC_URI` statement updated, you can exit the ``devshell``::
858
859 $ exit
860
861Testing the Build
862-----------------
863
864With everything in place, you can get back to trying the build again
865locally::
866
867 $ bitbake neard
868
869This build should succeed.
870
871Now you can open up a ``devshell`` again and repeat the clean and make
872operations as follows::
873
874 $ bitbake neard -c devshell
875 $ make clean
876 $ make tools/snep-send.o
877
878The build should work without issue.
879
880As with all solved problems, if they originated upstream, you need to
881submit the fix for the recipe in OE-Core and upstream so that the
882problem is taken care of at its source. See the
883":ref:`dev-manual/changes:submitting a change to the yocto project`"
884section for more information.
885
886Debugging With the GNU Project Debugger (GDB) Remotely
887======================================================
888
889GDB allows you to examine running programs, which in turn helps you to
890understand and fix problems. It also allows you to perform post-mortem
891style analysis of program crashes. GDB is available as a package within
892the Yocto Project and is installed in SDK images by default. See the
893":ref:`ref-manual/images:Images`" chapter in the Yocto
894Project Reference Manual for a description of these images. You can find
895information on GDB at https://sourceware.org/gdb/.
896
897.. note::
898
899 For best results, install debug (``-dbg``) packages for the applications you
900 are going to debug. Doing so makes extra debug symbols available that give
901 you more meaningful output.
902
903Sometimes, due to memory or disk space constraints, it is not possible
904to use GDB directly on the remote target to debug applications. These
905constraints arise because GDB needs to load the debugging information
906and the binaries of the process being debugged. Additionally, GDB needs
907to perform many computations to locate information such as function
908names, variable names and values, stack traces and so forth --- even
909before starting the debugging process. These extra computations place
910more load on the target system and can alter the characteristics of the
911program being debugged.
912
913To help get past the previously mentioned constraints, there are two
914methods you can use: running a debuginfod server and using gdbserver.
915
916Using the debuginfod server method
917----------------------------------
918
919``debuginfod`` from ``elfutils`` is a way to distribute ``debuginfo`` files.
920Running a ``debuginfod`` server makes debug symbols readily available,
921which means you don't need to download debugging information
922and the binaries of the process being debugged. You can just fetch
923debug symbols from the server.
924
925To run a ``debuginfod`` server, you need to do the following:
926
927- Ensure that ``debuginfod`` is present in :term:`DISTRO_FEATURES`
928 (it already is in ``OpenEmbedded-core`` defaults and ``poky`` reference distribution).
929 If not, set in your distro config file or in ``local.conf``::
930
931 DISTRO_FEATURES:append = " debuginfod"
932
933 This distro feature enables the server and client library in ``elfutils``,
934 and enables ``debuginfod`` support in clients (at the moment, ``gdb`` and ``binutils``).
935
936- Run the following commands to launch the ``debuginfod`` server on the host::
937
938 $ oe-debuginfod
939
940- To use ``debuginfod`` on the target, you need to know the ip:port where
941 ``debuginfod`` is listening on the host (port defaults to 8002), and export
942 that into the shell environment, for example in ``qemu``::
943
944 root@qemux86-64:~# export DEBUGINFOD_URLS="http://192.168.7.1:8002/"
945
946- Then debug info fetching should simply work when running the target ``gdb``,
947 ``readelf`` or ``objdump``, for example::
948
949 root@qemux86-64:~# gdb /bin/cat
950 ...
951 Reading symbols from /bin/cat...
952 Downloading separate debug info for /bin/cat...
953 Reading symbols from /home/root/.cache/debuginfod_client/923dc4780cfbc545850c616bffa884b6b5eaf322/debuginfo...
954
955- It's also possible to use ``debuginfod-find`` to just query the server::
956
957 root@qemux86-64:~# debuginfod-find debuginfo /bin/ls
958 /home/root/.cache/debuginfod_client/356edc585f7f82d46f94fcb87a86a3fe2d2e60bd/debuginfo
959
960
961Using the gdbserver method
962--------------------------
963
964gdbserver, which runs on the remote target and does not load any
965debugging information from the debugged process. Instead, a GDB instance
966processes the debugging information that is run on a remote computer -
967the host GDB. The host GDB then sends control commands to gdbserver to
968make it stop or start the debugged program, as well as read or write
969memory regions of that debugged program. All the debugging information
970loaded and processed as well as all the heavy debugging is done by the
971host GDB. Offloading these processes gives the gdbserver running on the
972target a chance to remain small and fast.
973
974Because the host GDB is responsible for loading the debugging
975information and for doing the necessary processing to make actual
976debugging happen, you have to make sure the host can access the
977unstripped binaries complete with their debugging information and also
978be sure the target is compiled with no optimizations. The host GDB must
979also have local access to all the libraries used by the debugged
980program. Because gdbserver does not need any local debugging
981information, the binaries on the remote target can remain stripped.
982However, the binaries must also be compiled without optimization so they
983match the host's binaries.
984
985To remain consistent with GDB documentation and terminology, the binary
986being debugged on the remote target machine is referred to as the
987"inferior" binary. For documentation on GDB see the `GDB
988site <https://sourceware.org/gdb/documentation/>`__.
989
990The following steps show you how to debug using the GNU project
991debugger.
992
993#. *Configure your build system to construct the companion debug
994 filesystem:*
995
996 In your ``local.conf`` file, set the following::
997
998 IMAGE_GEN_DEBUGFS = "1"
999 IMAGE_FSTYPES_DEBUGFS = "tar.bz2"
1000
1001 These options cause the
1002 OpenEmbedded build system to generate a special companion filesystem
1003 fragment, which contains the matching source and debug symbols to
1004 your deployable filesystem. The build system does this by looking at
1005 what is in the deployed filesystem, and pulling the corresponding
1006 ``-dbg`` packages.
1007
1008 The companion debug filesystem is not a complete filesystem, but only
1009 contains the debug fragments. This filesystem must be combined with
1010 the full filesystem for debugging. Subsequent steps in this procedure
1011 show how to combine the partial filesystem with the full filesystem.
1012
1013#. *Configure the system to include gdbserver in the target filesystem:*
1014
1015 Make the following addition in your ``local.conf`` file::
1016
1017 EXTRA_IMAGE_FEATURES:append = " tools-debug"
1018
1019 The change makes
1020 sure the ``gdbserver`` package is included.
1021
1022#. *Build the environment:*
1023
1024 Use the following command to construct the image and the companion
1025 Debug Filesystem::
1026
1027 $ bitbake image
1028
1029 Build the cross GDB component and
1030 make it available for debugging. Build the SDK that matches the
1031 image. Building the SDK is best for a production build that can be
1032 used later for debugging, especially during long term maintenance::
1033
1034 $ bitbake -c populate_sdk image
1035
1036 Alternatively, you can build the minimal toolchain components that
1037 match the target. Doing so creates a smaller than typical SDK and
1038 only contains a minimal set of components with which to build simple
1039 test applications, as well as run the debugger::
1040
1041 $ bitbake meta-toolchain
1042
1043 A final method is to build Gdb itself within the build system::
1044
1045 $ bitbake gdb-cross-<architecture>
1046
1047 Doing so produces a temporary copy of
1048 ``cross-gdb`` you can use for debugging during development. While
1049 this is the quickest approach, the two previous methods in this step
1050 are better when considering long-term maintenance strategies.
1051
1052 .. note::
1053
1054 If you run ``bitbake gdb-cross``, the OpenEmbedded build system suggests
1055 the actual image (e.g. ``gdb-cross-i586``). The suggestion is usually the
1056 actual name you want to use.
1057
1058#. *Set up the* ``debugfs``\ *:*
1059
1060 Run the following commands to set up the ``debugfs``::
1061
1062 $ mkdir debugfs
1063 $ cd debugfs
1064 $ tar xvfj build-dir/tmp/deploy/images/machine/image.rootfs.tar.bz2
1065 $ tar xvfj build-dir/tmp/deploy/images/machine/image-dbg.rootfs.tar.bz2
1066
1067#. *Set up GDB:*
1068
1069 Install the SDK (if you built one) and then source the correct
1070 environment file. Sourcing the environment file puts the SDK in your
1071 ``PATH`` environment variable and sets ``$GDB`` to the SDK's debugger.
1072
1073 If you are using the build system, Gdb is located in
1074 `build-dir`\ ``/tmp/sysroots/``\ `host`\ ``/usr/bin/``\ `architecture`\ ``/``\ `architecture`\ ``-gdb``
1075
1076#. *Boot the target:*
1077
1078 For information on how to run QEMU, see the `QEMU
1079 Documentation <https://wiki.qemu.org/Documentation/GettingStartedDevelopers>`__.
1080
1081 .. note::
1082
1083 Be sure to verify that your host can access the target via TCP.
1084
1085#. *Debug a program:*
1086
1087 Debugging a program involves running gdbserver on the target and then
1088 running Gdb on the host. The example in this step debugs ``gzip``:
1089
1090 .. code-block:: shell
1091
1092 root@qemux86:~# gdbserver localhost:1234 /bin/gzip —help
1093
1094 For
1095 additional gdbserver options, see the `GDB Server
1096 Documentation <https://www.gnu.org/software/gdb/documentation/>`__.
1097
1098 After running gdbserver on the target, you need to run Gdb on the
1099 host and configure it and connect to the target. Use these commands::
1100
1101 $ cd directory-holding-the-debugfs-directory
1102 $ arch-gdb
1103 (gdb) set sysroot debugfs
1104 (gdb) set substitute-path /usr/src/debug debugfs/usr/src/debug
1105 (gdb) target remote IP-of-target:1234
1106
1107 At this
1108 point, everything should automatically load (i.e. matching binaries,
1109 symbols and headers).
1110
1111 .. note::
1112
1113 The Gdb ``set`` commands in the previous example can be placed into the
1114 users ``~/.gdbinit`` file. Upon starting, Gdb automatically runs whatever
1115 commands are in that file.
1116
1117#. *Deploying without a full image rebuild:*
1118
1119 In many cases, during development you want a quick method to deploy a
1120 new binary to the target and debug it, without waiting for a full
1121 image build.
1122
1123 One approach to solving this situation is to just build the component
1124 you want to debug. Once you have built the component, copy the
1125 executable directly to both the target and the host ``debugfs``.
1126
1127 If the binary is processed through the debug splitting in
1128 OpenEmbedded, you should also copy the debug items (i.e. ``.debug``
1129 contents and corresponding ``/usr/src/debug`` files) from the work
1130 directory. Here is an example::
1131
1132 $ bitbake bash
1133 $ bitbake -c devshell bash
1134 $ cd ..
1135 $ scp packages-split/bash/bin/bash target:/bin/bash
1136 $ cp -a packages-split/bash-dbg/\* path/debugfs
1137
1138Debugging with the GNU Project Debugger (GDB) on the Target
1139===========================================================
1140
1141The previous section addressed using GDB remotely for debugging
1142purposes, which is the most usual case due to the inherent hardware
1143limitations on many embedded devices. However, debugging in the target
1144hardware itself is also possible with more powerful devices. This
1145section describes what you need to do in order to support using GDB to
1146debug on the target hardware.
1147
1148To support this kind of debugging, you need do the following:
1149
1150- Ensure that GDB is on the target. You can do this by making
1151 the following addition to your ``local.conf`` file::
1152
1153 EXTRA_IMAGE_FEATURES:append = " tools-debug"
1154
1155- Ensure that debug symbols are present. You can do so by adding the
1156 corresponding ``-dbg`` package to :term:`IMAGE_INSTALL`::
1157
1158 IMAGE_INSTALL:append = " packagename-dbg"
1159
1160 Alternatively, you can add the following to ``local.conf`` to include
1161 all the debug symbols::
1162
1163 EXTRA_IMAGE_FEATURES:append = " dbg-pkgs"
1164
1165.. note::
1166
1167 To improve the debug information accuracy, you can reduce the level
1168 of optimization used by the compiler. For example, when adding the
1169 following line to your ``local.conf`` file, you will reduce optimization
1170 from :term:`FULL_OPTIMIZATION` of "-O2" to :term:`DEBUG_OPTIMIZATION`
1171 of "-O -fno-omit-frame-pointer"::
1172
1173 DEBUG_BUILD = "1"
1174
1175 Consider that this will reduce the application's performance and is
1176 recommended only for debugging purposes.
1177
1178Other Debugging Tips
1179====================
1180
1181Here are some other tips that you might find useful:
1182
1183- When adding new packages, it is worth watching for undesirable items
1184 making their way into compiler command lines. For example, you do not
1185 want references to local system files like ``/usr/lib/`` or
1186 ``/usr/include/``.
1187
1188- If you want to remove the ``psplash`` boot splashscreen, add
1189 ``psplash=false`` to the kernel command line. Doing so prevents
1190 ``psplash`` from loading and thus allows you to see the console. It
1191 is also possible to switch out of the splashscreen by switching the
1192 virtual console (e.g. Fn+Left or Fn+Right on a Zaurus).
1193
1194- Removing :term:`TMPDIR` (usually ``tmp/``, within the
1195 :term:`Build Directory`) can often fix temporary build issues. Removing
1196 :term:`TMPDIR` is usually a relatively cheap operation, because task output
1197 will be cached in :term:`SSTATE_DIR` (usually ``sstate-cache/``, which is
1198 also in the :term:`Build Directory`).
1199
1200 .. note::
1201
1202 Removing :term:`TMPDIR` might be a workaround rather than a fix.
1203 Consequently, trying to determine the underlying cause of an issue before
1204 removing the directory is a good idea.
1205
1206- Understanding how a feature is used in practice within existing
1207 recipes can be very helpful. It is recommended that you configure
1208 some method that allows you to quickly search through files.
1209
1210 Using GNU Grep, you can use the following shell function to
1211 recursively search through common recipe-related files, skipping
1212 binary files, ``.git`` directories, and the :term:`Build Directory`
1213 (assuming its name starts with "build")::
1214
1215 g() {
1216 grep -Ir \
1217 --exclude-dir=.git \
1218 --exclude-dir='build*' \
1219 --include='*.bb*' \
1220 --include='*.inc*' \
1221 --include='*.conf*' \
1222 --include='*.py*' \
1223 "$@"
1224 }
1225
1226 Following are some usage examples::
1227
1228 $ g FOO # Search recursively for "FOO"
1229 $ g -i foo # Search recursively for "foo", ignoring case
1230 $ g -w FOO # Search recursively for "FOO" as a word, ignoring e.g. "FOOBAR"
1231
1232 If figuring
1233 out how some feature works requires a lot of searching, it might
1234 indicate that the documentation should be extended or improved. In
1235 such cases, consider filing a documentation bug using the Yocto
1236 Project implementation of
1237 :yocto_bugs:`Bugzilla <>`. For information on
1238 how to submit a bug against the Yocto Project, see the Yocto Project
1239 Bugzilla :yocto_wiki:`wiki page </Bugzilla_Configuration_and_Bug_Tracking>`
1240 and the
1241 ":ref:`dev-manual/changes:submitting a defect against the yocto project`"
1242 section.
1243
1244 .. note::
1245
1246 The manuals might not be the right place to document variables
1247 that are purely internal and have a limited scope (e.g. internal
1248 variables used to implement a single ``.bbclass`` file).
1249