public inbox for gnu-gabi@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Add PT_GNU_SFRAME segment
@ 2023-01-23 19:56 Indu Bhagat
  2023-01-24 11:13 ` Mark Wielaard
  0 siblings, 1 reply; 6+ messages in thread
From: Indu Bhagat @ 2023-01-23 19:56 UTC (permalink / raw)
  To: gnu-gabi; +Cc: Indu Bhagat

Hello,

As advised by Florian on libc-alpha, here is a patch to add PT_GNU_SFRAME to
the list of p_type values.

As I submit this patch, I am reminded of my ongoing unease with using the
keyword "unwind information" with SFrame format. SFrame format, is the Simple
Frame format, which represents the minimal necessary information for
backtracing:
  - Canonical Frame Address (CFA)
  - Frame Pointer (FP)
  - Return Address (RA)
As such, one can argue that there is a clear distinction between "backtrace"
(=simple call trace) and "unwind"(=stack walk + recover state/regs). 

What do you think will the "correct" terminology here (if there is one) ?
Simple Frame format is for backtracing only, but calling it a "backtrace
format" also sounds off. May be "backtracing format" ? Simple Frame, SFrame,
  backtracing format...

Thoughts?

Thanks
Indu

---
 program-loading-and-dynamic-linking.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/program-loading-and-dynamic-linking.txt b/program-loading-and-dynamic-linking.txt
index a07c195..9148486 100644
--- a/program-loading-and-dynamic-linking.txt
+++ b/program-loading-and-dynamic-linking.txt
@@ -129,6 +129,19 @@ PT_GNU_PROPERTY  0x6474e553
 
   Reference: https://raw.githubusercontent.com/wiki/hjl-tools/linux-abi/linux-abi-draft.pdf
 
+PT_GNU_SFRAME    0x6474e554
+
+  Segment contains the SFrame section (Simple Frame format unwind information).
+
+  NOTE: The virtual address range referred to by PT_GNU_SFRAME must be covered
+  by a PT_LOAD entry - PT_GNU_SFRAME on its own does not trigger the
+  mapping/loading of any data.
+
+  The contents of the SFrame section are described in the binutils
+  documentation.  As of 2.40:
+
+  https://sourceware.org/binutils/docs/sframe-spec.html
+
 There are further extensions to p_type but currently they are all
 architecture specific and should be documented in the relevant ABIs.
 
-- 
2.39.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Add PT_GNU_SFRAME segment
  2023-01-23 19:56 [PATCH] Add PT_GNU_SFRAME segment Indu Bhagat
@ 2023-01-24 11:13 ` Mark Wielaard
  2023-01-24 13:10   ` Carlos O'Donell
  2023-01-24 13:20   ` Florian Weimer
  0 siblings, 2 replies; 6+ messages in thread
From: Mark Wielaard @ 2023-01-24 11:13 UTC (permalink / raw)
  To: Indu Bhagat, gnu-gabi

Hi Indu,

On Mon, 2023-01-23 at 11:56 -0800, Indu Bhagat via Gnu-gabi wrote:
> As I submit this patch, I am reminded of my ongoing unease with using the
> keyword "unwind information" with SFrame format. SFrame format, is the Simple
> Frame format, which represents the minimal necessary information for
> backtracing:
>   - Canonical Frame Address (CFA)
>   - Frame Pointer (FP)
>   - Return Address (RA)
> As such, one can argue that there is a clear distinction between "backtrace"
> (=simple call trace) and "unwind"(=stack walk + recover state/regs). 
> 
> What do you think will the "correct" terminology here (if there is one) ?
> Simple Frame format is for backtracing only, but calling it a "backtrace
> format" also sounds off. May be "backtracing format" ? Simple Frame, SFrame,
>   backtracing format...
> 
> Thoughts?

What about calling it a "call trace"?
Although technically it is a "return trace".

