URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [doc/] [LRS] - Rev 178
Go to most recent revision | Compare with Previous | Blame | View Log
What's LRS?===========LRS, or Live Range Splitting is an optimization technique which allowsa user variable to reside in different locations during different partsof a function.For example, a variable might reside in the stack for part of a functionand in a register during a loop and in a different register duringanother loop.Clearly, if a variable may reside in different locations, then thecompiler must describe to the debugger where the variable resides forany given part of the function.This document describes the debug format for encoding these extensionsin stabs.Since these extensions are gcc specific, these additional symbols andstabs can be disabled by the gcc command option -gstabs.GNU extensions for LRS under stabs:===================================range symbols:-------------A range symbol will be used to mark the beginning or end of alive range (the range which describes where a symbol is active,or live). These symbols will later be referenced in the stabs fordebug purposes. For simplicity, we'll use the terms "range_start"and "range_end" to identify the range symbols which mark the beginningand end of a live range respectively.Any text symbol which would normally appear in the symbol table(eg. a function name) can be used as range symbol. If an addressis needed to delimit a live range and does not match any of thevalues of symbols which would normally appear in the symbol table,a new symbol will be added to the table whose value is that address.The three new symbol types described below have been added for thispurpose.For efficiency, the compiler should use existing symbols as rangesymbols whenever possible; this reduces the number of additionalsymbols which need to be added to the symbol table.New debug symbol type for defining ranges:------------------------------------------range_off - contains PC function offset for start/end of a live range.Its location is relative to the function start and thereforeeliminates the need for additional relocation.This symbol has a values in the text section, and does not have a name.NOTE: the following may not be needed but are included here justin case.range - contains PC value of beginning or end of a live range(relocs required).NOTE: the following will be required if we desire LRS debuggingto work with old style a.out stabs.range_abs - contains absolute PC value of start/end of a liverange. The range_abs debug symbol is provided forcompleteness, in case there is a need to describe addressesin ROM, etc.Live range:-----------The compiler and debugger view a variable with multiple homes asa primary symbol and aliases for that symbol. The primary symboldescribes the default home of the variable while aliases describealternate homes for the variable.A live range defines the interval of instructions beginning withrange_start and ending at range_end-1, and is used to specify arange of instructions where an alias is active or "live". So,the actual end of the range will be one less than the value of therange_end symbol.Ranges do not have to be nested. Eg. Two ranges may intersect whileeach range contains subranges which are not in the other range.There does not have to be a 1-1 mapping from range_start torange_end symbols. Eg. Two range_starts can share the samerange_end, while one symbol's range_start can be another symbol'srange_end.When a variable's storage class changes (eg. from stack to register,or from one register to another), a new symbol entry will beadded to the symbol table with stabs describing the new type,and appropriate live ranges refering to the variable's initialsymbol index.For variables which are defined in the source but optimized away,a symbol should be emitted with the live range l(0,0).Live ranges for aliases of a particular variable should alwaysbe disjoint. Overlapping ranges for aliases of the same variablewill be treated as an error by the debugger, and the overlappingrange will be ignored.If no live range information is given, the live range will be assumed tospan the symbol's entire lexical scope.New stabs string identifiers:-----------------------------"id" in "#id" in the following section refers to a numeric value.New stab syntax for live range: l(<ref_from>,<ref_to>)<ref_from> - "#id" where #id identifies the text symbol (range symbol) touse as the start of live range (range_start). The value forthe referenced text symbol is the starting address of thelive range.<ref_to> - "#id" where #id identifies the text symbol (range symbol) touse as the end of live range (range_end). The value forthe referenced text symbol is ONE BYTE PAST the endingaddress of the live range.New stab syntax for identifying symbols.<def> - "#id="Uses:<def><name>:<typedef1>...When used in front of a symbol name, "#id=" defines aunique reference number for this symbol. The referencenumber can be used later when defining aliases for thissymbol.<def>When used as the entire stab string, "#id=" identifies thisnameless symbol as being the symbol for which "#id" refers to.<ref> - "#id" where "#id" refers to the symbol for which the string"#id=" identifies.Uses:<ref>:<typedef2>;<liverange>;<liverange>...Defines an alias for the symbol identified by the referencenumber ID.l(<ref1>,<ref2>)When used within a live range, "#id" refers to the textsymbol identified by "#id=" to use as the range symbol.<liverange> - "l(<ref_from>,<ref_to>)" - specifies a live range for asymbol. Multiple "l" specifiers can be combined to representmutiple live ranges, separated by semicolons.Example:========Consider a program of the form:void foo(){int a = ...;...while (b--)c += a;..d = a;..}Assume that "a" lives in the stack at offset -8, except for inside theloop where "a" resides in register "r5".The way to describe this is to create a stab for the variable "a" whichdescribes "a" as living in the stack and an alias for the variable "a"which describes it as living in register "r5" in the loop.Let's assume that "#1" and "#2" are symbols which bound the area where"a" lives in a register.The stabs to describe "a" and its alias would look like this:.stabs "#3=a:1",128,0,8,-8.stabs "#3:r1;l(#1,#2)",64,0,0,5This design implies that the debugger will keep a chain of aliases forany given variable with aliases and that chain will be searched firstto find out if an alias is active. If no alias is active, then thedebugger will assume that the main variable is active.
Go to most recent revision | Compare with Previous | Blame | View Log
