IDA SDK
Functions
Segment names

Detailed Description

Various ways to retrieve the name of a segment.

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...
 

Function Documentation

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 NULL)
namenew segment name
flagsADDSEG_IDBENC or 0
Return values
1ok, name is good and segment is renamed
0failure, name is bad or segment is NULL
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. can not be NULL
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==NULL)
ssize_t idaapi get_visible_segm_name ( qstring buf,
const segment_t s 
)
inline

Get segment name by pointer to segment.

Parameters
bufoutput buffer. can not be NULL
spointer to segment
Returns
size of segment name (-1 if s==NULL)
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