1.\" 2.\" This file and its contents are supplied under the terms of the 3.\" Common Development and Distribution License ("CDDL"), version 1.0. 4.\" You may only use this file in accordance with the terms of version 5.\" 1.0 of the CDDL. 6.\" 7.\" A full copy of the text of the CDDL should have accompanied this 8.\" source. A copy of the CDDL is also available via the Internet at 9.\" http://www.illumos.org/license/CDDL. 10.\" 11.\" 12.\" Copyright 2015 Joyent, Inc. 13.\" 14.Dd May 11, 2016 15.Dt PADDR_TO_MAP 3PROC 16.Os 17.Sh NAME 18.Nm Paddr_to_map , 19.Nm Paddr_to_text_map , 20.Nm Plmid_to_map , 21.Nm Pname_to_map 22.Nd lookup memory map information 23.Sh SYNOPSIS 24.Lb libproc 25.In libproc.h 26.Ft "const prmap_t *" 27.Fo Paddr_to_map 28.Fa "struct ps_prochandle *P" 29.Fa "uintptr_t addr" 30.Fc 31.Ft "const prmap_t *" 32.Fo Paddr_to_text_map 33.Fa "struct ps_prochandle *P" 34.Fa "uintptr_t addr" 35.Fc 36.Ft "const prmap_t *" 37.Fo Plmid_to_map 38.Fa "struct ps_prochandle *P" 39.Fa "Lmid_t lmid" 40.Fa "const char *name" 41.Fc 42.Ft "const prmap_t *" 43.Fo Pname_to_map 44.Fa "struct ps_prochandle *P" 45.Fa "const char *name" 46.Fc 47.Sh DESCRIPTION 48The 49.Fn Paddr_to_map , 50.Fn Paddr_to_text_map , 51.Fn Plmid_to_map , 52and 53.Fn Pname_to_map 54functions lookup memory map information in the process handle 55.Fa P . 56The 57.Sy prmap_t 58structure provides information such as the size, offset, and object of 59the mapping and is defined in 60.Xr proc 4 . 61.Pp 62The pointer to the data returned by the library will only be valid for 63as long as the handle 64.Fa P 65is valid. Any calls to 66.Xr Prelease 3PROC 67will invalidate the data. 68.Pp 69The 70.Fn Paddr_to_map 71function attempts to find the mapping information corresponding to the 72address 73.Fa addr . 74.Pp 75The 76.Fn Paddr_to_text_map 77function is similar to the 78.Fn Paddr_to_map 79function; however, it only returns successfully if the specified address 80corresponds to a text mapping as identified by the run-time link-editor. 81One use of this is to ensure that a mapping is actually a text-mapping 82before inserting a breakpoint in it. 83.Pp 84The 85.Fn Pname_to_map 86function looks up the object named 87.Fa name 88and returns the corresponding mapping information. Two special 89values may be used for name. The macro 90.Dv PR_OBJ_EXEC 91refers to the executable object itself and the macro 92.Dv PR_OBJ_LDSO refers to the object ld.so.1 . 93.Pp 94The 95.Fn Plmid_to_map 96function is similar to 97.Fn Pname_to_map . 98It allows passing a link-map identifier, 99.Fa lmid , 100which constricts the search of the object named with 101.Fa name 102to that link-map. The special value of 103.Dv PR_LMID_EVERY 104may be passed to indicate that every link-map should be searched, which 105is equivalent in behavior to the 106.Fn Pname_to_map 107function. 108.Sh RETURN VALUES 109Upon successful completion, the 110.Fn Paddr_to_map , 111.Fn Paddr_to_text_map , 112.Fn Plmid_to_map , 113and 114.Fn Pname_to_map 115functions return a pointer to the corresponding mapping information. 116If none exists then 117.Dv NULL 118is returned. 119.Sh INTERFACE STABILITY 120.Sy Uncommitted 121.Sh MT-LEVEL 122See 123.Sy LOCKING 124in 125.Xr libproc 3LIB . 126.Sh SEE ALSO 127.Xr libproc 3LIB , 128.Xr Prelease 3PROC , 129.Xr proc 4 130