Cheers,

Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Add PT_GNU_SFRAME segment
  2023-01-24 11:13 ` Mark Wielaard
@ 2023-01-24 13:10   ` Carlos O'Donell
  2023-01-24 13:20   ` Florian Weimer
  1 sibling, 0 replies; 6+ messages in thread
From: Carlos O'Donell @ 2023-01-24 13:10 UTC (permalink / raw)
  To: Mark Wielaard, Indu Bhagat, gnu-gabi

On 1/24/23 06:13, Mark Wielaard wrote:
> Hi Indu,
> 
> On Mon, 2023-01-23 at 11:56 -0800, Indu Bhagat via Gnu-gabi wrote:
>> As I submit this patch, I am reminded of my ongoing unease with using the
>> keyword "unwind information" with SFrame format. SFrame format, is the Simple
>> Frame format, which represents the minimal necessary information for
>> backtracing:
>>   - Canonical Frame Address (CFA)
>>   - Frame Pointer (FP)
>>   - Return Address (RA)
>> As such, one can argue that there is a clear distinction between "backtrace"
>> (=simple call trace) and "unwind"(=stack walk + recover state/regs). 
>>
>> What do you think will the "correct" terminology here (if there is one) ?
>> Simple Frame format is for backtracing only, but calling it a "backtrace
>> format" also sounds off. May be "backtracing format" ? Simple Frame, SFrame,
>>   backtracing format...
>>
>> Thoughts?
> 
> What about calling it a "call trace"?
> Although technically it is a "return trace".

You are "stack walking" in this case, either following a backchain, or sequence of chained
values that allow you to walk the stack and identify call frames. You are indeed walking
the list of called functions via their call frames.

I like "call trace" as a technical term. We are walking the call frames and taking a trace
of them, rather than unwinding. So "call trace format"?

-- 
Cheers,
Carlos.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Add PT_GNU_SFRAME segment
  2023-01-24 11:13 ` Mark Wielaard
  2023-01-24 13:10   ` Carlos O'Donell
@ 2023-01-24 13:20   ` Florian Weimer
  2023-01-24 14:57     ` Carlos O'Donell
  1 sibling, 1 reply; 6+ messages in thread
From: Florian Weimer @ 2023-01-24 13:20 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: Indu Bhagat, gnu-gabi

* Mark Wielaard:

> Hi Indu,
>
> On Mon, 2023-01-23 at 11:56 -0800, Indu Bhagat via Gnu-gabi wrote:
>> As I submit this patch, I am reminded of my ongoing unease with using the
>> keyword "unwind information" with SFrame format. SFrame format, is the Simple
>> Frame format, which represents the minimal necessary information for
>> backtracing:
>>   - Canonical Frame Address (CFA)
>>   - Frame Pointer (FP)
>>   - Return Address (RA)
>> As such, one can argue that there is a clear distinction between "backtrace"
>> (=simple call trace) and "unwind"(=stack walk + recover state/regs). 
>> 
>> What do you think will the "correct" terminology here (if there is one) ?
>> Simple Frame format is for backtracing only, but calling it a "backtrace
>> format" also sounds off. May be "backtracing format" ? Simple Frame, SFrame,
>>   backtracing format...
>> 
>> Thoughts?
>
> What about calling it a "call trace"?
> Although technically it is a "return trace".

“Stack trace” matches “SFrame”.  That's Python, Java etc. terminology
and seems appropriate here, too.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Add PT_GNU_SFRAME segment
  2023-01-24 13:20   ` Florian Weimer
@ 2023-01-24 14:57     ` Carlos O'Donell
  2023-01-24 21:52       ` Indu Bhagat
  0 siblings, 1 reply; 6+ messages in thread
From: Carlos O'Donell @ 2023-01-24 14:57 UTC (permalink / raw)
  To: Florian Weimer, Mark Wielaard; +Cc: Indu Bhagat, gnu-gabi

On 1/24/23 08:20, Florian Weimer via Gnu-gabi wrote:
> * Mark Wielaard:
> 
>> Hi Indu,
>>
>> On Mon, 2023-01-23 at 11:56 -0800, Indu Bhagat via Gnu-gabi wrote:
>>> As I submit this patch, I am reminded of my ongoing unease with using the
>>> keyword "unwind information" with SFrame format. SFrame format, is the Simple
>>> Frame format, which represents the minimal necessary information for
>>> backtracing:
>>>   - Canonical Frame Address (CFA)
>>>   - Frame Pointer (FP)
>>>   - Return Address (RA)
>>> As such, one can argue that there is a clear distinction between "backtrace"
>>> (=simple call trace) and "unwind"(=stack walk + recover state/regs). 
>>>
>>> What do you think will the "correct" terminology here (if there is one) ?
>>> Simple Frame format is for backtracing only, but calling it a "backtrace
>>> format" also sounds off. May be "backtracing format" ? Simple Frame, SFrame,
>>>   backtracing format...
>>>
>>> Thoughts?
>>
>> What about calling it a "call trace"?
>> Although technically it is a "return trace".
> 
> “Stack trace” matches “SFrame”.  That's Python, Java etc. terminology
> and seems appropriate here, too.

