Difference between revisions of "He/Stack Trace"

From GnuCash
Jump to: navigation, search
m (מה זה עקבות־ערימה (Stack Trace)?: format)
m (עדיף עם סמלי איתור תקלים: style)
 
(15 intermediate revisions by the same user not shown)
Line 9: Line 9:
 
|}
 
|}
  
==מה זה עקבות־ערימה (Stack Trace)? ==
+
==מה זה עקבות־מחסנית (Stack Trace)? ==
פעולת עקוב־ערימה מייצרת פלט שמספק מידע על תתי־תכנית ושרשרת קריאות לפונקציות של התכנית העקרית עד לנקודה מסויימת בתכנית. רוב השימוש בעקוב־ערימה נועד לניפוי תקלים מסוג מסויים. עקוב־ערימה אמור לסייע לצוות הפתוח והתמיכה בהבנת הבעיה אחריה הופעל המעקב, או כיצד פועלות תתי־מערכות שונות יחד במהלך ביצוע תוכנית מסויימת.
+
פעולת עקוב־מחסנית מייצרת פלט שמספק מידע על תתי־תכנית ושרשרת קריאות לפונקציות של התכנית העקרית עד לנקודה מסויימת בתכנית. רוב השימוש בעקוב־מחסנית נועד לניפוי תקלים מסוג מסויים. עקוב־מחסנית אמור לסייע לצוות הפתוח והתמיכה בהבנת הבעיה אחריה הופעל המעקב, או כיצד פועלות תתי־מערכות שונות יחד במהלך ביצוע תוכנית מסויימת.
להלן דוגמת פלט עקבות־ערמה שהופעל במערכת הפעלה מק OX; מערכות הפעלה שונות מן הסתם יציגו מידע באופן שונה במקצת:
+
להלן דוגמת פלט עקבות־ערמה שהופעל במערכת הפעלה מק OX; מערכות הפעלה שונות מן הסתם יציגו מידע באופן שונה במקצת:
 
<div dir="ltr" lang="en">
 
<div dir="ltr" lang="en">
 
   Exception Type:        EXC_CRASH (SIGABRT)
 
   Exception Type:        EXC_CRASH (SIGABRT)
Line 36: Line 36:
 
</div>
 
</div>
  
This shows why GnuCash crashed (an assertion failed in the main window init function); without a stack trace crashes can be very difficult to diagnose. Developers will usually also ask for the [[Tracefile]], which will often provide additional useful information. In the case above we'd find the actual assertion message that would explain the abort.
+
פלט זה מראה מדוע גנוקאש קרסה (משתנה בלתי תלוי בפונקציית  init של החלון הראשי, כשל); ללא פעולת עקבות־מחסנית, משימת אבחן קריסה יכולה להיות משימה קשה ומורכבת ביותר. לפני שיגשו לטפל בסוגיות, מפתחים יבקשו בדרך כלל גם את [[Tracefile|קובץ העקיבה]], שלרוב יספק מידע שימושי נוסף. במקרה מעלה, נמצא את הודעת המשתנה הבלתי־תלוי בפועל, שיסביר את נטישת התכנית (הקריסה).
  
=== Better with Debugging Symbols ===
+
=== עדיף עם סמלי איתור תקלים ===
A stack trace can be obtained in several different levels of verbosity. By default, most distributions will enable only a very coarse stack trace where not much information is shown about each function. The stack trace gets much more useful if '''debugging symbols''' are available. Please try to enable them, if possible. If you are running GnuCash
+
ניתן להפיק עקבות־מחסנית ברמת מילוליות משתנה. כברירת מחדל, רוב ההפצות יאפשרו רק עקבות־מחסנית 'גסה' מאוד, בה לא יוצג מידע רב על כל פונקציה בנפרד. מעקב־המחסנית תהיה שימושית הרבה יותר יחד עם '''סמלי ניפוי תקלים''' זמינים. נא לאפשר אותם, ככל הניתן.  
* from a ''ready made package on Linux'', search with your package manager for the corresponding '''-dbg''' or '''-debug''' package and install it.  
+
במידה ומריצים את גנוקאש:
** If other packages like AqBanking are used, try to find and install their corresponding -dbg packages, too. If your problem is solved, you can uninstall them again.
+
* נא לחפש באמצעות מנהל ההתקנה את חבילת התכנה המכונה בלינוקס'',<div dir="ltr">'''-dbg'''</div> או <div dir="ltr">'''-debug '''</div> והתקינו אותה.
* When built locally from the sources, add '''-DCMAKE_BUILD_TYPE=Debug''' to your ''cmake'' options and redo the make process.
+
** במידה ונעשב שימוש גם בחבילות נוספות כדוגמת AqBanking, נסו למצוא ולהתקין את חבילת ה־<div dir="ltr">-dbg</div> שלהן גם כן. לאחר שהסוגיה טופלה, ניתן להסיר את החבילות הללו.
 +
