summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStan Cox <scox@redhat.com>2008-06-06 14:35:29 -0400
committerStan Cox <scox@redhat.com>2008-06-06 14:35:29 -0400
commit0c8b7d37152767709273c0e3de0f881f0d13b1b2 (patch)
tree8f351925b3c92329e4b725e5f267cd124437970f
parentdd078c96ead8cca8cbc832fac69bd33a0b5b6190 (diff)
downloadsystemtap-steved-0c8b7d37152767709273c0e3de0f881f0d13b1b2.tar.gz
systemtap-steved-0c8b7d37152767709273c0e3de0f881f0d13b1b2.tar.xz
systemtap-steved-0c8b7d37152767709273c0e3de0f881f0d13b1b2.zip
Add .statement("function@file.c+N")
-rw-r--r--ChangeLog8
-rw-r--r--tapsets.cxx27
2 files changed, 32 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index dc3202c9..14adb370 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-06-06 Stan Cox <scox@redhat.com>
+
+ * tapsets.cxx (dwflpp::iterate_over_srcfile_lines):
+ Add parameter line_type_relative.
+ (enum line_t): New.
+ (dwarf_query::line_type): New.
+ (dwarf_query::parse_function_spec): Set line_type.
+
2008-06-06 David Smith <dsmith@redhat.com>
* NEWS: Updated utrace probes descriptions.
diff --git a/tapsets.cxx b/tapsets.cxx
index ef701564..527272fa 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -1156,6 +1156,7 @@ struct dwflpp
void iterate_over_srcfile_lines (char const * srcfile,
int lineno,
bool need_single_match,
+ bool line_type_relative,
void (* callback) (Dwarf_Line * line, void * arg),
void *data)
{
@@ -1165,6 +1166,19 @@ struct dwflpp
get_module_dwarf();
+ if (line_type_relative)
+ {
+ Dwarf_Addr addr;
+ Dwarf_Line *line;
+ int line_number;
+
+ dwarf_assert ("dwarf_entrypc", dwarf_entrypc (this->function, &addr));
+ line = dwarf_getsrc_die (this->cu, addr);
+ dwarf_assert ("dwarf_getsrc_die", line == NULL);
+ dwarf_assert ("dwarf_lineno", dwarf_lineno (line, &line_number));
+ lineno += line_number;
+ }
+
dwarf_assert ("dwarf_getsrc_file",
dwarf_getsrc_file (module_dwarf,
srcfile, lineno, 0,
@@ -2349,6 +2363,8 @@ base_query::get_number_param(map<string, literal *> const & params,
}
+enum line_t { ABSOLUTE, RELATIVE };
+
struct dwarf_query : public base_query
{
dwarf_query(systemtap_session & sess,
@@ -2415,6 +2431,7 @@ struct dwarf_query : public base_query
function_spec_type spec_type;
string function;
string file;
+ line_t line_type;
int line;
bool query_done; // Found exact match
@@ -2886,7 +2903,7 @@ dwarf_query::parse_function_spec(string & spec)
while (i != e && *i != '@')
{
- if (*i == ':')
+ if (*i == ':' || *i == '+')
goto bad;
function += *i++;
}
@@ -2903,8 +2920,12 @@ dwarf_query::parse_function_spec(string & spec)
if (i++ == e)
goto bad;
- while (i != e && *i != ':')
+ while (i != e && *i != ':' && *i != '+')
file += *i++;
+ if (*i == ':')
+ line_type = ABSOLUTE;
+ else if (*i == '+')
+ line_type = RELATIVE;
if (i == e)
{
@@ -3508,7 +3529,7 @@ query_cu (Dwarf_Die * cudie, void * arg)
for (set<char const *>::const_iterator i = q->filtered_srcfiles.begin();
i != q->filtered_srcfiles.end(); ++i)
q->dw.iterate_over_srcfile_lines (*i, q->line, q->has_statement_str,
- query_srcfile_line, q);
+ q->line_type, query_srcfile_line, q);
}
else
{
span class="hl num">2.0+ .. Copyright (c) 2017 Simon Glass <sjg@chromium.org> Logging in U-Boot ================= Introduction ------------ U-Boot's internal operation involves many different steps and actions. From setting up the board to displaying a start-up screen to loading an Operating System, there are many component parts each with many actions. Most of the time this internal detail is not useful. Displaying it on the console would delay booting (U-Boot's primary purpose) and confuse users. But for digging into what is happening in a particular area, or for debugging a problem it is often useful to see what U-Boot is doing in more detail than is visible from the basic console output. U-Boot's logging feature aims to satisfy this goal for both users and developers. Logging levels -------------- There are a number logging levels available. See enum :c:type:`log_level_t` Logging category ---------------- Logging can come from a wide variety of places within U-Boot. Each log message has a category which is intended to allow messages to be filtered according to their source. See enum :c:type:`log_category_t` Enabling logging ---------------- The following options are used to enable logging at compile time: * CONFIG_LOG - Enables the logging system * CONFIG_LOG_MAX_LEVEL - Max log level to build (anything higher is compiled out) * CONFIG_LOG_CONSOLE - Enable writing log records to the console If CONFIG_LOG is not set, then no logging will be available. The above have SPL and TPL versions also, e.g. CONFIG_SPL_LOG_MAX_LEVEL and CONFIG_TPL_LOG_MAX_LEVEL. Temporary logging within a single file -------------------------------------- Sometimes it is useful to turn on logging just in one file. You can use this .. code-block:: c #define LOG_DEBUG to enable building in of all logging statements in a single file. Put it at the top of the file, before any #includes. To actually get U-Boot to output this you need to also set the default logging level - e.g. set CONFIG_LOG_DEFAULT_LEVEL to 7 (:c:data:`LOGL_DEBUG`) or more. Otherwise debug output is suppressed and will not be generated. Using DEBUG ----------- U-Boot has traditionally used a #define called DEBUG to enable debugging on a file-by-file basis. The debug() macro compiles to a printf() statement if DEBUG is enabled, and an empty statement if not. With logging enabled, debug() statements are interpreted as logging output with a level of LOGL_DEBUG and a category of LOGC_NONE. The logging facilities are intended to replace DEBUG, but if DEBUG is defined at the top of a file, then it takes precedence. This means that debug() statements will result in output to the console and this output will not be logged. Logging statements ------------------ The main logging function is: .. code-block:: c log(category, level, format_string, ...) Also debug() and error() will generate log records - these use LOG_CATEGORY as the category, so you should #define this right at the top of the source file to ensure the category is correct. You can also define CONFIG_LOG_ERROR_RETURN to enable the log_ret() macro. This can be used whenever your function returns an error value: .. code-block:: c return log_ret(uclass_first_device(UCLASS_MMC, &dev)); This will write a log record when an error code is detected (a value < 0). This can make it easier to trace errors that are generated deep in the call stack. Convenience functions ~~~~~~~~~~~~~~~~~~~~~ A number of convenience functions are available to shorten the code needed for logging: * log_err(_fmt...) * log_warning(_fmt...) * log_notice(_fmt...) * log_info(_fmt...) * log_debug(_fmt...) * log_content(_fmt...) * log_io(_fmt...) With these the log level is implicit in the name. The category is set by LOG_CATEGORY, which you can only define once per file, above all #includes, e.g. .. code-block:: c #define LOG_CATEGORY LOGC_ALLOC or .. code-block:: c #define LOG_CATEGORY UCLASS_SPI Remember that all uclasses IDs are log categories too. Logging destinations -------------------- If logging information goes nowhere then it serves no purpose. U-Boot provides several possible determinations for logging information, all of which can be enabled or disabled independently: * console - goes to stdout * syslog - broadcast RFC 3164 messages to syslog servers on UDP port 514 The syslog driver sends the value of environmental variable 'log_hostname' as HOSTNAME if available. Filters ------- Filters are attached to log drivers to control what those drivers emit. FIlters can either allow or deny a log message when they match it. Only records which are allowed by a filter make it to the driver. Filters can be based on several criteria: * minimum or maximum log level * in a set of categories * in a set of files If no filters are attached to a driver then a default filter is used, which limits output to records with a level less than CONFIG_MAX_LOG_LEVEL. Log command ----------- The 'log' command provides access to several features: * level - list log levels or set the default log level * categories - list log categories * drivers - list log drivers * filter-list - list filters * filter-add - add a new filter