Agreed, good point. I'm fine with the use of the word "stack" in this context.

I looked at Java's documentation and they use the term "stack trace":
https://docs.oracle.com/en/java/javase/19/docs/specs/man/jstack.html

Likewise for Python the term is "stack traces":
https://docs.python.org/3/library/traceback.html?highlight=stack%20trace

That confirms the common usage in Java and Python.

That's enough for me to consider "stack traces" a good choice.

Note Ruby still calls it a "backtrace" in the context of exceptions:
https://docs.ruby-lang.org/en/master/Exception.html#method-i-backtrace
but I'd argue "stack trace" is a better choice there too.

-- 
Cheers,
Carlos.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Add PT_GNU_SFRAME segment
  2023-01-24 14:57     ` Carlos O'Donell
@ 2023-01-24 21:52       ` Indu Bhagat
  0 siblings, 0 replies; 6+ messages in thread
From: Indu Bhagat @ 2023-01-24 21:52 UTC (permalink / raw)
  To: Carlos O'Donell, Florian Weimer, Mark Wielaard; +Cc: gnu-gabi

On 1/24/23 06:57, Carlos O'Donell wrote:
> On 1/24/23 08:20, Florian Weimer via Gnu-gabi wrote:
>> * Mark Wielaard:
>>
>>> Hi Indu,
>>>
>>> On Mon, 2023-01-23 at 11:56 -0800, Indu Bhagat via Gnu-gabi wrote:
>>>> As I submit this patch, I am reminded of my ongoing unease with using the
>>>> keyword "unwind information" with SFrame format. SFrame format, is the Simple
>>>> Frame format, which represents the minimal necessary information for
>>>> backtracing:
>>>>    - Canonical Frame Address (CFA)
>>>>    - Frame Pointer (FP)
>>>>    - Return Address (RA)
>>>> As such, one can argue that there is a clear distinction between "backtrace"
>>>> (=simple call trace) and "unwind"(=stack walk + recover state/regs).
>>>>
>>>> What do you think will the "correct" terminology here (if there is one) ?
>>>> Simple Frame format is for backtracing only, but calling it a "backtrace
>>>> format" also sounds off. May be "backtracing format" ? Simple Frame, SFrame,
>>>>    backtracing format...
>>>>
>>>> Thoughts?
>>>
>>> What about calling it a "call trace"?
>>> Although technically it is a "return trace".
>>
>> “Stack trace” matches “SFrame”.  That's Python, Java etc. terminology
>> and seems appropriate here, too.
> 
> Agreed, good point. I'm fine with the use of the word "stack" in this context.
> 
> I looked at Java's documentation and they use the term "stack trace":
> https://docs.oracle.com/en/java/javase/19/docs/specs/man/jstack.html
> 
> Likewise for Python the term is "stack traces":
> https://docs.python.org/3/library/traceback.html?highlight=stack%20trace
> 
> That confirms the common usage in Java and Python.
> 
> That's enough for me to consider "stack traces" a good choice.
> 
> Note Ruby still calls it a "backtrace" in the context of exceptions:
> https://docs.ruby-lang.org/en/master/Exception.html#method-i-backtrace
> but I'd argue "stack trace" is a better choice there too.
> 

Thanks folks.

"stack trace" seems to fit well.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-24 21:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-23 19:56 [PATCH] Add PT_GNU_SFRAME segment Indu Bhagat
2023-01-24 11:13 ` Mark Wielaard
2023-01-24 13:10   ` Carlos O'Donell
2023-01-24 13:20   ` Florian Weimer
2023-01-24 14:57     ` Carlos O'Donell
2023-01-24 21:52       ` Indu Bhagat

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 read-only IMAP folder(s) and NNTP newsgroup(s).