Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The call relationship between the functions within the Python script

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "the call relationship between the functions within the Python script". The explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the call relationship between the functions within the Python script.

As you all know, python internal stack and function calls are completed by PyEval_EvalFrameEx, a PyEval_EvalFrameEx means a function call, such as the 19th and 13th lines above correspond to main, segv_test, and freeNode functions respectively. After locating the gdb to the corresponding line, you can use the pylocals macro to view the details of the internal variables of the function.

(gdb) up 13

# 13 0x007d6d2b in PyEval_EvalFrameEx

(f=0x81242fc, throwflag=0) at Python/ceval.c:2370

2370 in Python/ceval.c

(gdb) pylocals

S:

Object:

''

Type: str

Refcount: 3

Address: 0xb7f64440

Options:

Object: 97

Type: int

Refcount: 7

Address: 0x8082c20

Doc:

Object:

Type: instance

Refcount: 1

Address: 0xb7cc04ec

Ctxt:

Object:

Type: instance

Refcount: 1

Address: 0xb7f70ccc

Nodes:

Object: []

Type: list

Refcount: 2

Address: 0xb7f70a8c

Note:

Object:

Type: instance

Refcount: 2

Address: 0xb7cc0cac

Nexts:

Object: [

]

Type: list

Refcount: 1

Address: 0xb7f4ce4c

Setting breakpoints when debugging Python scripts is a hassle, and there are two ways I can think of:

1 set the breakpoint according to the python source code of the function

(2) sleep function and ctrl+c are used to interrupt the operation of the program.

Thank you for your reading, the above is the content of "the call relationship between the functions within the Python script". After the study of this article, I believe you have a deeper understanding of the call relationship between the functions within the Python script, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report