Latest available version: IDA and decompilers v8.4.240320sp1 see all releases
Hex-Rays logo State-of-the-art binary code analysis tools
email icon
Segment names

Various ways to retrieve the name of a segment. More...

Functions

idaman int ida_export set_segm_name (segment_t *s, const char *name, int flags=0)
 Rename segment. More...
 
idaman ssize_t ida_export get_segm_name (qstring *buf, const segment_t *s, int flags=0)
 Get true segment name by pointer to segment. More...
 
ssize_t idaapi get_visible_segm_name (qstring *buf, const segment_t *s)
 Get segment name by pointer to segment. More...
 
ssize_t get_segm_expr (qstring *buf, ea_t from, sel_t sel)
 Get colored segment name expression in the form (segname + displacement). More...
 

Detailed Description

Various ways to retrieve the name of a segment.

Function Documentation

◆ set_segm_name()

idaman int ida_export set_segm_name ( segment_t s,
const char *  name,
int  flags = 0 
)

Rename segment.

The new name is validated (see validate_name). A segment always has a name. If you hadn't specified a name, the kernel will assign it "seg###" name where ### is segment number.

Parameters
spointer to segment (may be nullptr)
namenew segment name
flagsADDSEG_IDBENC or 0
Return values
1ok, name is good and segment is renamed
0failure, name is bad or segment is nullptr

◆ get_segm_name()

idaman ssize_t ida_export get_segm_name ( qstring buf,
const segment_t s,
int  flags = 0 
)

Get true segment name by pointer to segment.

Parameters
bufoutput buffer. cannot be nullptr
spointer to segment
flags0-return name as is; 1-substitute bad symbols with _ 1 corresponds to GN_VISIBLE
Returns
size of segment name (-1 if s==nullptr)

◆ get_visible_segm_name()

ssize_t idaapi get_visible_segm_name ( qstring buf,
const segment_t s 
)
inline

Get segment name by pointer to segment.

Parameters
bufoutput buffer. cannot be nullptr
spointer to segment
Returns
size of segment name (-1 if s==nullptr)

◆ get_segm_expr()

ssize_t get_segm_expr ( qstring buf,
ea_t  from,
sel_t  sel 
)

Get colored segment name expression in the form (segname + displacement).

Parameters
bufoutput buffer to hold segment expression
fromlinear address of instruction operand or data referring to the name. This address will be used to get fixup information, so it should point to exact position of operand in the instruction.
selvalue to convert to segment expression
Returns
size of segment expression or -1