* בבניה מקומית מקוד המקור, יש להוסיף את השורה <div dir="ltr">'''-DCMAKE_BUILD_TYPE=Debug'''</div> לאפשרויות ''cmake'' ולחזור שנית על תהליך ה־make.
  
 
== Optional Preparation of Scheme Code ==
 
== Optional Preparation of Scheme Code ==
Line 48: Line 49:
 
If reports are affected, see [https://www.gnu.org/software/guile/manual/html_node/Programmatic-Error-Handling.html The Guile Reference Manual: Programmatic Error Handling]
 
If reports are affected, see [https://www.gnu.org/software/guile/manual/html_node/Programmatic-Error-Handling.html The Guile Reference Manual: Programmatic Error Handling]
  
== How to obtain a Stack Trace ==
+
== כיצד מפיקים עקבות־מחסנית? ==
  
 
=== {{Mac}} ===
 
=== {{Mac}} ===
 
Every time an application crashes in Mac OS X, the system writes a crash report with a stack trace to <tt>$HOME/Library/Logs/DiagnosticReports</tt> or <tt>$HOME/Library/Logs/CrashReporter</tt>, or both, depending on what version of OS X you're running. The crash reports are easily viewed with <tt>Applications:Utilities:Console</tt>, and if you're reporting a crash in Bugzilla or to the user's list you should attach one to your report.
 
Every time an application crashes in Mac OS X, the system writes a crash report with a stack trace to <tt>$HOME/Library/Logs/DiagnosticReports</tt> or <tt>$HOME/Library/Logs/CrashReporter</tt>, or both, depending on what version of OS X you're running. The crash reports are easily viewed with <tt>Applications:Utilities:Console</tt>, and if you're reporting a crash in Bugzilla or to the user's list you should attach one to your report.
  
=== About Debuggers ===
+
=== על אודות מנפי־תקלים ===
 
In order to get a stack trace on Linux or Windows one must have either the '''GNU Debugger''', [https://www.gnu.org/software/gdb/ gdb], or the '''LLVM Debugger''', [https://lldb.llvm.org/ lldb], installed.
 
In order to get a stack trace on Linux or Windows one must have either the '''GNU Debugger''', [https://www.gnu.org/software/gdb/ gdb], or the '''LLVM Debugger''', [https://lldb.llvm.org/ lldb], installed.
 
*Linux users should their package manager to install one or the other if necessary.  
 
*Linux users should their package manager to install one or the other if necessary.  
Line 62: Line 63:
 
Gdb is a bit simpler to use, so the instructions below are for gdb.
 
Gdb is a bit simpler to use, so the instructions below are for gdb.
  
=== Linux ===
+
=== לינוקס ===
Additionally, if you're using packages supplied through a linux distribution (you did not compile GnuCash yourself) you probably also need to install a [[#Debug_symbol_information |debug symbol package (see below)]].  
+
בנוסף, אם נעשה שימוש בחבילות המסופקות דרך הפצת לינוקס (ולא על ידי הידור עצמי) להתקנת גנוקאש, ככל הנראה שיידרש להתקין גם [[#Debug_symbol_information|חבילת סמלי ניפוי־תקלים (ראו מטה)]].  
  
Once you have installed a debugger (and symbols as needed), there are two ways to put GnuCash under the debugger's control. Starting GnuCash under the debugger is a bit more straightforward, but the debugger slows down the program quite a bit. So it might work better for you to start GnuCash as usual, get to the point where some action provokes the crash, then attach the debugger to the running GnuCash.
+
לאחר התקנת מנפה־תקלים (וסמלים על פי הצורך), ישנן שתי דרכים להפעיל את גנוקאש תחת שליטת מנפה־תקלים. אתחול תחת מנפה־תקלים היא מעט יותר פשוטה, אך מנפה־התקלים מאט את התכנית במידה ניכרת. לכן, אולי עדיף להפעיל את גנוקאש כרגיל, להגיע לנקודה שבה פעולה כלשהי מזניקה את ההתרסקות, ורק אז לחבר את גנוקאש (הפועל) למנפה־תקלים.
  
==== Starting GnuCash under gdb ====
+
==== אתחול גנוקאש עם -gdb ====
  
 
# run <tt>gdb gnucash</tt>
 
# run <tt>gdb gnucash</tt>
Line 95: Line 96:
 
</div>
 
</div>
  
==== Attach gdb to running process ====
+
==== צרוף -gdb לתהליכים קיימים ====
  
 
# Start gnucash normally.
 
# Start gnucash normally.
Line 108: Line 109:
 
# Gdb will print the backtrace.
 
# Gdb will print the backtrace.
  
==== Exit Gdb ====
+
==== יציאה מ־Gdb ====
 
<tt>ctrl-d</tt> or <tt>quit</tt> will end the gdb session.
 
<tt>ctrl-d</tt> or <tt>quit</tt> will end the gdb session.
  
 
Please copy and paste the error and stack trace from the terminal into a bug report; see [[Bugzilla]] for details about creating a new one if you haven't already.
 
Please copy and paste the error and stack trace from the terminal into a bug report; see [[Bugzilla]] for details about creating a new one if you haven't already.
  
=== Windows ===
+
=== וינדוס ===
 
On [[Windows]] gdb has to be installed before you can generate a stack trace. While we provide some details below on how to do all of that we recognize this may be too challenging for the average user. If you have been asked to provide a stack trace, but you are using GnuCash on Windows only and find these instructions too daunting, please respond along the lines of  
 
On [[Windows]] gdb has to be installed before you can generate a stack trace. While we provide some details below on how to do all of that we recognize this may be too challenging for the average user. If you have been asked to provide a stack trace, but you are using GnuCash on Windows only and find these instructions too daunting, please respond along the lines of  
 
:"I'm sorry, but I encountered this problem only on Windows and I am not familiar enough with gdb on Windows to obtain stack traces there"
 
:"I'm sorry, but I encountered this problem only on Windows and I am not familiar enough with gdb on Windows to obtain stack traces there"
Line 131: Line 132:
 
To enter <code>[</code> and <code>]</code>, use <tt>set editing off</tt>.
 
To enter <code>[</code> and <code>]</code>, use <tt>set editing off</tt>.
  
=== See also ===
+
=== ראו גם ===
 
Other explanations on how to obtain stack traces:
 
Other explanations on how to obtain stack traces:
 
* http://live.gnome.org/GettingTraces  
 
* http://live.gnome.org/GettingTraces  
Line 137: Line 138:
 
* (in German) http://www.linuxwiki.de/gdb
 
* (in German) http://www.linuxwiki.de/gdb
  
== Debug symbol information ==
+
== מידע סמלי ניפוי־תקלים ==
 
Gnucash needs to be compiled in a way that has the debug symbols still included in the resulting binary libraries.  
 
Gnucash needs to be compiled in a way that has the debug symbols still included in the resulting binary libraries.  
 
* When '''compiling''' gnucash yourself, this is achieved by using the configure option <tt>./configure --enable-debug</tt>.
 
* When '''compiling''' gnucash yourself, this is achieved by using the configure option <tt>./configure --enable-debug</tt>.
 
* '''Distributions''' usually offer them in a separate packages appending <tt>-dbg</tt> or <tt>-debug</tt>.
 
* '''Distributions''' usually offer them in a separate packages appending <tt>-dbg</tt> or <tt>-debug</tt>.
  
=== Gentoo ===
+
=== ג'נטו ===
 
When emerging gnucash on gentoo, you need to make sure that
 
When emerging gnucash on gentoo, you need to make sure that
 
# the "debug" USE flag is enabled
 
# the "debug" USE flag is enabled
 
# ''and'' "<tt>FEATURES=nostrip</tt>" is set to disable symbol stripping.
 
# ''and'' "<tt>FEATURES=nostrip</tt>" is set to disable symbol stripping.
  
=== Ubuntu / Debian===
+
=== אובונטו / דביאן===
On Ubuntu, the debug symbols are available in a separate package called <tt>gnucash-dbg</tt>. See https://wiki.ubuntu.com/DebuggingProgramCrash  
+
בחבילת אובונטו, סימלי ניפוי־התקלים בחבילה הפרדת שנקראת <tt>gnucash-dbg</tt>. למידע נוסף ראו [https://wiki.ubuntu.com/DebuggingProgramCrash ניפוי קריסת תוכניות]
  
This issue is also explained here https://wiki.ubuntu.com/Backtrace.
+
או הסבר בקישור [https://wiki.ubuntu.com/Backtrace עקיבה לאחור]
  
 
----
 
----
 
{|cellpadding="10"
 
{|cellpadding="10"
| [[Tracefile]]
+
| [[Tracefile|קובץ עקיבה]]
| [[Logging]]
+
| [[Logging|יומנים]]
 
| [[Bugzilla#Using Bugzilla]]
 
| [[Bugzilla#Using Bugzilla]]
 
| [[FAQ#Q: How do I run GnuCash under gdb and get a stack trace?]]
 
| [[FAQ#Q: How do I run GnuCash under gdb and get a stack trace?]]
 
|}
 
|}

Latest revision as of 12:55, 29 November 2021

שפות English עִברִית

מה זה עקבות־מחסנית (Stack Trace)?

פעולת עקוב־מחסנית מייצרת פלט שמספק מידע על תתי־תכנית ושרשרת קריאות לפונקציות של התכנית העקרית עד לנקודה מסויימת בתכנית. רוב השימוש בעקוב־מחסנית נועד לניפוי תקלים מסוג מסויים. עקוב־מחסנית אמור לסייע לצוות הפתוח והתמיכה בהבנת הבעיה אחריה הופעל המעקב, או כיצד פועלות תתי־מערכות שונות יחד במהלך ביצוע תוכנית מסויימת. להלן דוגמת פלט עקבות־ערמה שהופעל במערכת הפעלה מק OX; מערכות הפעלה שונות מן הסתם יציגו מידע באופן שונה במקצת:

 Exception Type:        EXC_CRASH (SIGABRT)
 Exception Codes:       0x0000000000000000, 0x0000000000000000
 
 Application Specific Information:
 abort() called
 
 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
 0   libsystem_kernel.dylib        	0x9769169a __pthread_kill + 10
 1   libsystem_pthread.dylib       	0x9836bf19 pthread_kill + 101
 2   libsystem_c.dylib             	0x9bde5eee abort + 156
 3   libglib-2.0.0.dylib           	0x02b5dd8a g_assertion_message + 346
 4   libglib-2.0.0.dylib           	0x02b5e470 g_assertion_message_expr + 96
 5   libgncmod-gnome-utils.dylib   	0x0029ec4a gnc_main_window_init + 2650
 6   libgobject-2.0.0.dylib        	0x02ae7496 g_type_create_instance + 470
 7   libgobject-2.0.0.dylib        	0x02ad51a2 g_object_new_internal + 562
 8   libgobject-2.0.0.dylib        	0x02ad5a90 g_object_newv + 480
 9   libgobject-2.0.0.dylib        	0x02ad5b7d g_object_new + 61
 10  libgncmod-gnome-utils.dylib   	0x002a03d7 gnc_main_window_new + 39
 11  libgncmod-gnome-utils.dylib   	0x0029a6f5 gnc_gui_init + 581
 12  Gnucash-bin                   	0x00011387 main + 1143
 13  Gnucash-bin                   	0x00010ed6 start + 54

פלט זה מראה מדוע גנוקאש קרסה (משתנה בלתי תלוי בפונקציית init של החלון הראשי, כשל); ללא פעולת עקבות־מחסנית, משימת אבחן קריסה יכולה להיות משימה קשה ומורכבת ביותר. לפני שיגשו לטפל בסוגיות, מפתחים יבקשו בדרך כלל גם את קובץ העקיבה, שלרוב יספק מידע שימושי נוסף. במקרה מעלה, נמצא את הודעת המשתנה הבלתי־תלוי בפועל, שיסביר את נטישת התכנית (הקריסה).

עדיף עם סמלי איתור תקלים

ניתן להפיק עקבות־מחסנית ברמת מילוליות משתנה. כברירת מחדל, רוב ההפצות יאפשרו רק עקבות־מחסנית 'גסה' מאוד, בה לא יוצג מידע רב על כל פונקציה בנפרד. מעקב־המחסנית תהיה שימושית הרבה יותר יחד עם סמלי ניפוי תקלים זמינים. נא לאפשר אותם, ככל הניתן. במידה ומריצים את גנוקאש:

  • נא לחפש באמצעות מנהל ההתקנה את חבילת התכנה המכונה בלינוקס,
    -dbg
    או
    -debug
    והתקינו אותה.
    • במידה ונעשב שימוש גם בחבילות נוספות כדוגמת AqBanking, נסו למצוא ולהתקין את חבילת ה־
      -dbg
      שלהן גם כן. לאחר שהסוגיה טופלה, ניתן להסיר את החבילות הללו.
  • בבניה מקומית מקוד המקור, יש להוסיף את השורה
    -DCMAKE_BUILD_TYPE=Debug
    לאפשרויות cmake ולחזור שנית על תהליך ה־make.

Optional Preparation of Scheme Code

ToDo
perhaps somewhere else is a better place for this sction.

If reports are affected, see The Guile Reference Manual: Programmatic Error Handling

כיצד מפיקים עקבות־מחסנית?

macOS

Every time an application crashes in Mac OS X, the system writes a crash report with a stack trace to $HOME/Library/Logs/DiagnosticReports or $HOME/Library/Logs/CrashReporter, or both, depending on what version of OS X you're running. The crash reports are easily viewed with Applications:Utilities:Console, and if you're reporting a crash in Bugzilla or to the user's list you should attach one to your report.

על אודות מנפי־תקלים

In order to get a stack trace on Linux or Windows one must have either the GNU Debugger, gdb, or the LLVM Debugger, lldb, installed.

Gdb is a bit simpler to use, so the instructions below are for gdb.

לינוקס

בנוסף, אם נעשה שימוש בחבילות המסופקות דרך הפצת לינוקס (ולא על ידי הידור עצמי) להתקנת גנוקאש, ככל הנראה שיידרש להתקין גם חבילת סמלי ניפוי־תקלים (ראו מטה).

לאחר התקנת מנפה־תקלים (וסמלים על פי הצורך), ישנן שתי דרכים להפעיל את גנוקאש תחת שליטת מנפה־תקלים. אתחול תחת מנפה־תקלים היא מעט יותר פשוטה, אך מנפה־התקלים מאט את התכנית במידה ניכרת. לכן, אולי עדיף להפעיל את גנוקאש כרגיל, להגיע לנקודה שבה פעולה כלשהי מזניקה את ההתרסקות, ורק אז לחבר את גנוקאש (הפועל) למנפה־תקלים.

אתחול גנוקאש עם -gdb

  1. run gdb gnucash
  2. at the gdb prompt, type: "run". If you need to pass command line arguments, add them here, e.g. "run --nofile"
    Example
$ gdb gnucash
GNU gdb (GDB; openSUSE Tumbleweed) 8.3.1
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from gnucash...
(gdb) run --nofile

צרוף -gdb לתהליכים קיימים

  1. Start gnucash normally.
  2. In a terminal window run ps afx (some people prefer ps aux) to find out the process number (PID) of the running gnucash process; it might be called "gnucash" or "gnucash-bin". Say the PID is 12345.
  3. Run gdb gnucash
  4. Attach to the running process by typing attach 12345; gdb will temporarily stop the program
  5. Continue program execution by typing c at the "(gdb)" prompt

Obtain the stack trace

  1. Provoke the crash. When GnuCash crashes gdb will print the reason for the crash and present the "(gdb)" prompt again.
  2. Type bt (bt full might provide additional info about local variables).
  3. Gdb will print the backtrace.

יציאה מ־Gdb

ctrl-d or quit will end the gdb session.

Please copy and paste the error and stack trace from the terminal into a bug report; see Bugzilla for details about creating a new one if you haven't already.

וינדוס

On Windows gdb has to be installed before you can generate a stack trace. While we provide some details below on how to do all of that we recognize this may be too challenging for the average user. If you have been asked to provide a stack trace, but you are using GnuCash on Windows only and find these instructions too daunting, please respond along the lines of

"I'm sorry, but I encountered this problem only on Windows and I am not familiar enough with gdb on Windows to obtain stack traces there"

That's a fair answer even though in many cases your bugreport can only be worked on if you or someone else can actually produce such a stack trace.

  • Install "gdb" from mingw.org [1]
  • Open a Windows command prompt and type:
   set PATH=C:\Program Files\gdb\bin;%PATH%
   gdb "C:\Program Files\gnucash\bin\gnucash"
Be careful to use the actual paths in which you have installed gdb and gnucash respectively.

You can provide even better stack traces if you tell gdb where in memory dynamically loaded modules got mapped to, because otherwise function calls into those are only written as '??'. See here and here for a way to do this.

To enter [ and ], use set editing off.

ראו גם

Other explanations on how to obtain stack traces:

מידע סמלי ניפוי־תקלים

Gnucash needs to be compiled in a way that has the debug symbols still included in the resulting binary libraries.

  • When compiling gnucash yourself, this is achieved by using the configure option ./configure --enable-debug.
  • Distributions usually offer them in a separate packages appending -dbg or -debug.

ג'נטו

When emerging gnucash on gentoo, you need to make sure that

  1. the "debug" USE flag is enabled
  2. and "FEATURES=nostrip" is set to disable symbol stripping.

אובונטו / דביאן

בחבילת אובונטו, סימלי ניפוי־התקלים בחבילה הפרדת שנקראת gnucash-dbg. למידע נוסף ראו ניפוי קריסת תוכניות

או הסבר בקישור עקיבה לאחור


קובץ עקיבה יומנים Bugzilla#Using Bugzilla FAQ#Q: How do I run GnuCash under gdb and get a stack trace?